From: Lars Op den Kamp Date: Sun, 6 Nov 2011 13:49:59 +0000 (+0100) Subject: cec: handle GiveAudioStatus. currently send a feature abort X-Git-Tag: upstream/2.2.0~1^2~99 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a1f8fb1b065d260eb9d6eaf7e053f7415b453613;p=deb_libcec.git cec: handle GiveAudioStatus. currently send a feature abort --- diff --git a/src/lib/devices/CECAudioSystem.cpp b/src/lib/devices/CECAudioSystem.cpp index d0ab39e..3ed22e9 100644 --- a/src/lib/devices/CECAudioSystem.cpp +++ b/src/lib/devices/CECAudioSystem.cpp @@ -31,6 +31,7 @@ */ #include "CECAudioSystem.h" +#include "../CECProcessor.h" using namespace CEC; @@ -40,3 +41,14 @@ CCECAudioSystem::CCECAudioSystem(CCECProcessor *processor, cec_logical_address a m_type = CEC_DEVICE_TYPE_AUDIO_SYSTEM; m_strDeviceName = "Audio"; } + +bool CCECAudioSystem::TransmitAudioStatus(cec_logical_address dest) +{ + // TODO + CStdString strLog; + strLog.Format("<< %x -> %x: audio status feature abort", m_iLogicalAddress, dest); + AddLog(CEC_LOG_NOTICE, strLog); + + m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_AUDIO_STATUS); + return false; +} diff --git a/src/lib/devices/CECAudioSystem.h b/src/lib/devices/CECAudioSystem.h index 51c1676..5690eda 100644 --- a/src/lib/devices/CECAudioSystem.h +++ b/src/lib/devices/CECAudioSystem.h @@ -40,5 +40,7 @@ namespace CEC public: CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0); virtual ~CCECAudioSystem(void) {}; + + virtual bool TransmitAudioStatus(cec_logical_address dest); }; } diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 665d7fd..7c2f6bf 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -403,7 +403,7 @@ bool CCECBusDevice::TransmitDeckStatus(cec_logical_address dest) strLog.Format("<< %x -> %x: deck status feature abort", m_iLogicalAddress, dest); AddLog(CEC_LOG_NOTICE, strLog); - m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); + m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DECK_STATUS); return false; } diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 83f2955..509e57c 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -63,7 +63,8 @@ namespace CEC virtual uint16_t GetMyPhysicalAddress(void) const; virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; } virtual cec_power_status GetPowerStatus(void); - virtual CCECProcessor * GetProcessor() const { return m_processor; } + virtual CCECProcessor * GetProcessor(void) const { return m_processor; } + virtual cec_device_type GetType(void) const { return m_type; } virtual const cec_vendor & GetVendor(void); virtual uint8_t GetVendorClass(void) const { return m_iVendorClass; } virtual cec_vendor_id GetVendorId(void) { return GetVendor().vendor; }; diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 2324c20..9434867 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -32,6 +32,7 @@ #include "CECCommandHandler.h" #include "../devices/CECBusDevice.h" +#include "../devices/CECAudioSystem.h" #include "../CECProcessor.h" using namespace CEC; @@ -92,6 +93,9 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) case CEC_OPCODE_USER_CONTROL_RELEASE: HandleUserControlRelease(command); break; + case CEC_OPCODE_GIVE_AUDIO_STATUS: + HandleGiveAudioStatus(command); + break; default: UnhandledCommand(command); m_busDevice->GetProcessor()->AddCommand(command); @@ -182,6 +186,15 @@ bool CCECCommandHandler::HandleGetCecVersion(const cec_command &command) return false; } +bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command &command) +{ + CCECBusDevice *device = GetDevice(command.destination); + if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) + return ((CCECAudioSystem *) device)->TransmitAudioStatus(command.initiator); + + return false; +} + bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command &command) { CCECBusDevice *device = GetDevice(command.destination); diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index d6acd75..6be4b70 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -47,28 +47,27 @@ namespace CEC virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; }; protected: - bool HandleDeviceCecVersion(const cec_command &command); - bool HandleDeviceVendorCommandWithId(const cec_command &command); - bool HandleDeviceVendorId(const cec_command &command); - bool HandleGetCecVersion(const cec_command &command); - bool HandleGiveDeckStatus(const cec_command &command); - bool HandleGiveDevicePowerStatus(const cec_command &command); - bool HandleGiveDeviceVendorId(const cec_command &command); - bool HandleGiveOSDName(const cec_command &command); - bool HandleGivePhysicalAddress(const cec_command &command); - bool HandleMenuRequest(const cec_command &command); - bool HandleReportPowerStatus(const cec_command &command); - bool HandleRequestActiveSource(const cec_command &command); - bool HandleRoutingChange(const cec_command &command); - bool HandleSetMenuLanguage(const cec_command &command); - bool HandleSetStreamPath(const cec_command &command); - bool HandleUserControlPressed(const cec_command &command); - bool HandleUserControlRelease(const cec_command &command); - void UnhandledCommand(const cec_command &command); + virtual bool HandleDeviceCecVersion(const cec_command &command); + virtual bool HandleDeviceVendorCommandWithId(const cec_command &command); + virtual bool HandleDeviceVendorId(const cec_command &command); + virtual bool HandleGetCecVersion(const cec_command &command); + virtual bool HandleGiveAudioStatus(const cec_command &command); + virtual bool HandleGiveDeckStatus(const cec_command &command); + virtual bool HandleGiveDevicePowerStatus(const cec_command &command); + virtual bool HandleGiveDeviceVendorId(const cec_command &command); + virtual bool HandleGiveOSDName(const cec_command &command); + virtual bool HandleGivePhysicalAddress(const cec_command &command); + virtual bool HandleMenuRequest(const cec_command &command); + virtual bool HandleReportPowerStatus(const cec_command &command); + virtual bool HandleRequestActiveSource(const cec_command &command); + virtual bool HandleRoutingChange(const cec_command &command); + virtual bool HandleSetMenuLanguage(const cec_command &command); + virtual bool HandleSetStreamPath(const cec_command &command); + virtual bool HandleUserControlPressed(const cec_command &command); + virtual bool HandleUserControlRelease(const cec_command &command); + virtual void UnhandledCommand(const cec_command &command); - void SendToCommandBuffer(const cec_command &command); - - CCECBusDevice *GetDevice(cec_logical_address iLogicalAddress) const; + virtual CCECBusDevice *GetDevice(cec_logical_address iLogicalAddress) const; CCECBusDevice *m_busDevice; }; };