cec: refactor CEC command handling. split up standard and non-standard CEC implementa...
[deb_libcec.git] / src / lib / LibCEC.cpp
index 78fca2d1a610c2528bfc7cd34096e0db9ea0fbfb..ecbc55abece3df8350a42574ec23f4350c9045c2 100644 (file)
@@ -193,6 +193,16 @@ bool CLibCEC::SetInactiveView(void)
   return m_cec ? m_cec->SetInactiveView() : false;
 }
 
+bool CLibCEC::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
+{
+  return m_cec ? m_cec->SetOSDString(iLogicalAddress, duration, strMessage) : false;
+}
+
+bool CLibCEC::SwitchMonitoring(bool bEnable)
+{
+  return m_cec ? m_cec->SwitchMonitoring(bEnable) : false;
+}
+
 void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
 {
   if (m_cec)
@@ -219,7 +229,7 @@ void CLibCEC::AddKey(void)
   }
 }
 
-void CLibCEC::AddCommand(cec_command &command)
+void CLibCEC::AddCommand(const cec_command &command)
 {
   if (m_commandBuffer.Push(command))
   {
@@ -246,6 +256,13 @@ void CLibCEC::SetCurrentButton(cec_user_control_code iButtonCode)
 {
   m_iCurrentButton = iButtonCode;
   m_buttontime = GetTimeMs();
+
+  /* push keypress to the keybuffer with 0 duration.
+     push another press to the keybuffer with the duration set when the button is released */
+  cec_keypress key;
+  key.duration = 0;
+  key.keycode = m_iCurrentButton;
+  m_keyBuffer.Push(key);
 }
 
 void * CECCreate(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress /*= CEC::CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */)