cec: handle the bWait parameter in TransmitKeypress() and TransmitKeyRelease()
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 20 Dec 2011 21:53:08 +0000 (22:53 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 20 Dec 2011 21:53:08 +0000 (22:53 +0100)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/LibCEC.cpp
src/lib/LibCEC.h
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index 8cc290cca4ca20c4270fe402892985b2916cddb2..96ef591443bc7d2a23267e3885e2237974a139cf 100644 (file)
@@ -1004,12 +1004,12 @@ bool CCECProcessor::SetAckMask(uint16_t iMask)
   return bReturn;
 }
 
-bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key)
+bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
 {
   return m_busDevices[iDestination]->TransmitKeypress(key);
 }
 
-bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination)
+bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination, bool bWait /* = true */)
 {
   return m_busDevices[iDestination]->TransmitKeyRelease();
 }
index e039ce49707d47c9a10c900539f1274ecea0915b..657aa4784fe3706ee0c171e11e5e9fd69e2cbcfd 100644 (file)
@@ -93,8 +93,8 @@ namespace CEC
       virtual uint8_t VolumeUp(bool bSendRelease = true);
       virtual uint8_t VolumeDown(bool bSendRelease = true);
       virtual uint8_t MuteAudio(bool bSendRelease = true);
-      virtual bool TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key);
-      virtual bool TransmitKeyRelease(cec_logical_address iDestination);
+      virtual bool TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
+      virtual bool TransmitKeyRelease(cec_logical_address iDestination, bool bWait = true);
       virtual bool EnablePhysicalAddressDetection(void) { return false; };
       void SetStandardLineTimeout(uint8_t iTimeout);
       void SetRetryLineTimeout(uint8_t iTimeout);
index a1e538380861aae455118a38d4f70f9c052fc66b..1366ff6cbcec92b6567ab0648e8a32cdeac3f87a 100644 (file)
@@ -300,17 +300,17 @@ uint8_t CLibCEC::MuteAudio(bool bSendRelease /* = true */)
   return 0;
 }
 
-bool CLibCEC::SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = false */)
+bool CLibCEC::SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
 {
   if (m_cec)
-    return m_cec->TransmitKeypress(iDestination, key);
+    return m_cec->TransmitKeypress(iDestination, key, bWait);
   return false;
 }
 
-bool CLibCEC::SendKeyRelease(cec_logical_address iDestination, bool bWait /* = false */)
+bool CLibCEC::SendKeyRelease(cec_logical_address iDestination, bool bWait /* = true */)
 {
   if (m_cec)
-    return m_cec->TransmitKeyRelease(iDestination);
+    return m_cec->TransmitKeyRelease(iDestination, bWait);
   return false;
 }
 
index 7f604241e07618e5dfad47680c6c6c164c3f093a..9c3e8f1002c235bd73f5ea150cb47346f794ab86 100644 (file)
@@ -92,8 +92,8 @@ namespace CEC
       virtual uint8_t VolumeUp(bool bSendRelease = true);
       virtual uint8_t VolumeDown(bool bSendRelease = true);
       virtual uint8_t MuteAudio(bool bSendRelease = true);
-      virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false);
-      virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false);
+      virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
+      virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = true);
       virtual cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
       virtual bool EnablePhysicalAddressDetection(void);
       virtual cec_logical_address GetActiveSource(void);
index 41643a3519263a238d025fe92c6b2adc68750dde..7d0bac4177bb13ce157b8a3bc8a1fc6cf7045c88 100644 (file)
@@ -788,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);
 }
 //@}
index b8a9aa94f74a59bc524415c433808a7503d5c45e..23b6c15cd5ec0d8cc51946b205be920140dda12c 100644 (file)
@@ -99,8 +99,8 @@ namespace CEC
     virtual bool TransmitPowerState(cec_logical_address dest);
     virtual bool TransmitPoll(cec_logical_address dest);
     virtual bool TransmitVendorID(cec_logical_address dest, bool bSendAbort = true);
-    virtual bool TransmitKeypress(cec_user_control_code key);
-    virtual bool TransmitKeyRelease(void);
+    virtual bool TransmitKeypress(cec_user_control_code key, bool bWait = true);
+    virtual bool TransmitKeyRelease(bool bWait = true);
 
   protected:
     bool RequestCecVersion(void);
index 80bc280a3bb9b8af47e7be43582baa8ef9f22111..b43d2b0ed87262f9723ad1b349319f07f7b910a1 100644 (file)
@@ -577,7 +577,6 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
           }
         }
       }
-
       m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
       return true;
     }
@@ -888,21 +887,21 @@ bool CCECCommandHandler::TransmitDeckStatus(const cec_logical_address iInitiator
   return Transmit(command);
 }
 
-bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key)
+bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
 {
   cec_command command;
   cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_PRESSED);
   command.parameters.PushBack((uint8_t)key);
 
-  return Transmit(command);
+  return Transmit(command, bWait);
 }
 
-bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait /* = true */)
 {
   cec_command command;
   cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_RELEASE);
 
-  return Transmit(command);
+  return Transmit(command, bWait);
 }
 
 bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */)
index e5d19ed102097c1a1e7901dd644365ffc60a675c..c730d047a6f8020eeab14ee6c08217fc18d6b18f 100644 (file)
@@ -77,8 +77,8 @@ namespace CEC
     virtual bool TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state);
     virtual bool TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state);
     virtual bool TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state);
-    virtual bool TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key);
-    virtual bool TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+    virtual bool TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
+    virtual bool TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait = true);
 
   protected:
     virtual bool HandleActiveSource(const cec_command &command);