X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECParser.h;h=7b369df474588493b4d94f6b4a2061cb0d1977dc;hb=5f39c4d854ec7441761bc6db870b6bbc73016309;hp=f257fe1c02b967fd8add0760a49dbf812bb5cae8;hpb=6dfe921375b746dab058c1f1c3a8263fbd409d3d;p=deb_libcec.git diff --git a/src/lib/CECParser.h b/src/lib/CECParser.h index f257fe1..7b369df 100644 --- a/src/lib/CECParser.h +++ b/src/lib/CECParser.h @@ -41,6 +41,8 @@ class CSerialPort; namespace CEC { + class CCommunication; + class CCECParser : public ICECDevice { public: @@ -52,17 +54,19 @@ namespace CEC virtual ~CCECParser(void); virtual bool Open(const char *strPort, int iTimeout = 10000); + virtual void Close(void); virtual int FindDevices(std::vector &deviceList, const char *strDevicePath = NULL); virtual bool Ping(void); virtual bool StartBootloader(void); virtual bool PowerOffDevices(cec_logical_address address = CECDEVICE_BROADCAST); - virtual bool PowerOnDevices(cec_logical_address address = CECDEVICE_BROADCAST); + virtual bool PowerOnDevices(cec_logical_address address = CECDEVICE_TV); virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST); virtual bool SetActiveView(void); virtual bool SetInactiveView(void); virtual bool GetNextLogMessage(cec_log_message *message); virtual bool GetNextKeypress(cec_keypress *key); - virtual bool Transmit(const cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 5000); + virtual bool GetNextCommand(cec_command *command); + virtual bool Transmit(const cec_frame &data, bool bWaitForAck = true); virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress); virtual bool SetAckMask(uint16_t iMask); virtual int GetMinVersion(void); @@ -71,9 +75,10 @@ namespace CEC static void *ThreadHandler(CCECParser *parser); bool Process(void); + void AddLog(cec_log_level level, const std::string &strMessage); protected: - virtual bool TransmitFormatted(const cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 2000); - virtual void TransmitAbort(cec_logical_address address, ECecOpcode opcode, ECecAbortReason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE); + virtual bool TransmitFormatted(const cec_frame &data, bool bWaitForAck = true); + virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, ECecAbortReason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE); virtual void ReportCECVersion(cec_logical_address address = CECDEVICE_TV); virtual void ReportPowerState(cec_logical_address address = CECDEVICE_TV, bool bOn = true); virtual void ReportMenuState(cec_logical_address address = CECDEVICE_TV, bool bActive = true); @@ -85,8 +90,8 @@ namespace CEC private: void AddKey(void); - void AddLog(cec_log_level level, const std::string &strMessage); - bool WaitForAck(int64_t iTimeout = (int64_t) 1000); + void AddCommand(cec_logical_address source, cec_logical_address destination, cec_opcode opcode, cec_frame *parameters); + bool WaitForAck(int iTimeout = 1000); bool ReadFromDevice(int iTimeout); void ProcessMessages(void); bool GetMessage(cec_frame &msg, bool bFromBuffer = true); @@ -98,10 +103,6 @@ namespace CEC void CheckKeypressTimeout(int64_t now); - uint8_t* m_inbuf; - int m_iInbufSize; - int m_iInbufUsed; - CSerialPort * m_serialport; cec_frame m_currentframe; cec_user_control_code m_iCurrentButton; int64_t m_buttontime; @@ -110,9 +111,12 @@ namespace CEC CecBuffer m_frameBuffer; CecBuffer m_logBuffer; CecBuffer m_keyBuffer; + CecBuffer m_commandBuffer; std::string m_strDeviceName; pthread_t m_thread; CMutex m_mutex; + CCondition m_exitCondition; bool m_bRunning; + CCommunication *m_communication; }; };