X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fadapter%2FUSBCECAdapterCommunication.h;h=513900d5be28d8584d3e7431002913c2d6ec977b;hb=b5117104dff139ffb5dbc6fe3ec995a4ed554f67;hp=ee8593fb583b641c81baaad75349cc8c5dd9fe5c;hpb=b1f94db151af0ba66f9fe1043ef80c9769591e4b;p=deb_libcec.git diff --git a/src/lib/adapter/USBCECAdapterCommunication.h b/src/lib/adapter/USBCECAdapterCommunication.h index ee8593f..513900d 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.h +++ b/src/lib/adapter/USBCECAdapterCommunication.h @@ -31,7 +31,7 @@ * http://www.pulse-eight.net/ */ -#include +#include "../../../include/cectypes.h" #include "../platform/threads/threads.h" #include "../platform/util/buffer.h" #include "AdapterCommunication.h" @@ -46,6 +46,23 @@ namespace CEC { class CCECProcessor; + class CUSBCECAdapterProcessor: public PLATFORM::CThread + { + public: + CUSBCECAdapterProcessor(IAdapterCommunicationCallback *cb) : + m_callback(cb) {}; + virtual ~CUSBCECAdapterProcessor(void) + { + StopThread(); + } + + void *Process(void); + void AddCommand(cec_command command); + private: + IAdapterCommunicationCallback * m_callback; + PLATFORM::SyncedBuffer m_inBuffer; + }; + class CUSBCECAdapterCommunication : public IAdapterCommunication, private PLATFORM::CThread { public: @@ -66,9 +83,15 @@ namespace CEC virtual bool PingAdapter(void); virtual uint16_t GetFirmwareVersion(void); virtual bool SetControlledMode(bool controlled); + virtual bool PersistConfiguration(libcec_configuration * UNUSED(configuration)) { return false; } // TODO + virtual CStdString GetPortName(void); + virtual uint16_t GetPhysicalAddress(void) { return 0; } void *Process(void); private: + bool SetAckMaskInternal(uint16_t iMask, bool bWriteDirectly = false); + + bool CheckAdapter(uint32_t iTimeoutMs = 10000); bool Write(CCECAdapterMessage *data); bool Read(CCECAdapterMessage &msg, uint32_t iTimeout = 1000); bool ParseMessage(const CCECAdapterMessage &msg); @@ -83,7 +106,8 @@ namespace CEC PLATFORM::SyncedBuffer m_inBuffer; PLATFORM::SyncedBuffer m_outBuffer; PLATFORM::CMutex m_mutex; - PLATFORM::CCondition m_rcvCondition; + PLATFORM::CCondition m_rcvCondition; + volatile bool m_bHasData; uint8_t m_iLineTimeout; uint16_t m_iFirmwareVersion; cec_command m_currentframe; @@ -92,5 +116,7 @@ namespace CEC bool m_bNextIsEscaped; bool m_bGotStart; IAdapterCommunicationCallback * m_callback; + CUSBCECAdapterProcessor * m_messageProcessor; + bool m_bInitialised; }; };