cec
7 min
The cec object lets you send messages over CEC (Consumer Electronics Control).
cec IDL
interface ReceiveEvent {
attribute String type;
attribute Array<byte> data;
};
callback ReceiveEventCallback = void (ReceiveEvent event);
interface Cec {
Promise<void> send(Array<byte> data);
void addEventListener(String type, ReceiveEventCallback callback);
void removeEventListener(String type, ReceiveEventCallback callback);
};Object Creation
To create a cec object, load the @brightsign/cec module using the require() method.
const CecClass = require('@brightsign/cec');
const cec = new CecClass();Set the specific HDMI port for players with more than one output as follows:
const CecClass = require("@brightsign/cec");
const cec = new CecClass("HDMI-2"); //Modify this to be 'HDMI-1', 'HDMI-2', 'HDMI-3', and 'HDMI-4' as neededCec
Event
- ReceiveEvent: The CEC reception path is implemented as a receive event. The receive message has two generic fields:
- type: The event type "receive"
- data: Array CEC frame
Method
send()
Promise<void> send(Array<byte> data)Sends messages over cec.
- data Array<byte>: The CEC frame
port_name ()
Promise<void>The parameters for this optional argument are:
- default: The default output for the platform, normally HDMI-1
- HDMI-X: X is a number from 1 up to the number of HDMI® outputs on the platform
- eARC: The default for the AU335
As of BrightSignOS 8.2.55, the CEC implementation for AU series 5 products will reply to these messages with the correct data, without involving the script:
- CEC_MSG_GET_CEC_VERSION
- CEC_MSG_ABORT
- CEC_MSG_GIVE_DEVICE_POWER_STATUS
- CEC_MSG_GIVE_OSD_NAME
- CEC_MSG_GIVE_DEVICE_VENDOR_ID
- CEC_MSG_GIVE_FEATURES
- CEC_MSG_GIVE_PHYSICAL_ADDR
- CEC_MSG_USER_CONTROL_PRESSED
- CEC_MSG_USER_CONTROL_RELEASED
- CEC_MSG_REPORT_PHYSICAL_ADDR
Example
See this BrightScript example in GitHub.
See BSCECTransmitterBSCECTransmitter for an example that turns a display on and off.