class CUSBCECAdapterCommands
{
public:
- CUSBCECAdapterCommands(CUSBCECAdapterCommunication *comm) :
- m_comm(comm),
- m_iFirmwareVersion(CEC_FW_VERSION_UNKNOWN) {}
+ CUSBCECAdapterCommands(CUSBCECAdapterCommunication *comm);
/*!
* @brief Request the firmware version from the adapter.
*/
uint16_t RequestFirmwareVersion(void);
+ /*!
+ * @return The firmware version of the adapter, retrieved when the connection is opened.
+ */
+ uint16_t GetFirmwareVersion(void) const { return m_persistedConfiguration.iFirmwareVersion; };
+
+ /*!
+ * @brief Persist the current configuration in the EEPROM.
+ * @attention Not all settings are persisted at this time.
+ * @param configuration The configuration to persist.
+ * @return True when persisted, false otherwise.
+ */
+ bool PersistConfiguration(libcec_configuration *configuration);
+
+ /*!
+ * @brief Get the persisted configuration from the EEPROM.
+ * @param configuration The persisted configuration.
+ * @return True when retrieved, false otherwise.
+ */
+ bool GetConfiguration(libcec_configuration *configuration);
+
+ /*!
+ * @brief Send a ping command to the adapter.
+ * @return True when acked by the adapter, false otherwise.
+ */
+ bool PingAdapter(void);
+
+ /*!
+ * @brief Change the ackmask of the adapter.
+ * @param iMask The new mask.
+ * @return True when the change was acked by the adapter, false otherwise.
+ */
+ bool SetAckMask(uint16_t iMask);
+
+ /*!
+ * @brief Put the adapter in bootloader mode.
+ * @attention The connection needs to be closed after this call, since the adapter will no longer be available.
+ * @return True when the command was sent, false otherwise.
+ */
+ bool StartBootloader(void);
+
+ /*!
+ * @brief Change the current CEC line timeout.
+ * @param iTimeout The new timeout.
+ * @return True when the change was acked by the adapter, false otherwise.
+ */
+ bool SetLineTimeout(uint8_t iTimeout);
+
+ /*!
+ * @brief Put the adapter in controlled or autonomous mode.
+ * @param controlled True to switch to controlled mode, false to switch to auto mode.
+ * @return True when acked by the controller, false otherwise.
+ */
+ bool SetControlledMode(bool controlled);
+
+ /*!
+ * @brief Request the firmware build date from the device.
+ * @return The build date in seconds since epoch, or 0 when no (valid) reply was received.
+ */
+ uint32_t RequestBuildDate(void);
+
+ private:
+ /*!
+ * @brief Reads all settings from the eeprom.
+ * @return True when read, false otherwise.
+ */
+ bool RequestSettings(void);
+
/*!
* @brief Request a setting value from the adapter.
* @param msgCode The setting to retrieve.
/*!
* @brief Request the value of the "auto enabled" setting from the adapter.
- * @param enabled The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingAutoEnabled(bool &enabled);
+ bool RequestSettingAutoEnabled(void);
/*!
* @brief Change the value of the "device type" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "device type" setting from the adapter.
- * @param type The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingDeviceType(cec_device_type &type);
+ bool RequestSettingDeviceType(void);
/*!
* @brief Change the value of the "default logical address" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "default logical address" setting from the adapter.
- * @param address The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingDefaultLogicalAddress(cec_logical_address &address);
+ bool RequestSettingDefaultLogicalAddress(void);
/*!
* @brief Change the value of the "logical address mask" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "logical address mask" setting from the adapter.
- * @param iMask The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingLogicalAddressMask(uint16_t &iMask);
+ bool RequestSettingLogicalAddressMask(void);
/*!
* @brief Change the value of the "physical address" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "physical address" setting from the adapter.
- * @param iPhysicalAddress The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingPhysicalAddress(uint16_t &iPhysicalAddress);
+ bool RequestSettingPhysicalAddress(void);
/*!
* @brief Change the value of the "CEC version" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "CEC version" setting from the adapter.
- * @param version The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingCECVersion(cec_version &version);
+ bool RequestSettingCECVersion(void);
/*!
* @brief Change the value of the "OSD name" setting, used when the device is in autonomous mode.
/*!
* @brief Request the value of the "OSD name" setting from the adapter.
- * @param strOSDName The current value.
* @return True when retrieved, false otherwise.
*/
- bool RequestSettingOSDName(CStdString &strOSDName);
+ bool RequestSettingOSDName(void);
/*!
* @brief Persist the current settings in the EEPROM
*/
bool WriteEEPROM(void);
- /*!
- * @return The firmware version of the adapter, retrieved when the connection is opened.
- */
- uint16_t GetFirmwareVersion(void) const { return m_iFirmwareVersion; };
-
- /*!
- * @brief Persist the current configuration in the EEPROM.
- * @attention Not all settings are persisted at this time.
- * @param configuration The configuration to persist.
- * @return True when persisted, false otherwise.
- */
- bool PersistConfiguration(libcec_configuration *configuration);
-
- /*!
- * @brief Get the persisted configuration from the EEPROM.
- * @param configuration The persisted configuration.
- * @return True when retrieved, false otherwise.
- */
- bool GetConfiguration(libcec_configuration *configuration);
-
- /*!
- * @brief Send a ping command to the adapter.
- * @return True when acked by the adapter, false otherwise.
- */
- bool PingAdapter(void);
-
- /*!
- * @brief Change the ackmask of the adapter.
- * @param iMask The new mask.
- * @return True when the change was acked by the adapter, false otherwise.
- */
- bool SetAckMask(uint16_t iMask);
-
- /*!
- * @brief Put the adapter in bootloader mode.
- * @attention The connection needs to be closed after this call, since the adapter will no longer be available.
- * @return True when the command was sent, false otherwise.
- */
- bool StartBootloader(void);
-
- /*!
- * @brief Change the current CEC line timeout.
- * @param iTimeout The new timeout.
- * @return True when the change was acked by the adapter, false otherwise.
- */
- bool SetLineTimeout(uint8_t iTimeout);
-
- /*!
- * @brief Put the adapter in controlled or autonomous mode.
- * @param controlled True to switch to controlled mode, false to switch to auto mode.
- * @return True when acked by the controller, false otherwise.
- */
- bool SetControlledMode(bool controlled);
-
- private:
- CUSBCECAdapterCommunication *m_comm; /**< the communication handler */
- uint16_t m_iFirmwareVersion; /**< the firwmare version that was retrieved while opening the connection */
+ CUSBCECAdapterCommunication *m_comm; /**< the communication handler */
+ bool m_bSettingsRetrieved; /**< true when the settings were read from the eeprom, false otherwise */
+ bool m_bSettingAutoEnabled; /**< the value of the auto-enabled setting */
+ cec_version m_settingCecVersion; /**< the value of the cec version setting */
+ uint16_t m_iSettingLAMask; /**< the value of the LA mask setting */
+ bool m_bNeedsWrite; /**< true when we sent changed settings to the adapter that have not been persisted */
+ libcec_configuration m_persistedConfiguration; /**< the configuration that is persisted in the eeprom */
+ uint32_t m_iBuildDate; /**< the build date of the firmware */
};
}