+ if (command.initiator == CECDEVICE_UNKNOWN)
+ {
+ LIB_CEC->AddLog(CEC_LOG_ERROR, "not transmitting a command without a valid initiator");
+ return bReturn;
+ }
+
+ {
+ uint8_t iTries(0), iMaxTries(!command.opcode_set ? 1 : m_iTransmitRetries + 1);
+ while (!bReturn && ++iTries <= iMaxTries && !m_busDevice->IsUnsupportedFeature(command.opcode))
+ {
+ if ((bReturn = m_processor->Transmit(command)) == true)
+ {
+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "command transmitted");
+ if (bExpectResponse)
+ {
+ bReturn = m_waitForResponse->Wait(expectedResponse);
+ LIB_CEC->AddLog(CEC_LOG_DEBUG, bReturn ? "expected response received (%X: %s)" : "expected response not received (%X: %s)", (int)expectedResponse, ToString(expectedResponse));
+ }
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+bool CCECCommandHandler::ActivateSource(void)
+{
+ if (m_busDevice->IsActiveSource() &&
+ m_busDevice->IsHandledByLibCEC())
+ {
+ m_busDevice->SetPowerStatus(CEC_POWER_STATUS_ON);
+ m_busDevice->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+
+ m_busDevice->TransmitImageViewOn();
+ m_busDevice->TransmitActiveSource();
+ m_busDevice->TransmitMenuState(CECDEVICE_TV);
+
+ CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
+ if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
+ playbackDevice->TransmitDeckStatus(CECDEVICE_TV);
+ m_bHandlerInited = true;
+ }
+ return true;
+}
+
+void CCECCommandHandler::SignalOpcode(cec_opcode opcode)
+{
+ m_waitForResponse->Received(opcode);