cec: per-client monitoring mode (which is just a call to (Un)RegisterClient()
[deb_libcec.git] / src / lib / CECClient.cpp
index 93b9916db352fcf6404a52fec45fb19b9dc633af..6df9dbab4288f6898fa1316b3fbf38697a22da2d 100644 (file)
@@ -1170,7 +1170,17 @@ bool CCECClient::SetDevicePhysicalAddress(const uint16_t iPhysicalAddress)
 
 bool CCECClient::SwitchMonitoring(bool bEnable)
 {
-  return m_processor ? m_processor->SwitchMonitoring(bEnable) : false;
+  LIB_CEC->AddLog(CEC_LOG_NOTICE, "== %s monitoring mode ==", bEnable ? "enabling" : "disabling");
+
+  if (m_processor)
+  {
+    if (bEnable)
+      return m_processor->UnregisterClient(this);
+    else
+      return m_processor->RegisterClient(this);
+  }
+
+  return false;
 }
 
 bool CCECClient::PollDevice(const cec_logical_address iAddress)