From: Lars Op den Kamp Date: Thu, 24 Nov 2011 22:19:33 +0000 (+0100) Subject: cec: handle routing information and report physical address opcodes X-Git-Tag: upstream/2.2.0~1^2~44^2~112 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=907bd60fcc86277c286ec43f694a19798754d413;p=deb_libcec.git cec: handle routing information and report physical address opcodes --- diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 78d7d40..a23ba66 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -117,12 +117,18 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) case CEC_OPCODE_ROUTING_CHANGE: HandleRoutingChange(command); break; + case CEC_OPCODE_ROUTING_INFORMATION: + HandleRoutingInformation(command); + break; case CEC_OPCODE_STANDBY: HandleStandby(command); break; case CEC_OPCODE_ACTIVE_SOURCE: HandleActiveSource(command); break; + case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS: + HandleReportPhysicalAddress(command); + break; default: UnhandledCommand(command); if (command.destination == CECDEVICE_BROADCAST || m_busDevice->MyLogicalAddressContains(command.destination)) @@ -292,6 +298,19 @@ bool CCECCommandHandler::HandleMenuRequest(const cec_command &command) return false; } +bool CCECCommandHandler::HandleReportPhysicalAddress(const cec_command &command) +{ + if (command.parameters.size == 2) + { + uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); + + CCECBusDevice *device = GetDevice(command.initiator); + if (device) + device->SetPhysicalAddress(iNewAddress); + } + return true; +} + bool CCECCommandHandler::HandleReportPowerStatus(const cec_command &command) { if (command.parameters.size == 1) @@ -330,6 +349,18 @@ bool CCECCommandHandler::HandleRoutingChange(const cec_command &command) return true; } +bool CCECCommandHandler::HandleRoutingInformation(const cec_command &command) +{ + if (command.parameters.size == 2) + { + uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); + + CCECBusDevice *device = GetDevice(command.initiator); + if (device) + device->SetPhysicalAddress(iNewAddress); + } +} + bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command &command) { if (command.parameters.size == 3) diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index 9bf9898..c398427 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -72,9 +72,11 @@ namespace CEC virtual bool HandleGiveOSDName(const cec_command &command); virtual bool HandleGivePhysicalAddress(const cec_command &command); virtual bool HandleMenuRequest(const cec_command &command); + virtual bool HandleReportPhysicalAddress(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 HandleRoutingInformation(const cec_command &command); virtual bool HandleSetMenuLanguage(const cec_command &command); virtual bool HandleSetStreamPath(const cec_command &command); virtual bool HandleSetSystemAudioModeRequest(const cec_command &command);