![]() |
libCEC 8.1.0
C / C++ API — control CEC-capable HDMI devices
|
To create a new libCEC instance, call CECInitialise() and pass the configuration as argument. More...
#include <cec.h>
Public Member Functions | |
| virtual | ~ICECAdapter () |
Adapter methods | |
| virtual bool | Open (const char *strPort, uint32_t iTimeoutMs=10000)=0 |
| Open a connection to the CEC adapter. | |
| virtual void | Close (void)=0 |
| Close the connection to the CEC adapter. | |
| virtual bool | PingAdapter (void)=0 |
| Sends a ping command to the adapter, to check if it's responding. | |
| virtual bool | StartBootloader (void)=0 |
| Start the bootloader of the CEC adapter. | |
| virtual bool | Transmit (const cec_command &data)=0 |
| Transmit a raw CEC command over the CEC line. | |
| virtual bool | SetLogicalAddress (cec_logical_address iLogicalAddress=CECDEVICE_PLAYBACKDEVICE1)=0 |
| Change the logical address on the CEC bus of the CEC adapter. | |
| virtual bool | SetPhysicalAddress (uint16_t iPhysicalAddress=0x1000)=0 |
| Change the physical address (HDMI port) of the CEC adapter. | |
| virtual bool | PowerOnDevices (cec_logical_address address=CECDEVICE_TV)=0 |
| Power on the given CEC capable devices. | |
| virtual bool | StandbyDevices (cec_logical_address address=CECDEVICE_BROADCAST)=0 |
| Put the given CEC capable devices in standby mode. | |
| virtual bool | SetActiveSource (cec_device_type type=CEC_DEVICE_TYPE_RESERVED)=0 |
| Change the active source to a device type handled by libCEC. | |
| virtual bool | SetDeckControlMode (cec_deck_control_mode mode, bool bSendUpdate=true)=0 |
| Change the deck control mode, if this adapter is registered as playback or recording device. | |
| virtual bool | SetDeckInfo (cec_deck_info info, bool bSendUpdate=true)=0 |
| Change the deck info, if this adapter is a playback or recording device. | |
| virtual bool | SetInactiveView (void)=0 |
| Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source. | |
| virtual bool | SetMenuState (cec_menu_state state, bool bSendUpdate=true)=0 |
| Change the menu state. | |
| virtual bool | SetOSDString (cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)=0 |
| Display a message on the device with the given logical address. | |
| virtual bool | SwitchMonitoring (bool bEnable)=0 |
| Enable or disable monitoring mode, for debugging purposes. | |
| virtual cec_version | GetDeviceCecVersion (cec_logical_address iLogicalAddress)=0 |
| Get the CEC version of the device with the given logical address. | |
| virtual std::string | GetDeviceMenuLanguage (cec_logical_address iLogicalAddress)=0 |
| Get the menu language of the device with the given logical address. | |
| virtual uint32_t | GetDeviceVendorId (cec_logical_address iLogicalAddress)=0 |
| Get the vendor ID of the device with the given logical address. | |
| virtual cec_power_status | GetDevicePowerStatus (cec_logical_address iLogicalAddress)=0 |
| Get the power status of the device with the given logical address. | |
| virtual bool | PollDevice (cec_logical_address iLogicalAddress)=0 |
| Sends a POLL message to a device, to check if it's present and responding. | |
| virtual cec_logical_addresses | GetActiveDevices (void)=0 |
| virtual bool | IsActiveDevice (cec_logical_address iLogicalAddress)=0 |
| Check whether a device is active on the bus. | |
| virtual bool | IsActiveDeviceType (cec_device_type type)=0 |
| Check whether a device of the given type is active on the bus. | |
| virtual uint8_t | VolumeUp (bool bSendRelease=true)=0 |
| Sends a volume up keypress to an audiosystem if it's present. | |
| virtual uint8_t | VolumeDown (bool bSendRelease=true)=0 |
| Sends a volume down keypress to an audiosystem if it's present. | |
| virtual uint8_t | MuteAudio (void)=0 |
| Toggles the mute status of an audiosystem, if it's present. | |
| virtual bool | SendKeypress (cec_logical_address iDestination, cec_user_control_code key, bool bWait=false)=0 |
| Send a keypress to a device on the CEC bus. | |
| virtual bool | SendKeyRelease (cec_logical_address iDestination, bool bWait=false)=0 |
| Send a key release to a device on the CEC bus. | |
| virtual std::string | GetDeviceOSDName (cec_logical_address iAddress)=0 |
| Get the OSD name of a device on the CEC bus. | |
| virtual cec_logical_address | GetActiveSource (void)=0 |
| Get the logical address of the device that is currently the active source on the CEC bus. | |
| virtual bool | IsActiveSource (cec_logical_address iLogicalAddress)=0 |
| Check whether a device is currently the active source on the CEC bus. | |
| virtual bool | SetStreamPath (cec_logical_address iLogicalAddress)=0 |
| Sets the stream path to the device on the given logical address. | |
| virtual bool | SetStreamPath (uint16_t iPhysicalAddress)=0 |
| Sets the stream path to the device on the given physical address. | |
| virtual cec_logical_addresses | GetLogicalAddresses (void)=0 |
| virtual bool | GetCurrentConfiguration (libcec_configuration *configuration)=0 |
| Get libCEC's current configuration. | |
| virtual bool | SetConfiguration (const libcec_configuration *configuration)=0 |
| Change libCEC's configuration. | |
| virtual bool | CanSaveConfiguration (void)=0 |
| virtual void | RescanActiveDevices (void)=0 |
| Tell libCEC to poll for active devices on the bus. | |
| virtual bool | IsLibCECActiveSource (void)=0 |
| virtual bool | GetDeviceInformation (const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs=10000)=0 |
| Get information about the given CEC adapter. | |
| virtual bool | SetCallbacks (ICECCallbacks *callbacks, void *cbParam)=0 |
| Set and enable the callback methods. | |
| virtual bool | DisableCallbacks (void)=0 |
| Disable all callbacks. | |
| virtual bool | SetHDMIPort (cec_logical_address iBaseDevice, uint8_t iPort)=0 |
| Changes the active HDMI port. | |
| virtual uint16_t | GetDevicePhysicalAddress (cec_logical_address iLogicalAddress)=0 |
| Get the physical address of the device with the given logical address. | |
| virtual const char * | GetLibInfo (void)=0 |
| virtual void | InitVideoStandalone (void)=0 |
| Calling this method will initialise the host on which libCEC is running. | |
| virtual uint16_t | GetAdapterVendorId (void) const =0 |
| virtual uint16_t | GetAdapterProductId (void) const =0 |
| virtual const char * | ToString (const cec_menu_state state)=0 |
| virtual const char * | ToString (const cec_version version)=0 |
| virtual const char * | ToString (const cec_power_status status)=0 |
| virtual const char * | ToString (const cec_logical_address address)=0 |
| virtual const char * | ToString (const cec_deck_control_mode mode)=0 |
| virtual const char * | ToString (const cec_deck_info status)=0 |
| virtual const char * | ToString (const cec_opcode opcode)=0 |
| virtual const char * | ToString (const cec_system_audio_status mode)=0 |
| virtual const char * | ToString (const cec_audio_status status)=0 |
| virtual const char * | ToString (const cec_vendor_id vendor) |
| virtual const char * | ToString (const cec_device_type type)=0 |
| virtual const char * | ToString (const cec_user_control_code key)=0 |
| virtual const char * | ToString (const cec_adapter_type type)=0 |
| virtual std::string | VersionToString (uint32_t version)=0 |
| virtual void | PrintVersion (uint32_t version, char *buf, size_t bufSize)=0 |
| virtual const char * | VendorIdToString (uint32_t vendor)=0 |
| virtual uint8_t | AudioToggleMute (void)=0 |
| Toggle the mute status of the AVR (if present) | |
| virtual uint8_t | AudioMute (void)=0 |
| Mute the AVR (if present) | |
| virtual uint8_t | AudioUnmute (void)=0 |
| Mute the AVR (if connected) | |
| virtual uint8_t | AudioStatus (void)=0 |
| Get the current audio status (if an AVR is connected) | |
| virtual int8_t | DetectAdapters (cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath=nullptr, bool bQuickScan=false)=0 |
| Try to find all connected CEC adapters. | |
| virtual cec_command | CommandFromString (const char *strCommand)=0 |
| Create a new cec_command from a string. | |
| virtual bool | AudioEnable (bool enable)=0 |
| Enable or disable system audio mode. | |
| virtual uint8_t | SystemAudioModeStatus (void)=0 |
| Get the current system audio mode status (if an AVR is connected) | |
| virtual bool | GetStats (struct cec_adapter_stats *stats)=0 |
To create a new libCEC instance, call CECInitialise() and pass the configuration as argument.
Then call Open() to open a connection to the adapter. Close() closes the connection and CECDestroy() cleans up the libCEC instance.
libCEC can send commands to other devices on the CEC bus via the methods on this interface, and all commands that libCEC received are sent back to the application via callback methods. The callback methods can be found in cectypes.h, ICECCallbacks.
|
pure virtual |
Open a connection to the CEC adapter.
| strPort | The path to the port. |
| iTimeoutMs | Connection timeout in ms. |
|
pure virtual |
Close the connection to the CEC adapter.
|
pure virtual |
Sends a ping command to the adapter, to check if it's responding.
|
pure virtual |
Start the bootloader of the CEC adapter.
Closes the connection when successful.
|
pure virtual |
|
pure virtual |
Change the logical address on the CEC bus of the CEC adapter.
libCEC automatically assigns a logical address, and this method is only available for debugging purposes.
| iLogicalAddress | The CEC adapter's new logical address. |
|
pure virtual |
Change the physical address (HDMI port) of the CEC adapter.
libCEC will try to autodetect the physical address when connecting. If it did, it's set in libcec_configuration.
| iPhysicalAddress | The CEC adapter's new physical address. |
True when the physical address was set successfully, false otherwise.
|
pure virtual |
Power on the given CEC capable devices.
If CECDEVICE_BROADCAST is used, then wakeDevice in libcec_configuration will be used.
| address | The logical address to power on. |
|
pure virtual |
Put the given CEC capable devices in standby mode.
If CECDEVICE_BROADCAST is used, then standbyDevices in libcec_configuration will be used.
address The logical address of the device to put in standby.
|
pure virtual |
Change the active source to a device type handled by libCEC.
Use CEC_DEVICE_TYPE_RESERVED to make the default type used by libCEC active.
| type | The new active source. Leave empty to use the primary type |
|
pure virtual |
Change the deck control mode, if this adapter is registered as playback or recording device.
| mode | The new control mode. |
| bSendUpdate | True to send the new status over the CEC line. |
|
pure virtual |
Change the deck info, if this adapter is a playback or recording device.
| info | The new deck info. |
| bSendUpdate | True to send the new status over the CEC line. |
|
pure virtual |
Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source.
|
pure virtual |
Change the menu state.
This value is already changed by libCEC automatically if a device is (de)activated.
| state | The new state. |
| bSendUpdate | True to send the new status over the CEC line. |
|
pure virtual |
Display a message on the device with the given logical address.
Not supported by most TVs.
| iLogicalAddress | The logical address of the device to display the message on. |
| duration | The duration of the message |
| strMessage | The message to display. |
|
pure virtual |
Enable or disable monitoring mode, for debugging purposes.
If monitoring mode is enabled, libCEC won't respond to any command, but only log incoming data.
| bEnable | True to enable, false to disable. |
|
pure virtual |
|
pure virtual |
Get the menu language of the device with the given logical address.
| iLogicalAddress | The logical address of the device to get the menu language for. |
|
pure virtual |
Get the vendor ID of the device with the given logical address.
| iLogicalAddress | The logical address of the device to get the vendor ID for. |
|
pure virtual |
Get the power status of the device with the given logical address.
| iLogicalAddress | The logical address of the device to get the power status for. |
|
pure virtual |
Sends a POLL message to a device, to check if it's present and responding.
| iLogicalAddress | The device to send the message to. |
|
pure virtual |
|
pure virtual |
Check whether a device is active on the bus.
| iLogicalAddress | The address to check. |
|
pure virtual |
Check whether a device of the given type is active on the bus.
| type | The type to check. |
|
pure virtual |
Sends a volume up keypress to an audiosystem if it's present.
| bSendRelease | Send a key release after the keypress. |
|
pure virtual |
Sends a volume down keypress to an audiosystem if it's present.
| bSendRelease | Send a key release after the keypress. |
|
pure virtual |
Toggles the mute status of an audiosystem, if it's present.
|
pure virtual |
Send a keypress to a device on the CEC bus.
| iDestination | The logical address of the device to send the message to. |
| key | The key to send. |
| bWait | True to wait for a response, false otherwise. |
|
pure virtual |
Send a key release to a device on the CEC bus.
| iDestination | The logical address of the device to send the message to. |
| bWait | True to wait for a response, false otherwise. |
|
pure virtual |
Get the OSD name of a device on the CEC bus.
| iLogicalAddress | The device to get the OSD name for. |
|
pure virtual |
Get the logical address of the device that is currently the active source on the CEC bus.
|
pure virtual |
Check whether a device is currently the active source on the CEC bus.
| iLogicalAddress | The logical address of the device to check. |
|
pure virtual |
Sets the stream path to the device on the given logical address.
| iLogicalAddress | The address to activate. |
|
pure virtual |
Sets the stream path to the device on the given physical address.
| iPhysicalAddress | The address to activate. |
|
pure virtual |
|
pure virtual |
Get libCEC's current configuration.
| configuration | The configuration. |
|
pure virtual |
Change libCEC's configuration.
Store it updated settings in the eeprom of the device (if supported)
| configuration | The new configuration. |
|
pure virtual |
|
pure virtual |
Tell libCEC to poll for active devices on the bus.
|
pure virtual |
|
pure virtual |
Get information about the given CEC adapter.
| strPort | The port to which the device is connected |
| config | The device configuration |
| iTimeoutMs | The timeout in milliseconds |
|
pure virtual |
Set and enable the callback methods.
| callbacks | The callbacks to set. |
| cbParam | Parameter to pass to callback methods. |
|
pure virtual |
Disable all callbacks.
|
pure virtual |
Changes the active HDMI port.
| iBaseDevice | The device to which this libCEC is connected. |
| iPort | The new port number. |
|
pure virtual |
Get the physical address of the device with the given logical address.
| iLogicalAddress | The logical address of the device to get the physical address for. |
|
pure virtual |
|
pure virtual |
Calling this method will initialise the host on which libCEC is running.
Calling this method will initialise the host on which libCEC is running. On the RPi, it calls bcm_host_init(), which may only be called once per process, and is called by any process using the video api on that system. So only call this method if libCEC is used in an application that does not already initialise the video api.
Should be called as first call to libCEC, directly after CECInitialise() and before using Open()
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inlinevirtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Toggle the mute status of the AVR (if present)
|
pure virtual |
Mute the AVR (if present)
|
pure virtual |
Mute the AVR (if connected)
|
pure virtual |
Get the current audio status (if an AVR is connected)
|
pure virtual |
Try to find all connected CEC adapters.
| deviceList | The vector to store device descriptors in. |
| iBufSize | The size of the deviceList buffer. |
| strDevicePath | Optional device path. Only adds device descriptors that match the given device path. |
| bQuickScan | True to do a "quick scan", which will not open a connection to the adapter. Firmware version information and the exact device type will be missing |
|
pure virtual |
Create a new cec_command from a string.
| strCommand | The string with the command data |
|
pure virtual |
Enable or disable system audio mode.
| enable | True to enable, false to disable |
|
pure virtual |
Get the current system audio mode status (if an AVR is connected)
|
pure virtual |