From 1a6669b82c89ac3f62c4e96a5fcd01d59ae355f7 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Fri, 25 Nov 2011 13:20:54 +0100 Subject: [PATCH] cec: handle image view on and text view on --- src/lib/CECProcessor.cpp | 5 +++ src/lib/CECProcessor.h | 1 + src/lib/implementations/CECCommandHandler.cpp | 36 ++++++++++++++----- src/lib/implementations/CECCommandHandler.h | 4 ++- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index e43d298..27bf5bb 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -305,6 +305,11 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE m_busDevices[addr]->TransmitActiveSource(); } +bool CCECProcessor::SetActiveSource(cec_logical_address iAddress) +{ + return SetStreamPath(m_busDevices[iAddress]->GetPhysicalAddress()); +} + bool CCECProcessor::SetActiveView(void) { return SetActiveSource(m_types.IsEmpty() ? CEC_DEVICE_TYPE_RESERVED : m_types[0]); diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 58bba6b..e23561b 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -74,6 +74,7 @@ namespace CEC virtual bool SetActiveView(void); virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED); + virtual bool SetActiveSource(cec_logical_address iAddress); 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); diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index d1cfdf0..0a39333 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -138,6 +138,12 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) case CEC_OPCODE_SET_OSD_NAME: HandleSetOSDName(command); break; + case CEC_OPCODE_IMAGE_VIEW_ON: + HandleImageViewOn(command); + break; + case CEC_OPCODE_TEXT_VIEW_ON: + HandleTextViewOn(command); + break; default: UnhandledCommand(command); bHandled = false; @@ -283,6 +289,24 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command) return false; } +bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command) +{ + if (m_busDevice->MyLogicalAddressContains(command.destination)) + { + CCECBusDevice *device = GetDevice(command.destination); + if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) + return ((CCECAudioSystem *) device)->TransmitSystemAudioModeStatus(command.initiator); + } + + return false; +} + +bool CCECCommandHandler::HandleImageViewOn(const cec_command &command) +{ + m_busDevice->GetProcessor()->SetActiveSource(command.initiator); + return true; +} + bool CCECCommandHandler::HandleMenuRequest(const cec_command &command) { if (m_busDevice->MyLogicalAddressContains(command.destination)) @@ -475,16 +499,10 @@ bool CCECCommandHandler::HandleSystemAudioStatus(const cec_command &command) return false; } -bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command) +bool CCECCommandHandler::HandleTextViewOn(const cec_command &command) { - if (m_busDevice->MyLogicalAddressContains(command.destination)) - { - CCECBusDevice *device = GetDevice(command.destination); - if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) - return ((CCECAudioSystem *) device)->TransmitSystemAudioModeStatus(command.initiator); - } - - return false; + m_busDevice->GetProcessor()->SetActiveSource(command.initiator); + return true; } bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command) diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index 7dea0c0..9d3ec03 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -71,6 +71,8 @@ namespace CEC virtual bool HandleGiveDeviceVendorId(const cec_command &command); virtual bool HandleGiveOSDName(const cec_command &command); virtual bool HandleGivePhysicalAddress(const cec_command &command); + virtual bool HandleGiveSystemAudioModeStatus(const cec_command &command); + virtual bool HandleImageViewOn(const cec_command &command); virtual bool HandleMenuRequest(const cec_command &command); virtual bool HandleReportAudioStatus(const cec_command &command); virtual bool HandleReportPhysicalAddress(const cec_command &command); @@ -84,7 +86,7 @@ namespace CEC virtual bool HandleSetSystemAudioModeRequest(const cec_command &command); virtual bool HandleStandby(const cec_command &command); virtual bool HandleSystemAudioStatus(const cec_command &command); - virtual bool HandleGiveSystemAudioModeStatus(const cec_command &command); + virtual bool HandleTextViewOn(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); -- 2.34.1