From: Lars Op den Kamp Date: Mon, 23 Apr 2012 09:19:58 +0000 (+0200) Subject: cec: added static CLibCEC::Alert() method and CEC_ALERT_CONNECTION_LOST enum value X-Git-Tag: upstream/2.2.0~1^2~29^2^2~67 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b1c47f9d6d6d6007c6a66c8ad806e3e046933092;p=deb_libcec.git cec: added static CLibCEC::Alert() method and CEC_ALERT_CONNECTION_LOST enum value --- diff --git a/include/cectypes.h b/include/cectypes.h index 8bfd0fa..d3e3bb1 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -1017,7 +1017,8 @@ typedef struct cec_logical_addresses typedef enum libcec_alert { - CEC_ALERT_SERVICE_DEVICE + CEC_ALERT_SERVICE_DEVICE, + CEC_ALERT_CONNECTION_LOST } libcec_alert; typedef enum libcec_parameter_type diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 8c0aca8..5dfa968 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -447,6 +447,23 @@ void CLibCEC::AddCommand(const cec_command &command) AddLog(CEC_LOG_WARNING, "command buffer is full"); } +void CLibCEC::Alert(const libcec_alert type, const libcec_parameter ¶m) +{ + CLibCEC *instance = CLibCEC::GetInstance(); + if (!instance) + return; + CLockObject lock(instance->m_mutex); + + libcec_configuration config; + instance->GetCurrentConfiguration(&config); + + if (instance->m_callbacks && + config.clientVersion >= CEC_CLIENT_VERSION_1_6_0 && + instance->m_callbacks->CBCecAlert != NULL && + instance->m_cec->IsInitialised()) + instance->m_callbacks->CBCecAlert(instance->m_cbParam, type, param); +} + void CLibCEC::CheckKeypressTimeout(void) { if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && GetTimeMs() - m_buttontime > CEC_BUTTON_TIMEOUT) diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h index 834ab1d..adfb507 100644 --- a/src/lib/LibCEC.h +++ b/src/lib/LibCEC.h @@ -138,6 +138,7 @@ namespace CEC static void SetCurrentButton(cec_user_control_code iButtonCode); virtual void CheckKeypressTimeout(void); static int MenuStateChanged(const cec_menu_state newState); + static void Alert(const libcec_alert type, const libcec_parameter ¶m); static CLibCEC *GetInstance(void); static void SetInstance(CLibCEC *instance);