X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=include%2FCECExportsC.h;h=d1987cb18720233b064ef474976b88e74a6107cd;hb=2b32d0ab4a65fd7ac86072285e87972e1131b98a;hp=04ce11a61e35e71c0fbbe0fd4c315d3333181ed1;hpb=abbca718e0f6b5a20170561beeacafa0b5852500;p=deb_libcec.git diff --git a/include/CECExportsC.h b/include/CECExportsC.h index 04ce11a..d1987cb 100644 --- a/include/CECExportsC.h +++ b/include/CECExportsC.h @@ -39,17 +39,22 @@ extern "C" { #endif /*! - * @brief Initialise the cec device. + * @brief Load the CEC adapter library. * @param strDeviceName How to present this device to other devices. + * @param iLogicalAddress The logical of this device. PLAYBACKDEVICE1 by default. + * @param iPhysicalAddress The physical address of this device. 0x1000 by default. * @return True when initialised, false otherwise. */ -extern DECLSPEC bool cec_init(const char *strDeviceName); +#ifdef __cplusplus +extern DECLSPEC bool cec_init(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); +#else +extern DECLSPEC bool cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); +#endif /*! - * @brief Close the cec device. - * @return True when the device was closed, false otherwise. + * @brief Unload the CEC adapter library. */ -extern DECLSPEC bool cec_close(void); +extern DECLSPEC void cec_destroy(void); /*! * @brief Open a connection to the CEC adapter. @@ -57,13 +62,30 @@ extern DECLSPEC bool cec_close(void); * @param iTimeout Connection timeout in ms. * @return True when connected, false otherwise. */ -extern DECLSPEC bool cec_open(const char *strPort, int iTimeout); +extern DECLSPEC bool cec_open(const char *strPort, uint32_t iTimeout); + +/*! + * @brief Close the connection to the CEC adapter. + */ +extern DECLSPEC void cec_close(void); + +/*! + * @brief Try to find all connected CEC adapters. Only implemented on Linux at the moment. + * @param deviceList The vector to store device descriptors in. + * @param strDevicePath Optional device path. Only adds device descriptors that match the given device path. + * @return The number of devices that were found, or -1 when an error occured. + */ +#ifdef __cplusplus +extern DECLSPEC int8_t cec_find_adapters(CEC::cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); +#else +extern DECLSPEC int8_t cec_find_adapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); +#endif /*! * @brief Ping the CEC adapter. * @return True when the ping was succesful, false otherwise. */ -extern DECLSPEC bool cec_ping(void); +extern DECLSPEC bool cec_ping_adapters(void); /*! * @brief Start the bootloader of the CEC adapter. @@ -72,27 +94,29 @@ extern DECLSPEC bool cec_ping(void); extern DECLSPEC bool cec_start_bootloader(void); /*! - * @brief Power off connected CEC capable devices. - * @return True when the command was sent succesfully, false otherwise. + * @return Get the minimal version of libcec that this version of libcec can interface with. */ -#ifdef __cplusplus -extern DECLSPEC bool cec_power_off_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST); -#else -extern DECLSPEC bool cec_power_off_devices(cec_logical_address address = CECDEVICE_BROADCAST); -#endif +extern DECLSPEC int8_t cec_get_min_version(void); + +/*! + * @return Get the version of libcec. + */ +extern DECLSPEC int8_t cec_get_lib_version(void); /*! * @brief Power on the connected CEC capable devices. + * @param address The logical address to power on. * @return True when the command was sent succesfully, false otherwise. */ #ifdef __cplusplus -extern DECLSPEC bool cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST); +extern DECLSPEC bool cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_TV); #else -extern DECLSPEC bool cec_power_on_devices(cec_logical_address address = CECDEVICE_BROADCAST); +extern DECLSPEC bool cec_power_on_devices(cec_logical_address address = CECDEVICE_TV); #endif /*! * @brief Put connected CEC capable devices in standby mode. + * @brief address The logical address of the device to put in standby. * @return True when the command was sent succesfully, false otherwise. */ #ifdef __cplusplus @@ -102,13 +126,13 @@ extern DECLSPEC bool cec_standby_devices(cec_logical_address address = CECDEVICE #endif /*! - * @brief Set this device as the active source on connected CEC capable devices. + * @brief Broadcast a message that notifies connected CEC capable devices that this device is the active source. * @return True when the command was sent succesfully, false otherwise. */ extern DECLSPEC bool cec_set_active_view(void); /*! - * @brief Mark this device as inactive on connected CEC capable devices. + * @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source. * @return True when the command was sent succesfully, false otherwise. */ extern DECLSPEC bool cec_set_inactive_view(void); @@ -126,7 +150,7 @@ extern DECLSPEC bool cec_get_next_log_message(cec_log_message *message); /*! * @brief Get the next keypress in the queue, if there is one. - * @param key The next keypress + * @param key The next keypress. * @return True if a key was passed, false otherwise. */ #ifdef __cplusplus @@ -136,30 +160,37 @@ extern DECLSPEC bool cec_get_next_keypress(cec_keypress *key); #endif /*! - * @brief Transmit a frame and wait for ACK. + * @brief Get the next CEC command that was received by the adapter. + * @param action The next command. + * @return True when a command was passed, false otherwise. + */ +#ifdef __cplusplus +extern DECLSPEC bool cec_get_next_command(CEC::cec_command *command); +#else +extern DECLSPEC bool cec_get_next_command(cec_command *command); +#endif + +/*! + * @brief Transmit a frame on the CEC line. * @param data The frame to send. + * @param bWaitForAck Wait for an ACK message for 1 second after this frame has been sent. * @return True when the data was sent and acked, false otherwise. */ #ifdef __cplusplus -extern DECLSPEC bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 5000); +extern DECLSPEC bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck = true); #else -extern DECLSPEC bool cec_transmit(const cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 5000); +extern DECLSPEC bool cec_transmit(const cec_frame &data, bool bWaitForAck = true); #endif /*! - * @brief Set the ack mask for the CEC adapter. - * @param ackmask The new ack mask. - * @return True when the ack mask was sent succesfully, false otherwise. + * @brief Set the logical address of the CEC adapter. + * @param iLogicalAddress The cec adapter's logical address. + * @return True when the logical address was set succesfully, false otherwise. */ -extern DECLSPEC bool cec_set_ack_mask(uint16_t ackmask); - -extern DECLSPEC int cec_get_min_version(void); -extern DECLSPEC int cec_get_lib_version(void); - #ifdef __cplusplus -extern DECLSPEC int cec_find_devices(std::vector &deviceList, const char *strDevicePath = NULL); +extern DECLSPEC bool cec_set_logical_address(CEC::cec_logical_address iLogicalAddress); #else -extern DECLSPEC int cec_find_devices(std::vector &deviceList, const char *strDevicePath = NULL); +extern DECLSPEC bool cec_set_logical_address(cec_logical_address myAddress, cec_logical_address targetAddress); #endif #ifdef __cplusplus