added HandleLogicalAddressLost() callback to IAdapterCommunication
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 3 Sep 2012 15:18:30 +0000 (17:18 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 3 Sep 2012 15:18:30 +0000 (17:18 +0200)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/adapter/AdapterCommunication.h

index e22d13fd969b77d20bd1572f0b8d4f2615671a8e..b4445f42f921881edb6361d57f45a7498c62136f 100644 (file)
@@ -886,3 +886,11 @@ void CCECProcessor::SwitchMonitoring(bool 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);
+}
index dc8e9f557d1c476b6a16029a11239fc3f380b56a..63cf298b89cbfa644882d6b64e25e419c81457d4 100644 (file)
@@ -69,6 +69,7 @@ namespace CEC
       CCECClient *GetClient(const cec_logical_address address);
 
       bool                  OnCommandReceived(const cec_command &command);
+      void                  HandleLogicalAddressLost(cec_logical_address address);
 
       CCECBusDevice *       GetDevice(cec_logical_address address) const;
       CCECAudioSystem *     GetAudioSystem(void) const;
index 02dda4dab1e4db1766403ed221236000fed5c49d..b73dccde19387ea99ac1f20d0c0071af4383b0e5 100644 (file)
@@ -75,6 +75,12 @@ namespace CEC
      */
     virtual bool HandleReceiveFailed(cec_logical_address initiator) = 0;
 
+    /*!
+     * @brief Callback method for IAdapterCommunication, called when a logical address that libCEC uses was taken by another device.
+     * @param address The logical address that was taken by another device.
+     */
+    virtual void HandleLogicalAddressLost(cec_logical_address address) = 0;
+
     virtual CLibCEC *GetLib(void) const = 0;
   };