changed copyright of boblight files with permission of the original author
[deb_libcec.git] / src / lib / LibCEC.cpp
index d7d7d60655b35108a9c4a4502bed163582e19fdb..95e2a2e42e72d1a5cadb37f2be924c207a19a322 100644 (file)
@@ -55,14 +55,7 @@ CLibCEC::~CLibCEC(void)
 {
   Close();
   delete m_cec;
-  m_cec = NULL;
-
   delete m_comm;
-  m_comm = NULL;
-
-  m_logBuffer.Clear();
-  m_keyBuffer.Clear();
-  m_commandBuffer.Clear();
 }
 
 bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = 10000 */)
@@ -134,16 +127,6 @@ bool CLibCEC::StartBootloader(void)
   return m_comm ? m_comm->StartBootloader() : false;
 }
 
-int8_t CLibCEC::GetMinVersion(void)
-{
-  return CEC_MIN_VERSION;
-}
-
-int8_t CLibCEC::GetLibVersion(void)
-{
-  return CEC_LIB_VERSION;
-}
-
 bool CLibCEC::GetNextLogMessage(cec_log_message *message)
 {
   return (m_logBuffer.Pop(*message));
@@ -225,6 +208,12 @@ uint64_t CLibCEC::GetDeviceVendorId(cec_logical_address iAddress)
   return 0;
 }
 
+cec_power_status CLibCEC::GetDevicePowerStatus(cec_logical_address iAddress)
+{
+  if (m_cec && iAddress >= CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST)
+    return m_cec->GetDevicePowerStatus(iAddress);
+  return CEC_POWER_STATUS_UNKNOWN;
+}
 
 void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
 {
@@ -238,6 +227,13 @@ void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
   }
 }
 
+void CLibCEC::AddKey(cec_keypress &key)
+{
+  m_keyBuffer.Push(key);
+  m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
+  m_buttontime = 0;
+}
+
 void CLibCEC::AddKey(void)
 {
   if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN)
@@ -248,8 +244,8 @@ void CLibCEC::AddKey(void)
     key.keycode = m_iCurrentButton;
     m_keyBuffer.Push(key);
     m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
-    m_buttontime = 0;
   }
+  m_buttontime = 0;
 }
 
 void CLibCEC::AddCommand(const cec_command &command)