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;
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))
if (command.parameters.size == 3)
{
uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
- cec_device_type type = (cec_device_type)command.parameters[2];
-
- CCECBusDevice *device = GetDevice(command.initiator);
- if (device && device->GetType() == type)
- device->SetPhysicalAddress(iNewAddress);
+ SetPhysicalAddress(command.initiator, iNewAddress);
}
return true;
}
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;
- }
+ m_busDevice->GetProcessor()->SetStreamPath(iNewAddress);
}
return false;
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)
device->SetVendorId(iVendorId);
}
+void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress, uint16_t iNewAddress)
+{
+ if (!m_busDevice->MyLogicalAddressContains(iAddress))
+ {
+ bool bOurAddress(m_busDevice->GetProcessor()->GetPhysicalAddress() == iNewAddress);
+ GetDevice(iAddress)->SetPhysicalAddress(iNewAddress);
+ if (bOurAddress)
+ {
+ /* another device reported the same physical address as ours
+ * since we don't have physical address detection yet, we'll just use the
+ * given address, increased by 0x100 for now */
+ m_busDevice->GetProcessor()->SetPhysicalAddress(iNewAddress + 0x100);
+ }
+ }
+}
+
const char *CCECCommandHandler::ToString(const cec_menu_state state)
{
switch (state)