cec: added static CLibCEC::Alert() method and CEC_ALERT_CONNECTION_LOST enum value
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 09:19:58 +0000 (11:19 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 12:06:31 +0000 (14:06 +0200)
include/cectypes.h
src/lib/LibCEC.cpp
src/lib/LibCEC.h

index 8bfd0fa15c9f1349fa1ed784481edaceff46dc49..d3e3bb1a8dc9d4479f4bd7fb593ae0ba36593630 100644 (file)
@@ -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
index 8c0aca8164d20cc18c987a080cd365611a2b1271..5dfa9688096af011235f995f4bf8c921cccc7621 100644 (file)
@@ -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 &param)
+{
+  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)
index 834ab1d6971141d72c70b8d464d7e933bbd5d3c5..adfb50753150d465132dcac577fa7ac2d15f1d67 100644 (file)
@@ -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 &param);
 
       static CLibCEC *GetInstance(void);
       static void SetInstance(CLibCEC *instance);