X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.h;h=303750180c7dcb1fa924794ac09f836ec51f2d37;hb=fdd91966a0d9d32b3e68cd91b6612840b80b227d;hp=24d1e31e0778e489688eb0c90642d2768fead7da;hpb=0f23c85cf92ff0ff061b5c965f771d9a4b3afe56;p=deb_libcec.git diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 24d1e31..3037501 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -33,6 +33,7 @@ #include #include +#include "AdapterCommunication.h" #include "platform/threads.h" #include "util/buffer.h" #include "util/StdString.h" @@ -49,45 +50,74 @@ namespace CEC { public: CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); + CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, const cec_device_type_list &types); virtual ~CCECProcessor(void); virtual bool Start(void); - void *Process(void); + virtual void *Process(void); + + virtual bool IsMonitoring(void) const { return m_bMonitor; } + virtual CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress) const; + virtual CCECBusDevice * GetDeviceByType(cec_device_type type) const; + virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress); + virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language); + virtual const std::string & GetDeviceName(void) { return m_strDeviceName; } + virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress); + virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress); + virtual cec_logical_address GetLogicalAddress(void) const { return m_logicalAddresses.primary; } + virtual cec_logical_addresses GetLogicalAddresses(void) const { return m_logicalAddresses; } + virtual bool HasLogicalAddress(cec_logical_address address) const { return m_logicalAddresses.IsSet(address); } + virtual uint16_t GetPhysicalAddress(void) const; virtual bool SetActiveView(void); + virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED); + virtual bool SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate = true); + virtual bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true); virtual bool SetInactiveView(void); - virtual bool Transmit(const cec_command &data, bool bWaitForAck = true); virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress); + virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true); virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress); + virtual bool SetStreamPath(uint16_t iStreamPath); virtual bool SwitchMonitoring(bool bEnable); + virtual bool PollDevice(cec_logical_address iAddress); - virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; } - virtual uint16_t GetPhysicalAddress(void) const; - virtual const std::string &GetDeviceName(void) { return m_strDeviceName; } + virtual bool Transmit(const cec_command &data); + virtual bool Transmit(CCECAdapterMessage *output); + virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE); virtual void SetCurrentButton(cec_user_control_code iButtonCode); virtual void AddCommand(const cec_command &command); + virtual void AddKey(cec_keypress &key); virtual void AddKey(void); virtual void AddLog(cec_log_level level, const CStdString &strMessage); - virtual bool TransmitFormatted(const cec_adapter_message &data, bool bWaitForAck = true); - virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, ECecAbortReason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE); + virtual bool FindLogicalAddresses(void); CCECBusDevice *m_busDevices[16]; - private: + private: + bool TryLogicalAddress(cec_logical_address address, unsigned int iIndex); + bool FindLogicalAddressRecordingDevice(unsigned int iIndex); + bool FindLogicalAddressTuner(unsigned int iIndex); + bool FindLogicalAddressPlaybackDevice(unsigned int iIndex); + bool FindLogicalAddressAudioSystem(unsigned int iIndex); + + bool SetAckMask(uint16_t iMask); void LogOutput(const cec_command &data); - bool WaitForAck(bool *bError, uint32_t iTimeout = 1000); - void ParseMessage(cec_adapter_message &msg, bool *bError, bool *bTransmitSucceeded, bool *bEom, bool bProcessMessages = true); + bool WaitForTransmitSucceeded(uint8_t iLength, uint32_t iTimeout = 1000); + bool ParseMessage(const CCECAdapterMessage &msg); void ParseCommand(cec_command &command); - cec_command m_currentframe; - cec_logical_address m_iLogicalAddress; - CecBuffer m_frameBuffer; - std::string m_strDeviceName; - CMutex m_mutex; - CAdapterCommunication *m_communication; - CLibCEC *m_controller; - bool m_bMonitor; + bool m_bStarted; + cec_command m_currentframe; + cec_logical_addresses m_logicalAddresses; + std::string m_strDeviceName; + cec_device_type_list m_types; + CMutex m_mutex; + CCondition m_startCondition; + CAdapterCommunication* m_communication; + CLibCEC* m_controller; + bool m_bMonitor; + CecBuffer m_commandBuffer; }; };