X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FAdapterCommunication.h;h=9762926cc10a23e0561b96914c13b2ba4fac2aa8;hb=b1f94db151af0ba66f9fe1043ef80c9769591e4b;hp=36a9bb1d434356bd304afc86119f35347e6af0c4;hpb=8e57f83c5cc5b448024c9e2c9bf8f2d93b78c756;p=deb_libcec.git diff --git a/src/lib/adapter/AdapterCommunication.h b/src/lib/adapter/AdapterCommunication.h index 36a9bb1..9762926 100644 --- a/src/lib/adapter/AdapterCommunication.h +++ b/src/lib/adapter/AdapterCommunication.h @@ -46,15 +46,27 @@ namespace CEC ADAPTER_MESSAGE_STATE_ERROR /**< an error occured */ } cec_adapter_message_state; - class IAdapterCommunication + struct IAdapterCommunicationCallback + { + public: + /*! + * @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; + }; + + struct IAdapterCommunication { public: /*! * @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 * @return True when connected, false otherwise */ - virtual bool Open(uint32_t iTimeoutMs = 10000) = 0; + virtual bool Open(IAdapterCommunicationCallback *cb, uint32_t iTimeoutMs = 10000) = 0; /*! * @brief Close an open connection