m_bMonitor(false)
{
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
- m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, 0);
-
- m_busDevices[m_iLogicalAddress]->SetPhysicalAddress(iPhysicalAddress);
+ m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0);
}
CCECProcessor::~CCECProcessor(void)
bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
{
- return m_busDevice->BroadcastPhysicalAddress();
+ CCECBusDevice *device = GetThisDevice();
+ if (device)
+ return device->BroadcastPhysicalAddress();
+
+ return false;
}
bool CCECCommandHandler::HandleMenuRequest(const cec_command &command)
CStdString strLog;
strLog.Format(">> %i requests active source", (uint8_t) command.initiator);
m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- m_busDevice->BroadcastActiveSource();
- return true;
+ CCECBusDevice *device = GetThisDevice();
+ if (device)
+ return device->BroadcastActiveSource();
+ return false;
}
bool CCECCommandHandler::HandleRoutingChange(const cec_command &command)
strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr);
m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
if (streamaddr == m_busDevice->GetMyPhysicalAddress())
- m_busDevice->BroadcastActiveSource();
+ {
+ CCECBusDevice *device = GetThisDevice();
+ if (device)
+ return device->BroadcastActiveSource();
+ return false;
+ }
}
return true;
}
return device;
}
+
+CCECBusDevice *CCECCommandHandler::GetThisDevice(void) const
+{
+ return m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetMyLogicalAddress()];
+}