X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FSLCommandHandler.cpp;h=40c0066ad3d400f0467a8ac956f32b43e5b17cc3;hb=a24c27d3704d6934f4ea68d093453e68246a9de0;hp=7c216e949ec6d1b61ee3e4385ad3f6eacab819c3;hpb=1b5cc4a2517ee8e6cebb44063ea03eb4128b4ab1;p=deb_libcec.git diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 7c216e9..40c0066 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -1,4 +1,3 @@ -#pragma once /* * This file is part of the libCEC(R) library. * @@ -32,6 +31,8 @@ */ #include "SLCommandHandler.h" +#include "../devices/CECBusDevice.h" +#include "../CECProcessor.h" using namespace CEC; @@ -39,3 +40,51 @@ CSLCommandHandler::CSLCommandHandler(CCECBusDevice *busDevice) : CCECCommandHandler(busDevice) { } + +bool CSLCommandHandler::HandleVendorCommand(const cec_command &command) +{ + if (command.parameters.size == 1 && + command.parameters[0] == 0x01) + { + /* enable SL */ + cec_command response; + cec_command::Format(response, command.destination, command.initiator, CEC_OPCODE_VENDOR_COMMAND); + response.PushBack(0x02); + response.PushBack(0x05); + + return m_busDevice->GetProcessor()->Transmit(response); + } + + return false; +} + +bool CSLCommandHandler::HandleGiveDeviceVendorId(const cec_command &command) +{ + /* imitate LG devices */ + CCECBusDevice *device = GetDevice(command.destination); + if (device) + device->SetVendorId(CEC_VENDOR_LG); + + return CCECCommandHandler::HandleGiveDeviceVendorId(command); +} + +bool CSLCommandHandler::HandleCommand(const cec_command &command) +{ + bool bHandled(false); + if (m_busDevice->MyLogicalAddressContains(command.destination)) + { + switch(command.opcode) + { + case CEC_OPCODE_VENDOR_COMMAND: + bHandled = HandleVendorCommand(command); + break; + default: + break; + } + } + + if (!bHandled) + bHandled = CCECCommandHandler::HandleCommand(command); + + return bHandled; +}