X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fimplementations%2FCECCommandHandler.cpp;h=5a3de0b690c7d4015a2b27144e69c6ab69d7ef46;hb=8bc5358b7ca3f810728fef3108962bd435a0585a;hp=11d550c32adf7bdd6874eab1bef9d3e544e9789a;hpb=72689600b9622fd55a53d9a95b8af42823d00356;p=deb_libcec.git diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 11d550c..5a3de0b 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -564,10 +564,23 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command) { CCECBusDevice *device = GetDevice(command.destination); if (device) + { device->SetPowerStatus(CEC_POWER_STATUS_ON); + if (device->MyLogicalAddressContains(device->GetLogicalAddress())) + { + device->SetActiveSource(); + device->TransmitActiveSource(); + + if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || + device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE) + ((CCECPlaybackDevice *)device)->TransmitDeckStatus(command.initiator); + } + } + } + else + { + m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]); } - - m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]); return true; } } @@ -877,21 +890,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 */) @@ -909,3 +922,16 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* return false; } + +bool CCECCommandHandler::InitHandler(void) +{ + if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) + { + CCECBusDevice *primary = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]; + primary->SetPowerStatus(CEC_POWER_STATUS_ON); + primary->SetMenuState(CEC_MENU_STATE_ACTIVATED); + + m_processor->SetActiveSource(); + primary->TransmitMenuState(m_busDevice->GetLogicalAddress()); + } +}