if (m_processor->IsInitialised())
HandleGivePhysicalAddress(command);
break;
+ case CEC_OPCODE_GET_MENU_LANGUAGE:
+ if (m_processor->IsInitialised())
+ HandleGiveMenuLanguage(command);
+ break;
case CEC_OPCODE_GIVE_OSD_NAME:
if (m_processor->IsInitialised())
HandleGiveOSDName(command);
return false;
}
+bool CCECCommandHandler::HandleGiveMenuLanguage(const cec_command &command)
+{
+ if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination))
+ {
+ CCECBusDevice *device = GetDevice(command.destination);
+ if (device)
+ return device->TransmitSetMenuLanguage(command.initiator);
+ }
+
+ return false;
+}
+
bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command)
{
if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination))
bool CCECCommandHandler::HandlePoll(const cec_command &command)
{
- m_busDevice->HandlePoll(command.initiator);
+ m_busDevice->HandlePoll(command.destination);
return true;
}
return Transmit(command, false);
}
-bool CCECCommandHandler::TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_CEC_VERSION);
- return Transmit(command, true, CEC_OPCODE_CEC_VERSION);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_CEC_VERSION);
}
-bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_MENU_LANGUAGE);
- return Transmit(command, true, CEC_OPCODE_SET_MENU_LANGUAGE);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_SET_MENU_LANGUAGE);
}
-bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_OSD_NAME);
- return Transmit(command, true, CEC_OPCODE_SET_OSD_NAME);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_SET_OSD_NAME);
}
-bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_PHYSICAL_ADDRESS);
- return Transmit(command, true, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
}
-bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
- return Transmit(command, true, CEC_OPCODE_REPORT_POWER_STATUS);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_REPORT_POWER_STATUS);
}
-bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
- return Transmit(command, true, CEC_OPCODE_DEVICE_VENDOR_ID);
+ return Transmit(command, bWaitForResponse, CEC_OPCODE_DEVICE_VENDOR_ID);
}
bool CCECCommandHandler::TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
return Transmit(command, false);
}
+bool CCECCommandHandler::TransmitSetMenuLanguage(const cec_logical_address iInitiator, const char lang[3])
+{
+ cec_command command;
+ command.Format(command, iInitiator, CECDEVICE_BROADCAST, CEC_OPCODE_SET_MENU_LANGUAGE);
+ command.parameters.PushBack((uint8_t) lang[0]);
+ command.parameters.PushBack((uint8_t) lang[1]);
+ command.parameters.PushBack((uint8_t) lang[2]);
+
+ return Transmit(command, false);
+}
+
bool CCECCommandHandler::TransmitPoll(const cec_logical_address iInitiator, const cec_logical_address iDestination)
{
cec_command command;
bool bReturn(false);
command.transmit_timeout = m_iTransmitTimeout;
+ if (command.initiator == CECDEVICE_UNKNOWN)
+ {
+ CLibCEC::AddLog(CEC_LOG_ERROR, "not transmitting a command without a valid initiator");
+ return bReturn;
+ }
+
{
uint8_t iTries(0), iMaxTries(command.opcode == CEC_OPCODE_NONE ? 1 : m_iTransmitRetries + 1);
while (!bReturn && ++iTries <= iMaxTries)