+ cec_command command;
+ cec_command::Format(command, iInitiator, CECDEVICE_TV, CEC_OPCODE_INACTIVE_SOURCE);
+ command.parameters.PushBack((iPhysicalAddress >> 8) & 0xFF);
+ command.parameters.PushBack(iPhysicalAddress & 0xFF);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitMenuState(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_menu_state menuState)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_MENU_STATUS);
+ command.parameters.PushBack((uint8_t)menuState);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, CStdString strDeviceName)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SET_OSD_NAME);
+ for (size_t iPtr = 0; iPtr < strDeviceName.length(); iPtr++)
+ command.parameters.PushBack(strDeviceName.at(iPtr));
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitOSDString(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_display_control duration, const char *strMessage)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SET_OSD_STRING);
+ command.parameters.PushBack((uint8_t)duration);
+
+ size_t iLen = strlen(strMessage);
+ if (iLen > 13) iLen = 13;
+
+ for (size_t iPtr = 0; iPtr < iLen; iPtr++)
+ command.parameters.PushBack(strMessage[iPtr]);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitPhysicalAddress(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, cec_device_type type)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
+ command.parameters.PushBack((uint8_t) ((iPhysicalAddress >> 8) & 0xFF));
+ command.parameters.PushBack((uint8_t) (iPhysicalAddress & 0xFF));
+ command.parameters.PushBack((uint8_t) (type));
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitPoll(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_NONE);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitPowerState(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_power_status state)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_REPORT_POWER_STATUS);
+ command.parameters.PushBack((uint8_t) state);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitVendorID(const cec_logical_address iInitiator, uint64_t iVendorId)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, CECDEVICE_BROADCAST, CEC_OPCODE_DEVICE_VENDOR_ID);
+
+ command.parameters.PushBack((uint8_t) (((uint64_t)iVendorId >> 16) & 0xFF));
+ command.parameters.PushBack((uint8_t) (((uint64_t)iVendorId >> 8) & 0xFF));
+ command.parameters.PushBack((uint8_t) ((uint64_t)iVendorId & 0xFF));
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint8_t state)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_REPORT_AUDIO_STATUS);
+ command.parameters.PushBack(state);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SET_SYSTEM_AUDIO_MODE);
+ command.parameters.PushBack((uint8_t)state);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitSetStreamPath(uint16_t iStreamPath)
+{
+ cec_command command;
+ cec_command::Format(command, m_busDevice->GetLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_SET_STREAM_PATH);
+ command.parameters.PushBack((uint8_t) ((iStreamPath >> 8) & 0xFF));
+ command.parameters.PushBack((uint8_t) (iStreamPath & 0xFF));
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS);
+ command.parameters.PushBack((uint8_t)state);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_DECK_STATUS);
+ command.PushBack((uint8_t)state);
+
+ return Transmit(command, false);
+}
+
+bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_PRESSED);
+ command.parameters.PushBack((uint8_t)key);
+
+ return Transmit(command, bWait);
+}
+
+bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait /* = true */)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_RELEASE);
+
+ return Transmit(command, bWait);
+}
+
+bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */, cec_opcode expectedResponse /* = CEC_OPCODE_NONE */)
+{
+ bool bReturn(false);
+ MarkBusy();
+ command.transmit_timeout = m_iTransmitTimeout;
+