m_libcec(libcec),
m_iStandardLineTimeout(3),
m_iRetryLineTimeout(3),
- m_iLastTransmission(0)
+ m_iLastTransmission(0),
+ m_bMonitor(true)
{
m_busDevices = new CCECDeviceMap(this);
}
config->iFirmwareVersion = m_communication->GetFirmwareVersion();
config->iPhysicalAddress = m_communication->GetPhysicalAddress();
config->iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
+ config->adapterType = m_communication->GetAdapterType();
return true;
}
// ensure that we know the vendor id of the TV
CCECBusDevice *tv = GetTV();
+ cec_vendor_id tvVendor = CEC_VENDOR_UNKNOWN;
if (m_communication->SupportsSourceLogicalAddress(CECDEVICE_UNREGISTERED))
- tv->GetVendorId(CECDEVICE_UNREGISTERED);
+ tvVendor = tv->GetVendorId(CECDEVICE_UNREGISTERED);
else if (m_communication->SupportsSourceLogicalAddress(CECDEVICE_FREEUSE))
- tv->GetVendorId(CECDEVICE_FREEUSE);
+ tvVendor = tv->GetVendorId(CECDEVICE_FREEUSE);
+
+ // wait until the handler is replaced, to avoid double registrations
+ if (tvVendor != CEC_VENDOR_UNKNOWN &&
+ CCECCommandHandler::HasSpecificHandler(tvVendor))
+ {
+ while (!tv->ReplaceHandler(false))
+ CEvent::Sleep(5);
+ }
// get the configuration from the client
m_libcec->AddLog(CEC_LOG_NOTICE, "registering new CEC client - v%s", ToString((cec_client_version)configuration.clientVersion));
configuration.serverVersion = LIBCEC_VERSION_CURRENT;
configuration.iFirmwareVersion = m_communication->GetFirmwareVersion();
configuration.iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
+ configuration.adapterType = m_communication->GetAdapterType();
// mark the client as registered
client->SetRegistered(true);
if (SetLogicalAddresses(addresses))
{
// no more clients left, disable controlled mode
- if (addresses.IsEmpty())
+ if (addresses.IsEmpty() && !m_bMonitor)
m_communication->SetControlledMode(false);
return true;
m_communication->IsRunningLatestFirmware() :
true;
}
+
+void CCECProcessor::SwitchMonitoring(bool bSwitchTo)
+{
+ {
+ CLockObject lock(m_mutex);
+ m_bMonitor = bSwitchTo;
+ }
+ if (bSwitchTo)
+ UnregisterClients();
+}
+
+void CCECProcessor::HandleLogicalAddressLost(cec_logical_address address)
+{
+ m_libcec->AddLog(CEC_LOG_NOTICE, "logical address %x was taken by another device, re-registering the client");
+ CCECClient* client = GetClient(address);
+ if (client)
+ RegisterClient(client);
+}