rpi: handle VC_CEC_LOGICAL_ADDR_LOST in the rpi communication class itself, don't...
[deb_libcec.git] / src / lib / CECProcessor.cpp
index e22d13fd969b77d20bd1572f0b8d4f2615671a8e..1eb272aa7197ba51db4c851b3cad825a0b706f36 100644 (file)
@@ -886,3 +886,19 @@ void CCECProcessor::SwitchMonitoring(bool bSwitchTo)
   if (bSwitchTo)
     UnregisterClients();
 }
+
+void CCECProcessor::HandleLogicalAddressLost(cec_logical_address oldAddress, cec_logical_address newAddress)
+{
+  m_libcec->AddLog(CEC_LOG_NOTICE, "logical address %x was taken by another device, changed to %x", oldAddress, newAddress);
+  CCECClient* client = GetClient(oldAddress);
+  if (client)
+  {
+    if (newAddress == CECDEVICE_UNKNOWN)
+      UnregisterClient(client);
+    else
+    {
+      client->m_configuration.logicalAddresses.Unset(oldAddress);
+      client->m_configuration.logicalAddresses.Set(newAddress);
+    }
+  }
+}