class DisplayData – Display Data¶
The DisplayData class is used for getting information about the attached DisplayPort/HDMI Display.
构造函数¶
- class display.DisplayData([cec=False[, ddc=False[, ddc_addr=0x50]]])¶
cecPassTrueto enable CEC communication to an external display (if possible).ddcPassTrueto enable DDC communication to an external display (if possible).ddc_addrThe I2C address to use to talk to the external display EEPROM.
方法¶
- display.DisplayData.display_id()¶
Returns the external display EDID data as a bytes() object. Verifying the EDID headers, checksums, and concatenating all sections into one bytes() object is done for you. You may then parse this information by following this guide.
- DisplayData.send_frame(dst_addr, src_addr, bytes)¶
Sends a packet on the HDMI-CEC bus to
dst_addrwith sourcesrc_addrand databytes.
- DisplayData.receive_frame(dst_addr, timeout=1000)¶
Waits
timeoutmilliseconds to receive an HDMI-CEC frame for addressdst_addr. Returns True if the received frame was fordst_addrand False if not. On timeout throws anOSErrorException.
- DisplayData.frame_callback(callback, dst_addr)¶
Registers a
callbackwhich will be called on reception of an HDMI-CEC frame. The callback will receive two arguments of the frame src_addr as an int and payload as abytes()object.dst_addrsets the filter address to listen to on the CEC bus.If you use this method do not call
DisplayData.receive_frame()anymore until the callback is disabled by passingNoneas the callback for this method.