X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FPulse-Eight%2FUSBCECAdapterCommunication.h;h=1144d0e1be2c46fdbe63c7594971839bcdf1d4d3;hb=34a9cecdd92f6b2844f9c4054da202b152ab2217;hp=a14b3a5d85b7f463b1459ae85a09a1b8a64985c6;hpb=2b44051cbfa70deafc30d9767323214debbc1a75;p=deb_libcec.git diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h index a14b3a5..1144d0e 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h @@ -43,6 +43,7 @@ namespace CEC { class CCECProcessor; class CAdapterPingThread; + class CAdapterEepromWriteThread; class CUSBCECAdapterCommands; class CCECAdapterMessageQueue; class CCECAdapterMessage; @@ -51,6 +52,7 @@ namespace CEC { friend class CUSBCECAdapterCommands; friend class CCECAdapterMessageQueue; + friend class CAdapterEepromWriteThread; public: /*! @@ -86,6 +88,8 @@ namespace CEC bool SupportsSourceLogicalAddress(const cec_logical_address UNUSED(address)) { return true; } ///} + bool ProvidesExtendedResponse(void); + void *Process(void); private: @@ -169,11 +173,32 @@ namespace CEC 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 */ + CAdapterEepromWriteThread * m_eepromWriteThread; /**< eeprom writes are done async */ CUSBCECAdapterCommands * m_commands; /**< commands that can be sent to the adapter */ CCECAdapterMessageQueue * m_adapterMessageQueue; /**< the incoming and outgoing message queue */ cec_logical_addresses m_logicalAddresses; /**< the logical address list that this instance is using */ - uint64_t m_iLastEepromWrite; /**< last time that this instance did an eeprom write */ - bool m_iScheduleEepromWrite; /**< in case there were more than 2 changes within 30 seconds, do another write at this time */ + }; + + class CAdapterEepromWriteThread : public PLATFORM::CThread + { + public: + CAdapterEepromWriteThread(CUSBCECAdapterCommunication *com) : + m_com(com), + m_bWrite(false), + m_iLastEepromWrite(0), + m_iScheduleEepromWrite(0) {} + virtual ~CAdapterEepromWriteThread(void) {} + + bool Write(void); + void* Process(void); + void Stop(void); + private: + CUSBCECAdapterCommunication *m_com; + bool m_bWrite; + PLATFORM::CCondition m_condition; + PLATFORM::CMutex m_mutex; + int64_t m_iLastEepromWrite; /**< last time that this instance did an eeprom write */ + int64_t m_iScheduleEepromWrite; /**< in case there were more than 2 changes within 30 seconds, do another write at this time */ }; class CAdapterPingThread : public PLATFORM::CThread @@ -184,7 +209,7 @@ namespace CEC m_timeout(iTimeout){} virtual ~CAdapterPingThread(void) {} - virtual void* Process(void); + void* Process(void); private: CUSBCECAdapterCommunication *m_com; PLATFORM::CTimeout m_timeout;