RDK Documentation (Open Sourced RDK Components)
HDMI-CEC Connection

Description

The connection API allows the application to access CEC Bus. A connection is a tap into the CEC bus. The application can use a connection to send raw bytes (in form of CECFrame) onto CEC bus or receive raw bytes from it.

Each connection must have one and only one logical address. When application sends a CEC frame onto the connection, the connection's logical address will be used as the source address. On such connection, the application can only receive broadcast messages or unicast messages destined to the logical address of the connection.

The application can open multiple connections, with one connection dedicated to each Role of the application. For example, a Set-top Box of three roles (Record, Playback, and Tuner) can open three connections, with each connection used to send/receive messages of the relevant role. Such Role-Connection mapping is transparent to the devices on the CEC bus. The external devices will not be able to tell if the CEC messages come from connections of a same or different physical device.

All incoming CEEFrame arrived at the Physical CEC bus will be dispatched to all opened connections, based on the filtering criteria of the connection. By default, a connection with a given logical address filters out messages destined to other logical addresses.

When a connection is opened without a given logical address, this connection will pick up all messages destined to the host device, regardless what roles the device has. This is useful if the application wants to sniff all available CEC packets from the bus.

Data Structures

class  Connection
 The connection class provides APIs that allows the application to access CEC Bus. A connection is a tap into the CEC bus. The application can use a connection to send raw bytes (in form of CECFrame) onto CEC bus or receive raw bytes from it. More...
 

Data Structure Documentation

◆ Connection

class Connection

The connection class provides APIs that allows the application to access CEC Bus. A connection is a tap into the CEC bus. The application can use a connection to send raw bytes (in form of CECFrame) onto CEC bus or receive raw bytes from it.

Definition at line 57 of file Connection.hpp.

Collaboration diagram for Connection:
Collaboration graph

Public Member Functions

 Connection (const LogicalAddress &source=LogicalAddress::UNREGISTERED, bool opened=true, const std::string &name="")
 
void open (void)
 Open a connection to receive CEC packets from the bus. More...
 
void close (void)
 
void addFrameListener (FrameListener *listener)
 This function is used to listen for CECFrame, which is a byte stream that contains raw bytes received from CEC bus. More...
 
void removeFrameListener (FrameListener *listener)
 This function is used to remove the listener information from the queue. More...
 
void send (const CECFrame &frame, int timeout, const Throw_e &doThrow)
 This function is used to send CEC frame to CEC Bus. More...
 
void sendTo (const LogicalAddress &to, const CECFrame &frame, int timeout, const Throw_e &doThrow)
 This function is used to send CEC frame to CEC Bus. More...
 
void send (const CECFrame &frame, int timeout=0)
 This function is used to send CEC frame to CEC Bus. More...
 
void sendTo (const LogicalAddress &to, const CECFrame &frame, int timeout=0)
 This function is used to send CEC frame to CEC Bus. More...
 
void sendToAsync (const LogicalAddress &to, const CECFrame &frame)
 sends HDMI-CEC frame to CEC Bus using asynchronized method. More...
 
void poll (const LogicalAddress &from, const Throw_e &doThrow)
 This function is used to send poll message to the Bus. More...
 
void ping (const LogicalAddress &from, const LogicalAddress &to, const Throw_e &doThrow)
 This function is used to send ping message to the Bus. More...
 
void sendAsync (const CECFrame &frame)
 This function is used to send the CEC frame to physical CEC Bus using asynchronous method. More...
 
const LogicalAddressgetSource (void)
 
const void setSource (LogicalAddress &from)
 

Private Member Functions

void matchSource (const CECFrame &frame)
 Match the source address and update the logical address for the Connection. More...
 

Private Attributes

std::string name
 
LogicalAddress source
 
Busbus
 
DefaultFilter busFrameFilter
 
DefaultFrameListener busFrameListener
 
std::list< FrameListener * > frameListeners
 
Mutex mutex