updated copyright messages for 2013
[deb_libcec.git] / src / lib / adapter / Pulse-Eight / USBCECAdapterMessageQueue.h
index edd34be9ae964c2deb80ee5874d1b3de6d86ae2f..8b3b0253b98ecc1632aa2a01a723f18ef77ed8dc 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
@@ -33,7 +33,9 @@
 
 #include "lib/platform/threads/threads.h"
 #include "lib/platform/util/buffer.h"
+#include "lib/platform/util/timeutils.h"
 #include <map>
+#include "USBCECAdapterMessage.h"
 
 namespace CEC
 {
@@ -117,6 +119,11 @@ namespace CEC
 
     bool ProvidesExtendedResponse(void);
 
+    /*!
+     * @return True when a fire and forget packet timed out or succeeded, false otherwise
+     */
+    bool TimedOutOrSucceeded(void) const;
+
     CCECAdapterMessageQueue *  m_queue;
     CCECAdapterMessage *       m_message;      /**< the message that was sent */
     uint8_t                    m_iPacketsLeft; /**< the amount of acks that we're waiting on */
@@ -124,6 +131,7 @@ namespace CEC
     bool                       m_bWaiting;     /**< true while a thread is waiting or when it hasn't started waiting yet */
     PLATFORM::CCondition<bool> m_condition;    /**< the condition to wait on */
     PLATFORM::CMutex           m_mutex;        /**< mutex for changes to this class */
+    PLATFORM::CTimeout         m_queueTimeout;   /**< ack timeout for fire and forget commands */
   };
 
   class CCECAdapterMessageQueue : public PLATFORM::CThread
@@ -169,6 +177,8 @@ namespace CEC
 
     virtual void *Process(void);
 
+    void CheckTimedOutMessages(void);
+
   private:
     CUSBCECAdapterCommunication *                          m_com;                    /**< the communication handler */
     PLATFORM::CMutex                                       m_mutex;                  /**< mutex for changes to this class */