cec: read the persisted settings from the ROM, and update it in libcec_configuration...
[deb_libcec.git] / src / lib / adapter / AdapterCommunication.h
index cec8501a0c3e22a051fee4e3709dd758281577bf..15f0c9c305e61157cdea80aaca28ebc0bb18aaca 100644 (file)
@@ -46,15 +46,34 @@ namespace CEC
     ADAPTER_MESSAGE_STATE_ERROR                 /**< an error occured */
   } cec_adapter_message_state;
 
+  class IAdapterCommunicationCallback
+  {
+  public:
+    IAdapterCommunicationCallback(void) {}
+    virtual ~IAdapterCommunicationCallback(void) {}
+
+    /*!
+     * @brief Callback method for IAdapterCommunication, called when a new cec_command is received
+     * @param command The command that has been received
+     * @return True when it was handled by this listener, false otherwise.
+     */
+    virtual bool OnCommandReceived(const cec_command &command) = 0;
+  };
+
   class IAdapterCommunication
   {
   public:
+    IAdapterCommunication(void) {}
+    virtual ~IAdapterCommunication(void) {}
+
     /*!
      * @brief Open a connection to the CEC adapter
+     * @param cb The callback struct. if set to NULL, the Read() method has to be used to read commands. if set, OnCommandReceived() will be called for each command that was received
      * @param iTimeoutMs Connection timeout in ms
+     * @param bSkipChecks Skips all initial checks of the adapter, and starts the reader/writer threads directly after connecting.
      * @return True when connected, false otherwise
      */
-    virtual bool Open(uint32_t iTimeoutMs = 10000) = 0;
+    virtual bool Open(IAdapterCommunicationCallback *cb, uint32_t iTimeoutMs = 10000, bool bSkipChecks = false) = 0;
 
     /*!
      * @brief Close an open connection
@@ -119,5 +138,34 @@ namespace CEC
      * @return The firmware version of this CEC adapter.
      */
     virtual uint16_t GetFirmwareVersion(void) = 0;
+
+    /*!
+     * @return True when the control mode has been set, false otherwise.
+     */
+    virtual bool SetControlledMode(bool controlled) = 0;
+
+    /*!
+     * @brief Persist the given configuration in adapter (if supported)
+     * @brief The configuration to store.
+     * @return True when the configuration was persisted, false otherwise.
+     */
+    virtual bool PersistConfiguration(libcec_configuration *configuration) = 0;
+
+    /*!
+     * @brief Get the persisted configuration from the adapter (if supported)
+     * @param configuration The updated configuration.
+     * @return True when the configuration was updated, false otherwise.
+     */
+    virtual bool GetConfiguration(libcec_configuration *configuration) = 0;
+
+    /*!
+     * @return The name of the port
+     */
+    virtual CStdString GetPortName(void) = 0;
+
+    /*!
+     * @return The physical address, if the adapter supports this. 0 otherwise.
+     */
+    virtual uint16_t GetPhysicalAddress(void) = 0;
   };
 };