CEC
The CEC module is used to control devices connected to the STB via the HDMI cable. The APIs provided in this module can be used to integrate the CEC features in the HTML application.
Some of the CEC features are described below:
One Touch Play
The One Touch Play feature allows a device to be played and become the active source with a single button press.
System standby
This feature allows to send a standby message to a dedicated device on the CEC-bus or to all devices as a broadcast message.
System information
Provide CEC related information of the system.
Members
ActiveStateMode
Enum for the CEC active state modes.
Properties:
| Name | Type | Description |
|---|---|---|
IMAGE | Switch to display mode but leave TV menu on if present | |
TEXT | Switch to display mode but remove any TV menu |
onCECMessage
Signal emitted when something interesting occurs with the CEC bus. The listener will be passed the following arguments:
- message: An object of type CECMessage.
OSDDisplayMode
Enum for the Display control values when displaying OSD messages.
Properties:
| Name | Type | Description |
|---|---|---|
DEFAULT | Display for the default time (TV dependent) | |
WAIT | Display until cleared | |
CLEAR | Clear the last message displayed |
Methods
disable()
Disables the CEC subsystem and persists this setting.
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
displayString(mode, message)
Send a 13-character long message to the TV.
Parameters::
| Name | Type | Description |
|---|---|---|
mode | module:Platform.CEC.OSDDisplayMode | The desired On Screen Display mode. |
message | String | The message to display. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
enable()
Enables the CEC subsystem and persists this setting.
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
getDeviceMenuLanguage(device)
Gets the current menu language of the specified device. If no device is specified, then this method returns the current menu language of the tv device.
Parameters:
| Name | Type | Description |
|---|---|---|
device | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - language: The menu language of the device. |
getDeviceOSDName(device)
Gets the OSD name of the specified device. If no device is specified, then this method returns the OSD name of the tv device.
Parameters:
| Name | Type | Description |
|---|---|---|
device | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - name: The OSD name of the device. |
getDevicePhysicalAddress(device)
Gets the physical address of the specified device. If no device is specified, then this method returns the physical address of the tv device.
Parameters:
| Name | Type | Description |
|---|---|---|
device | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - address: The physical address of the device. |
getDevicePowerState(device)
Gets the current power state of the specified device. If no device is specified, then this method returns the power state of the tv device.
Parameters:
| Name | Type | Description |
|---|---|---|
device | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - power_state: The current power state of the device as is defined by the HDMI-CEC specification. |
getDeviceVersion(device)
Gets the CEC version of the specified device. If no device is specified, then this method returns the CEC version of the tv device.
Parameters:
| Name | Type | Description |
|---|---|---|
device | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - version: The CEC version of the device. |
getLocalState()
Gets the current CEC state of the local device.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - info: A CECState object. |
reportMenuLanguage(language)
Sends a broadcast message through the CEC bus to inform other devices about the current menu language of the STB.
Parameters:
| Name | Type | Description |
|---|---|---|
language | String | The broadcast message. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
sendStandbyMessage(devices)
Sends a standby message to one or more devices identified by their logical addresses.
Parameters:
| Name | Type | Description |
|---|---|---|
devices | Array | An array of numbers with the device logical addresses as is defined by the HDMI-CEC specification. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setActiveSource(mode)
Sets the STB as active source of the tv device. If no argument is passed, then the image mode is assumed.
Parameters:
| Name | Type | Description |
|---|---|---|
mode | module:Platform.CEC.ActiveStateMode | The desired active state mode. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setActiveStartup(mode)
Configures the STB to send the active source CEC message during system startup.
Parameters:
| Name | Type | Description |
|---|---|---|
mode | module:Platform.CEC.ActiveStateMode | The desired active state mode. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setInactiveSource()
Marks the STB as inactive source of the tv device.
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setLocalOSDName(name)
Sets and persists the OSD name of the STB. Depending on the tv device model, the new OSD name may or may not be shown immediately.
Parameters:
| Name | Type | Description ----- |
|---|---|---|
name | String | The desired OSD name of the STB. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
Type Defintions
CECMessage
CEC message structure.
Properties:
| Name | Type | Description |
|---|---|---|
| opcode | Number | The opcode of the message as is defined by the HDMI-CEC specification. |
| description | String | A human readable description of the message type. |
| source | Number | The source of the message as is defined by the HDMI-CEC specification. |
| destination | Number | The destination of the message as is defined by the HDMI-CEC specification. |
| operands | Array | An array of numbers that represent any operands the message may carry with it. |
CECState
CEC state object properties.
Properties:
| Name | Type | Description |
|---|---|---|
| active_state | module:Platform.CEC.ActiveStateMode | The CEC active state mode. |
| enabled | Boolean | The CEC module operability. When disabled, 0 is returned, any other value otherwise. |
| logical_address | Number | The logical address of the device as is defined by the HDMI-CEC specification. |
| osd_name | String | A human readable name for the system CEC module, which will be used to identify the system from other devices. |
| physical_address | String | The physical address of the system. |
| power_state | Number | The power state of the system as is defined by the HDMI-CEC specification. |
| version | String | The CEC version of the system. |