+ CStdString strLog;
+ strLog.Format("<< putting device with logical address %d in standby mode", (int8_t)m_iLogicalAddress);
+ AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_STANDBY);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::SetOSDString(cec_display_control duration, const char *strMessage)
+{
+ CStdString strLog;
+ strLog.Format("<< display message '%s'", strMessage);
+ AddLog(CEC_LOG_NOTICE, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_SET_OSD_STRING);
+ command.parameters.push_back((uint8_t)duration);
+
+ for (unsigned int iPtr = 0; iPtr < strlen(strMessage); iPtr++)
+ command.parameters.push_back(strMessage[iPtr]);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::ReportCECVersion(void)
+{
+ AddLog(CEC_LOG_NOTICE, "<< reporting CEC version as 1.3a");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_CEC_VERSION);
+ command.parameters.push_back(CEC_VERSION_1_3A);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::ReportDeckStatus(void)
+{
+ // need to support opcodes play and deck control before doing anything with this
+ AddLog(CEC_LOG_NOTICE, "<< deck status requested, feature abort");
+ m_processor->TransmitAbort(m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
+ return false;
+}
+
+bool CCECBusDevice::ReportMenuState(bool bActive /* = true */)
+{
+ if (bActive)
+ AddLog(CEC_LOG_NOTICE, "<< reporting menu state as active");
+ else
+ AddLog(CEC_LOG_NOTICE, "<< reporting menu state as inactive");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_MENU_STATUS);
+ command.parameters.push_back(bActive ? (uint8_t) CEC_MENU_STATE_ACTIVATED : (uint8_t) CEC_MENU_STATE_DEACTIVATED);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::ReportOSDName(void)
+{
+ const char *osdname = m_processor->GetDeviceName().c_str();
+ CStdString strLog;
+ strLog.Format("<< reporting OSD name as %s", osdname);
+ AddLog(CEC_LOG_NOTICE, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_SET_OSD_NAME);
+ for (unsigned int iPtr = 0; iPtr < strlen(osdname); iPtr++)
+ command.parameters.push_back(osdname[iPtr]);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::ReportPowerState(bool bOn /* = true */)
+{
+ if (bOn)
+ AddLog(CEC_LOG_NOTICE, "<< reporting \"On\" power status");
+ else
+ AddLog(CEC_LOG_NOTICE, "<< reporting \"Off\" power status");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_REPORT_POWER_STATUS);
+ command.parameters.push_back(bOn ? (uint8_t) CEC_POWER_STATUS_ON : (uint8_t) CEC_POWER_STATUS_STANDBY);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::ReportVendorID(void)
+{
+ AddLog(CEC_LOG_NOTICE, "<< vendor ID requested, feature abort");
+ m_processor->TransmitAbort(m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
+ return false;
+}
+
+bool CCECBusDevice::BroadcastActiveView(void)
+{
+ AddLog(CEC_LOG_DEBUG, "<< setting active view");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
+ command.parameters.push_back((m_iPhysicalAddress >> 8) & 0xFF);
+ command.parameters.push_back(m_iPhysicalAddress & 0xFF);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::BroadcastInactiveView(void)
+{
+ AddLog(CEC_LOG_DEBUG, "<< setting inactive view");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE);
+ command.parameters.push_back((m_iPhysicalAddress >> 8) & 0xFF);
+ command.parameters.push_back(m_iPhysicalAddress & 0xFF);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::BroadcastPhysicalAddress(void)
+{
+ CStdString strLog;
+ strLog.Format("<< reporting physical address as %04x", m_iPhysicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
+ command.parameters.push_back((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
+ command.parameters.push_back((uint8_t) (m_iPhysicalAddress & 0xFF));
+ command.parameters.push_back((uint8_t) (CEC_DEVICE_TYPE_PLAYBACK_DEVICE));
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::BroadcastActiveSource(void)
+{
+ AddLog(CEC_LOG_NOTICE, "<< broadcasting active source");
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
+ command.parameters.push_back((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
+ command.parameters.push_back((uint8_t) (m_iPhysicalAddress & 0xFF));
+
+ return m_processor->Transmit(command);
+}
+
+cec_version CCECBusDevice::GetCecVersion(bool bRefresh /* = true */)
+{
+ if (bRefresh || m_cecVersion == CEC_VERSION_UNKNOWN)