From: Lars Op den Kamp Date: Tue, 20 Dec 2011 21:53:08 +0000 (+0100) Subject: cec: handle the bWait parameter in TransmitKeypress() and TransmitKeyRelease() X-Git-Tag: upstream/2.2.0~1^2~43^2~36 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4bec9d79a5b66d6fe14b19c4e66509b03cc53e90;p=deb_libcec.git cec: handle the bWait parameter in TransmitKeypress() and TransmitKeyRelease() --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 8cc290c..96ef591 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -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(); } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index e039ce4..657aa47 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -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); diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index a1e5383..1366ff6 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -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; } diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h index 7f60424..9c3e8f1 100644 --- a/src/lib/LibCEC.h +++ b/src/lib/LibCEC.h @@ -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); diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 41643a3..7d0bac4 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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); } //@} diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index b8a9aa9..23b6c15 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -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); diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 80bc280..b43d2b0 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -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 */) diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index e5d19ed..c730d04 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -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);