cec: handle the bWait parameter in TransmitKeypress() and TransmitKeyRelease()
[deb_libcec.git] / src / lib / devices / CECBusDevice.cpp
index 8b4278119746c13a710102d3906958a063696d11..7d0bac4177bb13ce157b8a3bc8a1fc6cf7045c88 100644 (file)
@@ -434,19 +434,24 @@ void CCECBusDevice::SetMenuState(const cec_menu_state state)
   }
 }
 
-void CCECBusDevice::SetInactiveDevice(void)
+void CCECBusDevice::SetInactiveSource(void)
 {
-  CLockObject lock(&m_writeMutex);
-  m_bActiveSource = false;
+  {
+    CLockObject lock(&m_writeMutex);
+    m_bActiveSource = false;
+  }
+
+  if (MyLogicalAddressContains(m_iLogicalAddress))
+    SetPowerStatus(CEC_POWER_STATUS_STANDBY);
 }
 
-void CCECBusDevice::SetActiveDevice(void)
+void CCECBusDevice::SetActiveSource(void)
 {
   CLockObject lock(&m_writeMutex);
 
   for (int iPtr = 0; iPtr < 16; iPtr++)
     if (iPtr != m_iLogicalAddress)
-      m_processor->m_busDevices[iPtr]->SetInactiveDevice();
+      m_processor->m_busDevices[iPtr]->SetInactiveSource();
 
   m_bActiveSource = true;
   m_powerStatus   = CEC_POWER_STATUS_ON;
@@ -783,13 +788,13 @@ bool CCECBusDevice::TransmitVendorID(cec_logical_address dest, bool bSendAbort /
   }
 }
 
-bool CCECBusDevice::TransmitKeypress(cec_user_control_code key)
+bool CCECBusDevice::TransmitKeypress(cec_user_control_code key, bool bWait /* = true */)
 {
-  return m_handler->TransmitKeypress(m_processor->GetLogicalAddress(), m_iLogicalAddress, key);
+  return m_handler->TransmitKeypress(m_processor->GetLogicalAddress(), m_iLogicalAddress, key, bWait);
 }
 
-bool CCECBusDevice::TransmitKeyRelease(void)
+bool CCECBusDevice::TransmitKeyRelease(bool bWait /* = true */)
 {
-  return m_handler->TransmitKeyRelease(m_processor->GetLogicalAddress(), m_iLogicalAddress);
+  return m_handler->TransmitKeyRelease(m_processor->GetLogicalAddress(), m_iLogicalAddress, bWait);
 }
 //@}