#[repr(C)]pub struct cec_msg {Show 14 fields
pub tx_ts: Timestamp,
pub rx_ts: Timestamp,
pub len: u32,
pub timeout: u32,
pub sequence: u32,
pub flags: CEC_MSG_FL,
pub msg: [u8; 16],
pub reply: u8,
pub rx_status: CEC_RX_STATUS,
pub tx_status: CEC_TX_STATUS,
pub tx_arb_lost_cnt: u8,
pub tx_nack_cnt: u8,
pub tx_low_drive_cnt: u8,
pub tx_error_cnt: u8,
}Expand description
CEC message structure.
Fields§
§tx_ts: TimestampTimestamp in nanoseconds using CLOCK_MONOTONIC. Set by the
driver when the message transmission has finished.
rx_ts: TimestampTimestamp in nanoseconds using CLOCK_MONOTONIC. Set by the
driver when the message was received.
len: u32Length in bytes of the message.
timeout: u32The timeout (in ms) that is used to timeout CEC_RECEIVE.
Set to 0 if you want to wait forever. This timeout can also be
used with CEC_TRANSMIT as the timeout for waiting for a reply.
If 0, then it will use a 1 second timeout instead of waiting
forever as is done with CEC_RECEIVE.
sequence: u32The framework assigns a sequence number to messages that are sent. This can be used to track replies to previously sent messages.
flags: CEC_MSG_FLSet to 0.
msg: [u8; 16]The message payload.
reply: u8This field is ignored with CEC_RECEIVE and is only used by
CEC_TRANSMIT. If non-zero, then wait for a reply with this
opcode. Set to CEC_MSG_FEATURE_ABORT if you want to wait for
a possible ABORT reply. If there was an error when sending the
msg or FeatureAbort was returned, then reply is set to 0.
If reply is non-zero upon return, then len/msg are set to
the received message.
If reply is zero upon return and status has the
CEC_TX_STATUS_FEATURE_ABORT bit set, then len/msg are set to
the received feature abort message.
If reply is zero upon return and status has the
CEC_TX_STATUS_MAX_RETRIES bit set, then no reply was seen at
all. If reply is non-zero for CEC_TRANSMIT and the message is a
broadcast, then -EINVAL is returned.
if reply is non-zero, then timeout is set to 1000 (the required
maximum response time).
rx_status: CEC_RX_STATUSThe message receive status bits. Set by the driver.
tx_status: CEC_TX_STATUSThe message transmit status bits. Set by the driver.
tx_arb_lost_cnt: u8The number of ‘Arbitration Lost’ events. Set by the driver.
tx_nack_cnt: u8The number of ‘Not Acknowledged’ events. Set by the driver.
tx_low_drive_cnt: u8The number of ‘Low Drive Detected’ events. Set by the driver.
tx_error_cnt: u8The number of ‘Error’ events. Set by the driver.
Implementations§
Source§impl cec_msg
impl cec_msg
Sourcepub fn destination(&self) -> u8
pub fn destination(&self) -> u8
Return the destination’s logical address.
Sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Return true if this is a broadcast message.
Sourcepub fn new(initiator: LogicalAddress, destination: LogicalAddress) -> cec_msg
pub fn new(initiator: LogicalAddress, destination: LogicalAddress) -> cec_msg
Initialize the message structure.
initiator is the logical address of the initiator and
destination the logical address of the destination (0xf for broadcast).
The whole structure is zeroed, the len field is set to 1 (i.e. a poll message) and the initiator and destination are filled in.
pub fn with_timeout(self, timeout_ms: u32) -> cec_msg
pub fn from_timeout(timeout_ms: u32) -> cec_msg
Sourcepub fn set_reply_to(&mut self, orig: &cec_msg)
pub fn set_reply_to(&mut self, orig: &cec_msg)
Fill in destination/initiator in a reply message.
Set the msg destination to the orig initiator and the msg initiator to the orig destination. Note that msg and orig may be the same pointer, in which case the change is done in place.
Sourcepub fn recv_is_tx_result(&self) -> bool
pub fn recv_is_tx_result(&self) -> bool
Return true if this message contains the result of an earlier non-blocking transmit
Sourcepub fn recv_is_rx_result(&self) -> bool
pub fn recv_is_rx_result(&self) -> bool
Return true if this message contains the reply of an earlier non-blocking transmit