2 * This file is part of the libCEC(R) library.
4 * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
5 * libCEC(R) is an original work, containing original code.
7 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 * This program is dual-licensed; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Alternatively, you can license this library under a commercial license,
25 * please contact Pulse-Eight Licensing for more information.
27 * For more information contact:
28 * Pulse-Eight Licensing <license@pulse-eight.com>
29 * http://www.pulse-eight.com/
30 * http://www.pulse-eight.net/
33 #include "CECProcessor.h"
35 #include "AdapterCommunication.h"
37 #include "util/StdString.h"
38 #include "platform/timeutils.h"
43 CCECProcessor::CCECProcessor(CLibCEC
*controller
, CAdapterCommunication
*serComm
, const char *strDeviceName
, cec_logical_address iLogicalAddress
/* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress
/* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
44 m_iPhysicalAddress(iPhysicalAddress
),
45 m_iLogicalAddress(iLogicalAddress
),
46 m_strDeviceName(strDeviceName
),
47 m_communication(serComm
),
48 m_controller(controller
),
51 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
52 m_vendorIds
[iPtr
] = CEC_VENDOR_UNKNOWN
;
53 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
54 m_vendorClasses
[iPtr
] = (uint8_t) 0;
57 CCECProcessor::~CCECProcessor(void)
60 m_communication
= NULL
;
64 bool CCECProcessor::Start(void)
66 if (!m_communication
|| !m_communication
->IsOpen())
68 m_controller
->AddLog(CEC_LOG_ERROR
, "connection is closed");
72 if (!SetLogicalAddress(m_iLogicalAddress
))
74 m_controller
->AddLog(CEC_LOG_ERROR
, "could not set the logical address");
81 m_controller
->AddLog(CEC_LOG_ERROR
, "could not create a processor thread");
86 void *CCECProcessor::Process(void)
88 m_controller
->AddLog(CEC_LOG_DEBUG
, "processor thread started");
91 cec_adapter_message msg
;
95 bool bParseFrame(false);
97 bool bTransmitSucceeded(false);
102 CLockObject
lock(&m_mutex
);
103 if (m_communication
->IsOpen() && m_communication
->Read(msg
, 50))
104 ParseMessage(msg
, &bError
, &bTransmitSucceeded
, &bParseFrame
);
106 bParseFrame
&= !IsStopped();
108 command
= m_currentframe
;
112 ParseCommand(command
);
114 m_controller
->CheckKeypressTimeout();
123 bool CCECProcessor::PowerOnDevices(cec_logical_address address
/* = CECDEVICE_TV */)
129 strLog
.Format("<< powering on device with logical address %d", (int8_t)address
);
130 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
133 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_IMAGE_VIEW_ON
);
135 return Transmit(command
);
138 bool CCECProcessor::StandbyDevices(cec_logical_address address
/* = CECDEVICE_BROADCAST */)
144 strLog
.Format("<< putting device with logical address %d in standby mode", (int8_t)address
);
145 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
148 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_STANDBY
);
150 return Transmit(command
);
153 bool CCECProcessor::SetActiveView(void)
158 m_controller
->AddLog(CEC_LOG_DEBUG
, "<< setting active view");
161 cec_command::format(command
, m_iLogicalAddress
, CECDEVICE_BROADCAST
, CEC_OPCODE_ACTIVE_SOURCE
);
162 command
.parameters
.push_back((m_iPhysicalAddress
>> 8) & 0xFF);
163 command
.parameters
.push_back(m_iPhysicalAddress
& 0xFF);
165 return Transmit(command
);
168 bool CCECProcessor::SetInactiveView(void)
173 m_controller
->AddLog(CEC_LOG_DEBUG
, "<< setting inactive view");
176 cec_command::format(command
, m_iLogicalAddress
, CECDEVICE_BROADCAST
, CEC_OPCODE_INACTIVE_SOURCE
);
177 command
.parameters
.push_back((m_iPhysicalAddress
>> 8) & 0xFF);
178 command
.parameters
.push_back(m_iPhysicalAddress
& 0xFF);
180 return Transmit(command
);
183 void CCECProcessor::LogOutput(const cec_command
&data
)
185 CStdString txStr
= "transmit ";
186 txStr
.AppendFormat(" %02x", ((uint8_t)data
.initiator
<< 4) + (uint8_t)data
.destination
);
187 txStr
.AppendFormat(":%02x", (uint8_t)data
.opcode
);
189 for (uint8_t iPtr
= 0; iPtr
< data
.parameters
.size
; iPtr
++)
190 txStr
.AppendFormat(":%02x", data
.parameters
[iPtr
]);
191 m_controller
->AddLog(CEC_LOG_DEBUG
, txStr
.c_str());
194 bool CCECProcessor::Transmit(const cec_command
&data
, bool bWaitForAck
/* = true */)
198 cec_adapter_message output
;
200 CAdapterCommunication::FormatAdapterMessage(data
, output
);
202 return TransmitFormatted(output
, bWaitForAck
);
205 bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress
)
208 strLog
.Format("<< setting logical address to %1x", iLogicalAddress
);
209 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
211 m_iLogicalAddress
= iLogicalAddress
;
212 return m_communication
&& m_communication
->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress
);
215 bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress
)
218 strLog
.Format("<< setting physical address to %2x", iPhysicalAddress
);
219 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
221 m_iPhysicalAddress
= iPhysicalAddress
;
222 return SetActiveView();
225 bool CCECProcessor::SetOSDString(cec_logical_address iLogicalAddress
, cec_display_control duration
, const char *strMessage
)
228 strLog
.Format("<< display message '%s'", strMessage
);
229 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
232 cec_command::format(command
, m_iLogicalAddress
, iLogicalAddress
, CEC_OPCODE_SET_OSD_STRING
);
233 command
.parameters
.push_back((uint8_t)duration
);
235 for (unsigned int iPtr
= 0; iPtr
< strlen(strMessage
); iPtr
++)
236 command
.parameters
.push_back(strMessage
[iPtr
]);
238 return Transmit(command
);
241 bool CCECProcessor::SwitchMonitoring(bool bEnable
)
244 strLog
.Format("== %s monitoring mode ==", bEnable
? "enabling" : "disabling");
245 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
247 m_bMonitor
= bEnable
;
249 return m_communication
&& m_communication
->SetAckMask(0);
251 return m_communication
&& m_communication
->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress
);
254 bool CCECProcessor::TransmitFormatted(const cec_adapter_message
&data
, bool bWaitForAck
/* = true */)
256 CLockObject
lock(&m_mutex
);
257 if (!m_communication
|| !m_communication
->Write(data
))
262 uint64_t now
= GetTimeMs();
263 uint64_t target
= now
+ 1000;
267 while (!bGotAck
&& now
< target
)
269 bGotAck
= WaitForAck(&bError
, (uint32_t) (target
- now
));
272 if (bError
&& now
< target
)
274 m_controller
->AddLog(CEC_LOG_ERROR
, "retransmitting previous frame");
275 if (!m_communication
->Write(data
))
284 void CCECProcessor::TransmitAbort(cec_logical_address address
, cec_opcode opcode
, ECecAbortReason reason
/* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */)
286 m_controller
->AddLog(CEC_LOG_DEBUG
, "<< transmitting abort message");
289 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_FEATURE_ABORT
);
290 command
.parameters
.push_back((uint8_t)opcode
);
291 command
.parameters
.push_back((uint8_t)reason
);
296 void CCECProcessor::ReportCECVersion(cec_logical_address address
/* = CECDEVICE_TV */)
298 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< reporting CEC version as 1.3a");
301 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_CEC_VERSION
);
302 command
.parameters
.push_back(CEC_VERSION_1_3A
);
307 void CCECProcessor::ReportPowerState(cec_logical_address address
/*= CECDEVICE_TV */, bool bOn
/* = true */)
310 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< reporting \"On\" power status");
312 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< reporting \"Off\" power status");
315 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_REPORT_POWER_STATUS
);
316 command
.parameters
.push_back(bOn
? (uint8_t) CEC_POWER_STATUS_ON
: (uint8_t) CEC_POWER_STATUS_STANDBY
);
321 void CCECProcessor::ReportMenuState(cec_logical_address address
/* = CECDEVICE_TV */, bool bActive
/* = true */)
324 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< reporting menu state as active");
326 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< reporting menu state as inactive");
329 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_MENU_STATUS
);
330 command
.parameters
.push_back(bActive
? (uint8_t) CEC_MENU_STATE_ACTIVATED
: (uint8_t) CEC_MENU_STATE_DEACTIVATED
);
335 void CCECProcessor::ReportVendorID(cec_logical_address address
/* = CECDEVICE_TV */)
337 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< vendor ID requested, feature abort");
338 TransmitAbort(address
, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
);
341 void CCECProcessor::ReportOSDName(cec_logical_address address
/* = CECDEVICE_TV */)
343 const char *osdname
= m_strDeviceName
.c_str();
345 strLog
.Format("<< reporting OSD name as %s", osdname
);
346 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
349 cec_command::format(command
, m_iLogicalAddress
, address
, CEC_OPCODE_SET_OSD_NAME
);
350 for (unsigned int iPtr
= 0; iPtr
< strlen(osdname
); iPtr
++)
351 command
.parameters
.push_back(osdname
[iPtr
]);
356 void CCECProcessor::ReportPhysicalAddress(void)
359 strLog
.Format("<< reporting physical address as %04x", m_iPhysicalAddress
);
360 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
363 cec_command::format(command
, m_iLogicalAddress
, CECDEVICE_BROADCAST
, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
);
364 command
.parameters
.push_back((uint8_t) ((m_iPhysicalAddress
>> 8) & 0xFF));
365 command
.parameters
.push_back((uint8_t) (m_iPhysicalAddress
& 0xFF));
366 command
.parameters
.push_back((uint8_t) (CEC_DEVICE_TYPE_PLAYBACK_DEVICE
));
371 void CCECProcessor::BroadcastActiveSource(void)
373 m_controller
->AddLog(CEC_LOG_NOTICE
, "<< broadcasting active source");
376 cec_command::format(command
, m_iLogicalAddress
, CECDEVICE_BROADCAST
, CEC_OPCODE_ACTIVE_SOURCE
);
377 command
.parameters
.push_back((uint8_t) ((m_iPhysicalAddress
>> 8) & 0xFF));
378 command
.parameters
.push_back((uint8_t) (m_iPhysicalAddress
& 0xFF));
383 bool CCECProcessor::WaitForAck(bool *bError
, uint32_t iTimeout
/* = 1000 */)
385 bool bTransmitSucceeded
= false, bEom
= false;
388 int64_t iNow
= GetTimeMs();
389 int64_t iTargetTime
= iNow
+ (uint64_t) iTimeout
;
391 while (!bTransmitSucceeded
&& !*bError
&& (iTimeout
== 0 || iNow
< iTargetTime
))
393 cec_adapter_message msg
;
396 if (!m_communication
->Read(msg
, iTimeout
> 0 ? (int32_t)(iTargetTime
- iNow
) : 1000))
402 ParseMessage(msg
, bError
, &bTransmitSucceeded
, &bEom
, false);
406 return bTransmitSucceeded
&& !*bError
;
409 void CCECProcessor::ParseMessage(cec_adapter_message
&msg
, bool *bError
, bool *bTransmitSucceeded
, bool *bEom
, bool bProcessMessages
/* = true */)
412 *bTransmitSucceeded
= false;
420 switch(msg
.message())
422 case MSGCODE_NOTHING
:
423 m_controller
->AddLog(CEC_LOG_DEBUG
, "MSGCODE_NOTHING");
425 case MSGCODE_TIMEOUT_ERROR
:
426 case MSGCODE_HIGH_ERROR
:
427 case MSGCODE_LOW_ERROR
:
429 if (msg
.message() == MSGCODE_TIMEOUT_ERROR
)
430 logStr
= "MSGCODE_TIMEOUT";
431 else if (msg
.message() == MSGCODE_HIGH_ERROR
)
432 logStr
= "MSGCODE_HIGH_ERROR";
434 logStr
= "MSGCODE_LOW_ERROR";
436 int iLine
= (msg
.size() >= 3) ? (msg
[1] << 8) | (msg
[2]) : 0;
437 uint32_t iTime
= (msg
.size() >= 7) ? (msg
[3] << 24) | (msg
[4] << 16) | (msg
[5] << 8) | (msg
[6]) : 0;
438 logStr
.AppendFormat(" line:%i", iLine
);
439 logStr
.AppendFormat(" time:%u", iTime
);
440 m_controller
->AddLog(CEC_LOG_WARNING
, logStr
.c_str());
444 case MSGCODE_FRAME_START
:
446 if (bProcessMessages
)
448 logStr
= "MSGCODE_FRAME_START";
449 m_currentframe
.clear();
452 logStr
.AppendFormat(" initiator:%u destination:%u ack:%s %s", msg
.initiator(), msg
.destination(), msg
.ack() ? "high" : "low", msg
.eom() ? "eom" : "");
453 m_currentframe
.initiator
= msg
.initiator();
454 m_currentframe
.destination
= msg
.destination();
455 m_currentframe
.ack
= msg
.ack();
456 m_currentframe
.eom
= msg
.eom();
458 m_controller
->AddLog(CEC_LOG_DEBUG
, logStr
.c_str());
462 m_frameBuffer
.Push(msg
);
466 case MSGCODE_FRAME_DATA
:
468 if (bProcessMessages
)
470 logStr
= "MSGCODE_FRAME_DATA";
473 uint8_t iData
= msg
[1];
474 logStr
.AppendFormat(" %02x", iData
);
475 m_currentframe
.push_back(iData
);
476 m_currentframe
.eom
= msg
.eom();
478 m_controller
->AddLog(CEC_LOG_DEBUG
, logStr
.c_str());
482 m_frameBuffer
.Push(msg
);
488 case MSGCODE_COMMAND_ACCEPTED
:
489 m_controller
->AddLog(CEC_LOG_DEBUG
, "MSGCODE_COMMAND_ACCEPTED");
491 case MSGCODE_TRANSMIT_SUCCEEDED
:
492 m_controller
->AddLog(CEC_LOG_DEBUG
, "MSGCODE_TRANSMIT_SUCCEEDED");
493 *bTransmitSucceeded
= true;
495 case MSGCODE_RECEIVE_FAILED
:
496 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_RECEIVE_FAILED");
499 case MSGCODE_COMMAND_REJECTED
:
500 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_COMMAND_REJECTED");
503 case MSGCODE_TRANSMIT_FAILED_LINE
:
504 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_TRANSMIT_FAILED_LINE");
507 case MSGCODE_TRANSMIT_FAILED_ACK
:
508 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_TRANSMIT_FAILED_ACK");
511 case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA
:
512 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA");
515 case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE
:
516 m_controller
->AddLog(CEC_LOG_WARNING
, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE");
524 void CCECProcessor::ParseVendorId(cec_logical_address device
, const cec_datapacket
&data
)
528 m_controller
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
532 uint64_t iVendorId
= ((uint64_t)data
[0] << 3) +
533 ((uint64_t)data
[1] << 2) +
536 m_vendorIds
[(uint8_t)device
] = iVendorId
;
537 m_vendorClasses
[(uint8_t)device
] = data
.size
>= 4 ? data
[3] : 0;
540 strLog
.Format("device %d: vendor = %s (%04x) class = %2x", (uint8_t)device
, CECVendorIdToString(m_vendorIds
[(uint8_t)device
]), iVendorId
, m_vendorClasses
[(uint8_t)device
]);
541 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
544 bool CCECProcessor::HandleANCommand(cec_command
&command
)
547 if (command
.destination
== m_iLogicalAddress
)
549 switch(command
.opcode
)
551 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
552 if (command
.parameters
.size
> 0)
554 m_controller
->AddKey();
557 switch (command
.parameters
[0])
559 case CEC_AN_USER_CONTROL_CODE_RETURN
:
560 iButton
= CEC_USER_CONTROL_CODE_PREVIOUS_CHANNEL
;
566 if (iButton
> 0 && iButton
<= CEC_USER_CONTROL_CODE_MAX
)
569 strLog
.Format("key pressed: %1x", iButton
);
570 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
572 m_controller
->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
576 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
577 m_controller
->AddKey();
584 else if (command
.destination
== CECDEVICE_BROADCAST
)
586 switch(command
.opcode
)
596 bHandled
= HandleCecCommand(command
);
601 bool CCECProcessor::HandleSLCommand(cec_command
&command
)
604 if (command
.destination
== m_iLogicalAddress
)
606 switch(command
.opcode
)
614 else if (command
.destination
== CECDEVICE_BROADCAST
)
616 switch(command
.opcode
)
626 bHandled
= HandleCecCommand(command
);
631 bool CCECProcessor::HandleCecCommand(cec_command
&command
)
635 if (command
.destination
== m_iLogicalAddress
)
637 switch(command
.opcode
)
639 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
640 ReportPhysicalAddress();
642 case CEC_OPCODE_GIVE_OSD_NAME
:
643 ReportOSDName(command
.initiator
);
645 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
646 ReportVendorID(command
.initiator
);
648 case CEC_OPCODE_DEVICE_VENDOR_ID
:
649 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
650 ParseVendorId(command
.initiator
, command
.parameters
);
652 case CEC_OPCODE_GIVE_DECK_STATUS
:
653 // need to support opcodes play and deck control before doing anything with this
654 TransmitAbort(command
.initiator
, CEC_OPCODE_GIVE_DECK_STATUS
);
656 case CEC_OPCODE_MENU_REQUEST
:
657 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
658 ReportMenuState(command
.initiator
);
660 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
661 ReportPowerState(command
.initiator
);
663 case CEC_OPCODE_GET_CEC_VERSION
:
664 ReportCECVersion(command
.initiator
);
666 case CEC_OPCODE_USER_CONTROL_PRESSED
:
667 if (command
.parameters
.size
> 0)
669 m_controller
->AddKey();
671 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
674 strLog
.Format("key pressed: %1x", command
.parameters
[0]);
675 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
677 m_controller
->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
681 case CEC_OPCODE_USER_CONTROL_RELEASE
:
682 m_controller
->AddKey();
685 m_controller
->AddCommand(command
);
690 else if (command
.destination
== CECDEVICE_BROADCAST
)
693 switch (command
.opcode
)
695 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
696 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
697 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
698 BroadcastActiveSource();
700 case CEC_OPCODE_SET_STREAM_PATH
:
701 if (command
.parameters
.size
>= 2)
703 int streamaddr
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
704 strLog
.Format(">> %i requests stream path from physical address %04x", command
.initiator
, streamaddr
);
705 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
706 if (streamaddr
== m_iPhysicalAddress
)
707 BroadcastActiveSource();
710 case CEC_OPCODE_ROUTING_CHANGE
:
711 if (command
.parameters
.size
== 4)
713 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
714 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
715 strLog
.Format(">> %i changed physical address from %04x to %04x", command
.initiator
, iOldAddress
, iNewAddress
);
716 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
718 m_controller
->AddCommand(command
);
721 case CEC_OPCODE_DEVICE_VENDOR_ID
:
722 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
723 ParseVendorId(command
.initiator
, command
.parameters
);
726 m_controller
->AddCommand(command
);
734 strLog
.Format("ignoring frame: destination: %u != %u", command
.destination
, (uint8_t)m_iLogicalAddress
);
735 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
742 void CCECProcessor::ParseCommand(cec_command
&command
)
745 dataStr
.Format(">> received frame: %1x%1x:%02x", command
.initiator
, command
.destination
, command
.opcode
);
746 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
747 dataStr
.AppendFormat(":%02x", (unsigned int)command
.parameters
[iPtr
]);
748 m_controller
->AddLog(CEC_LOG_DEBUG
, dataStr
.c_str());
752 switch(m_vendorIds
[command
.initiator
])
755 HandleSLCommand(command
);
757 case CEC_VENDOR_SAMSUNG
:
758 HandleANCommand(command
);
761 HandleCecCommand(command
);
767 const char *CCECProcessor::CECVendorIdToString(const uint64_t iVendorId
)
771 case CEC_VENDOR_SAMSUNG
: