+ {
+ SetSLInitialised();
+ device->MarkAsActiveSource();
+ device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+ device->TransmitPowerState(command.initiator, true);
+
+ CEvent::Sleep(2000);
+ device->SetPowerStatus(CEC_POWER_STATUS_ON);
+ device->TransmitPowerState(command.initiator, false);
+ device->TransmitPhysicalAddress(false);
+ {
+ CLockObject lock(m_SLMutex);
+ m_bActiveSourceSent = false;
+ }
+ if (device->IsActiveSource())
+ ActivateSource();
+ }
+}
+void CSLCommandHandler::HandleVendorCommandPowerOnStatus(const cec_command &command)
+{
+ if (command.destination != CECDEVICE_BROADCAST)
+ {
+ CCECBusDevice *device = m_processor->GetPrimaryDevice();
+ if (device)
+ {
+ device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+ device->TransmitPowerState(command.initiator, true);
+ device->SetPowerStatus(CEC_POWER_STATUS_ON);
+ }
+ }
+}
+
+void CSLCommandHandler::HandleVendorCommandSLConnect(const cec_command &command)
+{
+ SetSLInitialised();
+ TransmitVendorCommandSetDeviceMode(command.destination, command.initiator, CEC_DEVICE_TYPE_RECORDING_DEVICE);
+
+ ActivateSource();
+}
+
+void CSLCommandHandler::TransmitVendorCommandSetDeviceMode(const cec_logical_address iSource, const cec_logical_address iDestination, const cec_device_type type)
+{
+ cec_command response;
+ cec_command::Format(response, iSource, iDestination, CEC_OPCODE_VENDOR_COMMAND);
+ response.PushBack(SL_COMMAND_SET_DEVICE_MODE);
+ response.PushBack((uint8_t)type);
+ Transmit(response, false, true);
+}
+
+int CSLCommandHandler::HandleGiveDeckStatus(const cec_command &command)
+{
+ if (!m_processor->CECInitialised() ||
+ !m_processor->IsHandledByLibCEC(command.destination))
+ return CEC_ABORT_REASON_NOT_IN_CORRECT_MODE_TO_RESPOND;
+
+ CCECPlaybackDevice *device = CCECBusDevice::AsPlaybackDevice(GetDevice(command.destination));
+ if (!device || command.parameters.size == 0)
+ return CEC_ABORT_REASON_INVALID_OPERAND;
+
+ device->SetDeckStatus(CEC_DECK_INFO_OTHER_STATUS_LG);
+ if (command.parameters[0] == CEC_STATUS_REQUEST_ON)
+ {
+ device->TransmitDeckStatus(command.initiator, true);
+ if (!ActiveSourceSent())
+ ActivateSource();
+ return COMMAND_HANDLED;
+ }
+ else if (command.parameters[0] == CEC_STATUS_REQUEST_ONCE)
+ {
+ device->TransmitDeckStatus(command.initiator, true);
+ return COMMAND_HANDLED;
+ }