if (m_processor)
{
- if (bEnable)
- return m_processor->UnregisterClient(this);
- else
- {
- m_configuration.bMonitorOnly = false;
- return m_processor->RegisterClient(this);
- }
+ m_processor->SwitchMonitoring(bEnable);
+ m_configuration.bMonitorOnly = bEnable;
+ return bEnable ? true: m_processor->RegisterClient(this);
}
return false;
m_libcec(libcec),
m_iStandardLineTimeout(3),
m_iRetryLineTimeout(3),
- m_iLastTransmission(0)
+ m_iLastTransmission(0),
+ m_bMonitor(true)
{
m_busDevices = new CCECDeviceMap(this);
}
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();
+}
bool TryLogicalAddress(cec_logical_address address, cec_version libCECSpecVersion = CEC_VERSION_1_4);
bool IsRunningLatestFirmware(void);
- private:
+ void SwitchMonitoring(bool bSwitchTo);
+
+ private:
bool OpenConnection(const char *strPort, uint16_t iBaudRate, uint32_t iTimeoutMs, bool bStartListening = true);
void SetCECInitialised(bool bSetTo = true);
CCECInputBuffer m_inBuffer;
CCECDeviceMap * m_busDevices;
std::map<cec_logical_address, CCECClient *> m_clients;
+ bool m_bMonitor;
};
};