+ CLockObject lock(&m_mutex);
+ if (m_powerStatus != powerStatus)
+ {
+ CStdString strLog;
+ strLog.Format(">> %s (%X): power status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_powerStatus), ToString(powerStatus));
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog);
+ m_powerStatus = powerStatus;
+ }
+}
+
+void CCECBusDevice::SetVendorId(uint64_t iVendorId)
+{
+ {
+ CLockObject lock(&m_mutex);
+ m_vendor = (cec_vendor_id)iVendorId;
+
+ switch (iVendorId)
+ {
+ case CEC_VENDOR_SAMSUNG:
+ if (m_handler->GetVendorId() != CEC_VENDOR_SAMSUNG)
+ {
+ delete m_handler;
+ m_handler = new CANCommandHandler(this);
+ }
+ break;
+ case CEC_VENDOR_LG:
+ if (m_handler->GetVendorId() != CEC_VENDOR_LG)
+ {
+ delete m_handler;
+ m_handler = new CSLCommandHandler(this);
+ }
+ break;
+ case CEC_VENDOR_PANASONIC:
+ if (m_handler->GetVendorId() != CEC_VENDOR_PANASONIC)
+ {
+ delete m_handler;
+ m_handler = new CVLCommandHandler(this);
+ }
+ break;
+ default:
+ if (m_handler->GetVendorId() != CEC_VENDOR_UNKNOWN)
+ {
+ delete m_handler;
+ m_handler = new CCECCommandHandler(this);
+ }
+ break;
+ }
+ }
+
+ CStdString strLog;
+ strLog.Format("%s (%X): vendor = %s (%06x)", GetLogicalAddressName(), m_iLogicalAddress, GetVendorName(), m_vendor);
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog.c_str());
+}
+//@}
+
+/** @name Transmit methods */
+//@{
+bool CCECBusDevice::TransmitActiveSource(void)
+{
+ CLockObject lock(&m_mutex);
+ if (m_powerStatus != CEC_POWER_STATUS_ON)
+ {
+ CStdString strLog;
+ strLog.Format("<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress);
+ AddLog(CEC_LOG_DEBUG, strLog);
+ }
+ else if (m_bActiveSource)
+ {
+ CStdString strLog;
+ strLog.Format("<< %s (%X) -> broadcast (F): active source (%4x)", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
+
+ cec_command command;
+ cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
+ command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
+ command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF));
+
+ lock.Leave();
+ return m_processor->Transmit(command);
+ }