+ addresses = m_configuration.logicalAddresses;
+ return addresses;
+}
+
+bool CCECClient::CanPersistConfiguration(void)
+{
+ return m_processor ? m_processor->CanPersistConfiguration() : false;
+}
+
+bool CCECClient::PersistConfiguration(const libcec_configuration &configuration)
+{
+ return m_processor && IsRegistered() ?
+ m_processor->PersistConfiguration(configuration) :
+ false;
+}
+
+void CCECClient::RescanActiveDevices(void)
+{
+ if (m_processor)
+ m_processor->RescanActiveDevices();
+}
+
+bool CCECClient::IsLibCECActiveSource(void)
+{
+ bool bReturn(false);
+ if (m_processor)
+ {
+ cec_logical_address activeSource = m_processor->GetActiveSource();
+ CCECBusDevice *device = m_processor->GetDevice(activeSource);
+ if (device)
+ bReturn = device->IsHandledByLibCEC() && !device->GetHandler()->ActiveSourcePending();
+ }
+ return bReturn;
+}
+
+void CCECClient::SourceActivated(const cec_logical_address logicalAddress)
+{
+ LIB_CEC->AddLog(CEC_LOG_NOTICE, ">> source activated: %s (%x)", ToString(logicalAddress), logicalAddress);
+ CallbackSourceActivated(true, logicalAddress);
+}
+
+void CCECClient::SourceDeactivated(const cec_logical_address logicalAddress)
+{
+ LIB_CEC->AddLog(CEC_LOG_NOTICE, ">> source deactivated: %s (%x)", ToString(logicalAddress), logicalAddress);
+ CallbackSourceActivated(false, logicalAddress);
+}
+
+void CCECClient::CallbackAddCommand(const cec_command &command)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks && m_configuration.callbacks->CBCecCommand)
+ m_configuration.callbacks->CBCecCommand(m_configuration.callbackParam, command);
+}
+
+uint32_t CCECClient::DoubleTapTimeoutMS(void)
+{
+ CLockObject lock(m_cbMutex);
+ return m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_2_0 ?
+ m_configuration.iDoubleTapTimeout50Ms * DOUBLE_TAP_TIMEOUT_UNIT_SIZE :
+ m_configuration.iDoubleTapTimeout50Ms;
+}
+
+void CCECClient::CallbackAddKey(const cec_keypress &key)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress)
+ {
+ // prevent double taps
+ int64_t now = GetTimeMs();
+ if (m_lastKeypress.keycode != key.keycode ||
+ key.duration > 0 ||
+ now - m_iLastKeypressTime >= DoubleTapTimeoutMS())
+ {
+ // no double tap
+ if (key.duration == 0)
+ m_iLastKeypressTime = now;
+ m_lastKeypress = key;
+ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key);
+ }
+ }
+}