libCEC 8.1.0
C / C++ API — control CEC-capable HDMI devices
Loading...
Searching...
No Matches
cec_command Struct Reference

#include <cectypes.h>

Public Member Functions

 cec_command (void)
 
cec_commandoperator= (const struct cec_command &command)
 
uint8_t Size (void) const
 
int Serialize (uint8_t *buffer, uint8_t iBufSize, bool bWithHeader=true) const
 Serialize this command as an on-wire CEC frame: [header][opcode][operands...].
 
void PushBack (uint8_t data)
 Push a byte to the back of this command.
 
void Clear (void)
 Clear this command, resetting everything to the default values.
 
void PushArray (size_t len, const uint8_t *data)
 

Static Public Member Functions

static void Format (cec_command &command, cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode, int32_t timeout=1000)
 Formats a cec_command.
 
static cec_opcode GetResponseOpcode (cec_opcode opcode)
 

Public Attributes

cec_logical_address initiator
 the logical address of the initiator of this message
 
cec_logical_address destination
 the logical address of the destination of this message
 
int8_t ack
 1 when the ACK bit is set, 0 otherwise
 
int8_t eom
 1 when the EOM bit is set, 0 otherwise
 
cec_opcode opcode
 the opcode of this message
 
cec_datapacket parameters
 the parameters attached to this message
 
int8_t opcode_set
 1 when an opcode is set, 0 otherwise (POLL message)
 
int32_t transmit_timeout
 the timeout to use in ms
 

Detailed Description

Definition at line 1092 of file cectypes.h.

Constructor & Destructor Documentation

◆ cec_command()

cec_command::cec_command ( void  )
inline

Definition at line 1104 of file cectypes.h.

Member Function Documentation

◆ operator=()

cec_command & cec_command::operator= ( const struct cec_command command)
inline

Definition at line 1109 of file cectypes.h.

◆ Size()

uint8_t cec_command::Size ( void  ) const
inline

Definition at line 1123 of file cectypes.h.

◆ Serialize()

int cec_command::Serialize ( uint8_t *  buffer,
uint8_t  iBufSize,
bool  bWithHeader = true 
) const
inline

Serialize this command as an on-wire CEC frame: [header][opcode][operands...].

The frame is capped to a single CEC frame (CEC_MAX_FRAME_SIZE bytes) and to the destination buffer; a command that does not fit is rejected rather than truncated or overrunning the buffer. This is the single place where the transmit length is bounded, so adapter backends do not need their own size checks.

Parameters
bufferThe destination buffer.
iBufSizeThe size of the destination buffer, in bytes.
bWithHeaderWhen true (default), byte 0 is the initiator/destination header. When false, serialization starts at the opcode, for backends that carry the addressing in a separate field (e.g. the kernel cec_msg or the TDA995x frame header).
Returns
The number of bytes written (>= 0), or -1 when the command exceeds a CEC frame or would not fit the destination buffer.

Definition at line 1143 of file cectypes.h.

◆ Format()

static void cec_command::Format ( cec_command command,
cec_logical_address  initiator,
cec_logical_address  destination,
cec_opcode  opcode,
int32_t  timeout = 1000 
)
inlinestatic

Formats a cec_command.

Parameters
commandThe command to format.
initiatorThe logical address of the initiator.
destinationThe logical address of the destination.
opcodeThe opcode of the command.
timeoutThe transmission timeout.

Definition at line 1171 of file cectypes.h.

◆ PushBack()

void cec_command::PushBack ( uint8_t  data)
inline

Push a byte to the back of this command.

Parameters
dataThe byte to push.

Definition at line 1188 of file cectypes.h.

◆ Clear()

void cec_command::Clear ( void  )
inline

Clear this command, resetting everything to the default values.

Definition at line 1207 of file cectypes.h.

◆ GetResponseOpcode()

static cec_opcode cec_command::GetResponseOpcode ( cec_opcode  opcode)
inlinestatic

Definition at line 1219 of file cectypes.h.

◆ PushArray()

void cec_command::PushArray ( size_t  len,
const uint8_t *  data 
)
inline

Definition at line 1256 of file cectypes.h.

Member Data Documentation

◆ initiator

cec_logical_address cec_command::initiator

the logical address of the initiator of this message

Definition at line 1094 of file cectypes.h.

◆ destination

cec_logical_address cec_command::destination

the logical address of the destination of this message

Definition at line 1095 of file cectypes.h.

◆ ack

int8_t cec_command::ack

1 when the ACK bit is set, 0 otherwise

Definition at line 1096 of file cectypes.h.

◆ eom

int8_t cec_command::eom

1 when the EOM bit is set, 0 otherwise

Definition at line 1097 of file cectypes.h.

◆ opcode

cec_opcode cec_command::opcode

the opcode of this message

Definition at line 1098 of file cectypes.h.

◆ parameters

cec_datapacket cec_command::parameters

the parameters attached to this message

Definition at line 1099 of file cectypes.h.

◆ opcode_set

int8_t cec_command::opcode_set

1 when an opcode is set, 0 otherwise (POLL message)

Definition at line 1100 of file cectypes.h.

◆ transmit_timeout

int32_t cec_command::transmit_timeout

the timeout to use in ms

Definition at line 1101 of file cectypes.h.


The documentation for this struct was generated from the following file: