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]]])¶
cec
PassTrue
to enable CEC communication to an external display (if possible).ddc
PassTrue
to enable DDC communication to an external display (if possible).ddc_addr
The 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_addr
with sourcesrc_addr
and databytes
.
- DisplayData.receive_frame(dst_addr, timeout=1000)¶
Waits
timeout
milliseconds to receive an HDMI-CEC frame for addressdst_addr
. Returns True if the received frame was fordst_addr
and False if not. On timeout throws anOSError
Exception.
- DisplayData.frame_callback(callback, dst_addr)¶
Registers a
callback
which 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_addr
sets 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 passingNone
as the callback for this method.