From: Lars Op den Kamp Date: Mon, 3 Sep 2012 15:18:30 +0000 (+0200) Subject: added HandleLogicalAddressLost() callback to IAdapterCommunication X-Git-Tag: upstream/2.2.0~1^2~18^2^2~15 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=9768d06119e3f2f835e0814624485ec631e31e62 added HandleLogicalAddressLost() callback to IAdapterCommunication --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index e22d13f..b4445f4 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -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); +} diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index dc8e9f5..63cf298 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -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; diff --git a/src/lib/adapter/AdapterCommunication.h b/src/lib/adapter/AdapterCommunication.h index 02dda4d..b73dccd 100644 --- a/src/lib/adapter/AdapterCommunication.h +++ b/src/lib/adapter/AdapterCommunication.h @@ -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; };