+
+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);
+ return;
+ }
+ }
+ m_commandBuffer.Push(command);
+}
+
+void CCECClient::CallbackAddKey(const cec_keypress &key)
+{
+ {
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress)
+ {
+ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key);
+ return;
+ }
+ }
+ m_keyBuffer.Push(key);
+}
+
+void CCECClient::CallbackAddLog(const cec_log_message &message)
+{
+ {
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks && m_configuration.callbacks->CBCecLogMessage)
+ {
+ m_configuration.callbacks->CBCecLogMessage(m_configuration.callbackParam, message);
+ return;
+ }
+ }
+ m_logBuffer.Push(message);
+}
+
+void CCECClient::CallbackConfigurationChanged(const libcec_configuration &config)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks &&
+ m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0 &&
+ m_configuration.callbacks->CBCecConfigurationChanged &&
+ m_processor->CECInitialised())
+ m_configuration.callbacks->CBCecConfigurationChanged(m_configuration.callbackParam, config);
+}
+
+void CCECClient::CallbackSourceActivated(bool bActivated, const cec_logical_address logicalAddress)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks &&
+ m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_7_1 &&
+ m_configuration.callbacks->CBCecSourceActivated)
+ m_configuration.callbacks->CBCecSourceActivated(m_configuration.callbackParam, logicalAddress, bActivated ? 1 : 0);
+}
+
+void CCECClient::CallbackAlert(const libcec_alert type, const libcec_parameter ¶m)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks &&
+ m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_0 &&
+ m_configuration.callbacks->CBCecAlert)
+ m_configuration.callbacks->CBCecAlert(m_configuration.callbackParam, type, param);
+}
+
+int CCECClient::CallbackMenuStateChanged(const cec_menu_state newState)
+{
+ CLockObject lock(m_cbMutex);
+ if (m_configuration.callbacks &&
+ m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_2 &&
+ m_configuration.callbacks->CBCecMenuStateChanged)
+ return m_configuration.callbacks->CBCecMenuStateChanged(m_configuration.callbackParam, newState);
+ return 0;
+}