- bool WaitForAck(CCECAdapterMessage &message);
-
- PLATFORM::ISocket * m_port;
- CCECProcessor * m_processor;
- PLATFORM::SyncedBuffer<CCECAdapterMessage *> m_inBuffer;
- PLATFORM::SyncedBuffer<CCECAdapterMessage *> m_outBuffer;
- PLATFORM::CMutex m_mutex;
- PLATFORM::CCondition<volatile bool &> m_rcvCondition;
- volatile bool m_bHasData;
- uint8_t m_iLineTimeout;
- uint16_t m_iFirmwareVersion;
- cec_command m_currentframe;
- cec_logical_address m_lastInitiator;
- CCECAdapterMessage m_currentAdapterMessage;
- bool m_bNextIsEscaped;
- bool m_bGotStart;
- IAdapterCommunicationCallback * m_callback;
- CUSBCECAdapterProcessor * m_messageProcessor;
+
+ /*!
+ * @brief Writes a message to the serial port.
+ * @param message The message to write.
+ * @return True when written, false otherwise.
+ */
+ bool WriteToDevice(CCECAdapterMessage *message);
+
+ /*!
+ * @brief Called before sending a CEC command over the line, so we know we're expecting an ack.
+ * @param dest The destination of the CEC command.
+ */
+ void MarkAsWaiting(const cec_logical_address dest);
+
+ PLATFORM::ISocket * m_port; /**< the com port connection */
+ PLATFORM::CMutex m_mutex; /**< mutex for changes in this class */
+ uint8_t m_iLineTimeout; /**< the current line timeout on the CEC line */
+ cec_logical_address m_lastPollDestination; /**< the destination of the last poll message that was received */
+ bool m_bInitialised; /**< true when the connection is initialised, false otherwise */
+ bool m_bWaitingForAck[15]; /**< array in which we store from which devices we're expecting acks */
+ CAdapterPingThread * m_pingThread; /**< ping thread, that pings the adapter every 15 seconds */
+ CUSBCECAdapterCommands * m_commands; /**< commands that can be sent to the adapter */
+ CCECAdapterMessageQueue * m_adapterMessageQueue; /**< the incoming and outgoing message queue */
+ };
+
+ class CAdapterPingThread : public PLATFORM::CThread
+ {
+ public:
+ CAdapterPingThread(CUSBCECAdapterCommunication *com, uint32_t iTimeout) :
+ m_com(com),
+ m_timeout(iTimeout){}
+ virtual ~CAdapterPingThread(void) {}
+
+ virtual void* Process(void);
+ private:
+ CUSBCECAdapterCommunication *m_com;
+ PLATFORM::CTimeout m_timeout;