cec: wait for multiple responses, not just for one. don't try to read and write at...
[deb_libcec.git] / src / lib / adapter / USBCECAdapterCommunication.h
index fc9e16ce044d30da4357288e88ed3b0ac1fd306e..d1f033fbfac90cc9f698a494776447543893e9f8 100644 (file)
@@ -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<cec_command> m_inBuffer;
+  };
+
   class CUSBCECAdapterCommunication : public IAdapterCommunication, private PLATFORM::CThread
   {
   public:
@@ -72,6 +89,8 @@ namespace CEC
 
     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);
@@ -97,5 +116,6 @@ namespace CEC
     bool                                         m_bNextIsEscaped;
     bool                                         m_bGotStart;
     IAdapterCommunicationCallback *              m_callback;
+    CUSBCECAdapterProcessor *                    m_messageProcessor;
   };
 };