Skip to main content

cec_msg

Struct cec_msg 

Source
#[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: Timestamp

Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the driver when the message transmission has finished.

§rx_ts: Timestamp

Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the driver when the message was received.

§len: u32

Length in bytes of the message.

§timeout: u32

The 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: u32

The framework assigns a sequence number to messages that are sent. This can be used to track replies to previously sent messages.

§flags: CEC_MSG_FL

Set to 0.

§msg: [u8; 16]

The message payload.

§reply: u8

This 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_STATUS

The message receive status bits. Set by the driver.

§tx_status: CEC_TX_STATUS

The message transmit status bits. Set by the driver.

§tx_arb_lost_cnt: u8

The number of ‘Arbitration Lost’ events. Set by the driver.

§tx_nack_cnt: u8

The number of ‘Not Acknowledged’ events. Set by the driver.

§tx_low_drive_cnt: u8

The number of ‘Low Drive Detected’ events. Set by the driver.

§tx_error_cnt: u8

The number of ‘Error’ events. Set by the driver.

Implementations§

Source§

impl cec_msg

Source

pub fn initiator(&self) -> u8

Return the initiator’s logical address.

Source

pub fn destination(&self) -> u8

Return the destination’s logical address.

Source

pub fn opcode(&self) -> Option<u8>

Return the opcode of the message, None for poll

Source

pub fn is_broadcast(&self) -> bool

Return true if this is a broadcast message.

Source

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.

Source

pub fn with_timeout(self, timeout_ms: u32) -> cec_msg

Source

pub fn from_timeout(timeout_ms: u32) -> cec_msg

Source

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.

Source

pub fn recv_is_tx_result(&self) -> bool

Return true if this message contains the result of an earlier non-blocking transmit

Source

pub fn recv_is_rx_result(&self) -> bool

Return true if this message contains the reply of an earlier non-blocking transmit

Source

pub fn status_is_ok(&self) -> bool

Trait Implementations§

Source§

impl Clone for cec_msg

Source§

fn clone(&self) -> cec_msg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for cec_msg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.