+ config->iFirmwareVersion = m_communication->GetFirmwareVersion();
+ config->iPhysicalAddress = m_communication->GetPhysicalAddress();
+ config->iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
+ config->adapterType = m_communication->GetAdapterType();
+
+ return true;
+}
+
+bool CCECProcessor::TransmitPendingActiveSourceCommands(void)
+{
+ bool bReturn(true);
+ for (CECDEVICEMAP::iterator it = m_busDevices->Begin(); it != m_busDevices->End(); it++)
+ bReturn &= it->second->TransmitPendingActiveSourceCommands();
+ return bReturn;
+}
+
+CCECTV *CCECProcessor::GetTV(void) const
+{
+ return CCECBusDevice::AsTV(m_busDevices->At(CECDEVICE_TV));
+}
+
+CCECAudioSystem *CCECProcessor::GetAudioSystem(void) const
+{
+ return CCECBusDevice::AsAudioSystem(m_busDevices->At(CECDEVICE_AUDIOSYSTEM));
+}
+
+CCECPlaybackDevice *CCECProcessor::GetPlaybackDevice(cec_logical_address address) const
+{
+ return CCECBusDevice::AsPlaybackDevice(m_busDevices->At(address));
+}
+
+CCECRecordingDevice *CCECProcessor::GetRecordingDevice(cec_logical_address address) const
+{
+ return CCECBusDevice::AsRecordingDevice(m_busDevices->At(address));
+}
+
+CCECTuner *CCECProcessor::GetTuner(cec_logical_address address) const
+{
+ return CCECBusDevice::AsTuner(m_busDevices->At(address));
+}
+
+bool CCECProcessor::AllocateLogicalAddresses(CCECClient* client)
+{
+ libcec_configuration &configuration = *client->GetConfiguration();
+
+ // mark as unregistered
+ client->SetRegistered(false);
+
+ // unregister this client from the old addresses
+ CECDEVICEVEC devices;
+ m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
+ for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
+ {
+ // remove client entry
+ CLockObject lock(m_mutex);
+ m_clients.erase((*it)->GetLogicalAddress());
+ }
+
+ // find logical addresses for this client
+ if (!client->AllocateLogicalAddresses())
+ {
+ m_libcec->AddLog(CEC_LOG_ERROR, "failed to find a free logical address for the client");
+ return false;
+ }
+
+ // register this client on the new addresses
+ devices.clear();
+ m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
+ for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
+ {
+ // set the physical address of the device at this LA
+ if (CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress))
+ (*it)->SetPhysicalAddress(configuration.iPhysicalAddress);
+
+ // replace a previous client
+ CLockObject lock(m_mutex);
+ m_clients.erase((*it)->GetLogicalAddress());
+ m_clients.insert(make_pair<cec_logical_address, CCECClient *>((*it)->GetLogicalAddress(), client));
+ }
+
+ // set the new ackmask
+ SetLogicalAddresses(GetLogicalAddresses());
+
+ // resume outgoing communication
+ m_bStallCommunication = false;
+
+ return true;
+}
+
+uint16_t CCECProcessor::GetPhysicalAddressFromEeprom(void)
+{
+ libcec_configuration config; config.Clear();
+ if (m_communication)
+ m_communication->GetConfiguration(config);
+ return config.iPhysicalAddress;