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 "CECCommandHandler.h"
34 #include "../devices/CECBusDevice.h"
35 #include "../devices/CECAudioSystem.h"
36 #include "../devices/CECPlaybackDevice.h"
37 #include "../CECProcessor.h"
42 CCECCommandHandler::CCECCommandHandler(CCECBusDevice
*busDevice
)
44 m_busDevice
= busDevice
;
47 bool CCECCommandHandler::HandleCommand(const cec_command
&command
)
52 strLog
.Format(">> %s (%X) -> %s (%X): %s (%2X)", ToString(command
.initiator
), command
.initiator
, ToString(command
.destination
), command
.destination
, ToString(command
.opcode
), command
.opcode
);
53 m_busDevice
->AddLog(CEC_LOG_NOTICE
, strLog
);
55 switch(command
.opcode
)
57 case CEC_OPCODE_REPORT_POWER_STATUS
:
58 HandleReportPowerStatus(command
);
60 case CEC_OPCODE_CEC_VERSION
:
61 HandleDeviceCecVersion(command
);
63 case CEC_OPCODE_SET_MENU_LANGUAGE
:
64 HandleSetMenuLanguage(command
);
66 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
67 HandleGivePhysicalAddress(command
);
69 case CEC_OPCODE_GIVE_OSD_NAME
:
70 HandleGiveOSDName(command
);
72 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
73 HandleGiveDeviceVendorId(command
);
75 case CEC_OPCODE_DEVICE_VENDOR_ID
:
76 HandleDeviceVendorId(command
);
78 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
79 HandleDeviceVendorCommandWithId(command
);
81 case CEC_OPCODE_GIVE_DECK_STATUS
:
82 HandleGiveDeckStatus(command
);
84 case CEC_OPCODE_DECK_CONTROL
:
85 HandleDeckControl(command
);
87 case CEC_OPCODE_MENU_REQUEST
:
88 HandleMenuRequest(command
);
90 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
91 HandleGiveDevicePowerStatus(command
);
93 case CEC_OPCODE_GET_CEC_VERSION
:
94 HandleGetCecVersion(command
);
96 case CEC_OPCODE_USER_CONTROL_PRESSED
:
97 HandleUserControlPressed(command
);
99 case CEC_OPCODE_USER_CONTROL_RELEASE
:
100 HandleUserControlRelease(command
);
102 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
103 HandleGiveAudioStatus(command
);
105 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
106 HandleGiveSystemAudioModeStatus(command
);
108 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
109 HandleSetSystemAudioModeRequest(command
);
111 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
112 HandleRequestActiveSource(command
);
114 case CEC_OPCODE_SET_STREAM_PATH
:
115 HandleSetStreamPath(command
);
117 case CEC_OPCODE_ROUTING_CHANGE
:
118 HandleRoutingChange(command
);
120 case CEC_OPCODE_ROUTING_INFORMATION
:
121 HandleRoutingInformation(command
);
123 case CEC_OPCODE_STANDBY
:
124 HandleStandby(command
);
126 case CEC_OPCODE_ACTIVE_SOURCE
:
127 HandleActiveSource(command
);
129 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
130 HandleReportPhysicalAddress(command
);
133 UnhandledCommand(command
);
134 if (command
.destination
== CECDEVICE_BROADCAST
|| m_busDevice
->MyLogicalAddressContains(command
.destination
))
135 m_busDevice
->GetProcessor()->AddCommand(command
);
143 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
145 if (command
.parameters
.size
== 2)
147 m_busDevice
->GetProcessor()->AddCommand(command
);
149 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
150 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
156 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
158 CCECBusDevice
*device
= GetDevice(command
.destination
);
159 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) && command
.parameters
.size
> 0)
161 m_busDevice
->GetProcessor()->AddCommand(command
);
163 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
170 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
172 if (command
.parameters
.size
== 1)
174 CCECBusDevice
*device
= GetDevice(command
.initiator
);
176 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
182 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
184 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
185 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
190 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
192 SetVendorId(command
);
196 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
198 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
200 CCECBusDevice
*device
= GetDevice(command
.destination
);
202 return device
->TransmitCECVersion(command
.initiator
);
208 bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command
&command
)
210 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
212 CCECBusDevice
*device
= GetDevice(command
.destination
);
213 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
214 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
220 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
222 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
224 CCECBusDevice
*device
= GetDevice(command
.destination
);
225 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
))
226 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
232 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
234 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
236 CCECBusDevice
*device
= GetDevice(command
.destination
);
238 return device
->TransmitPowerState(command
.initiator
);
244 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
246 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
248 CCECBusDevice
*device
= GetDevice(command
.destination
);
250 return device
->TransmitVendorID(command
.initiator
);
256 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
258 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
260 CCECBusDevice
*device
= GetDevice(command
.destination
);
262 return device
->TransmitOSDName(command
.initiator
);
268 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
270 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
272 CCECBusDevice
*device
= GetDevice(command
.destination
);
274 return device
->TransmitPhysicalAddress();
280 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
282 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
284 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
286 CCECBusDevice
*device
= GetDevice(command
.destination
);
288 return device
->TransmitMenuState(command
.initiator
);
292 m_busDevice
->GetProcessor()->AddCommand(command
);
299 bool CCECCommandHandler::HandleReportPhysicalAddress(const cec_command
&command
)
301 if (command
.parameters
.size
== 3)
303 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
304 cec_device_type type
= (cec_device_type
)command
.parameters
[2];
306 CCECBusDevice
*device
= GetDevice(command
.initiator
);
307 if (device
&& device
->GetType() == type
)
308 device
->SetPhysicalAddress(iNewAddress
);
313 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
315 if (command
.parameters
.size
== 1)
317 CCECBusDevice
*device
= GetDevice(command
.initiator
);
319 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
324 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
327 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
328 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
330 vector
<CCECBusDevice
*> devices
;
331 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
332 devices
[iDevicePtr
]->TransmitActiveSource();
337 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
339 if (command
.parameters
.size
== 4)
341 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
342 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
344 CCECBusDevice
*device
= GetDevice(command
.initiator
);
346 device
->SetStreamPath(iNewAddress
, iOldAddress
);
351 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
353 if (command
.parameters
.size
== 2)
355 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
357 CCECBusDevice
*device
= GetDevice(command
.initiator
);
359 device
->SetPhysicalAddress(iNewAddress
);
363 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
365 if (command
.parameters
.size
== 3)
367 CCECBusDevice
*device
= GetDevice(command
.initiator
);
370 cec_menu_language language
;
371 language
.device
= command
.initiator
;
372 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
373 language
.language
[iPtr
] = command
.parameters
[iPtr
];
374 language
.language
[3] = 0;
375 device
->SetMenuLanguage(language
);
377 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
378 m_busDevice
->GetProcessor()->AddCommand(command
);
384 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
386 if (command
.parameters
.size
>= 2)
388 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
390 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
391 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
393 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
395 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
398 return device
->TransmitActiveSource() &&
399 device
->TransmitMenuState(command
.initiator
);
407 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
409 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
411 CCECBusDevice
*device
= GetDevice(command
.destination
);
412 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
413 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
418 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
420 CCECBusDevice
*device
= GetDevice(command
.initiator
);
422 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
424 m_busDevice
->GetProcessor()->AddCommand(command
);
429 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
431 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
433 CCECBusDevice
*device
= GetDevice(command
.destination
);
434 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
435 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
441 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
443 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
445 m_busDevice
->GetProcessor()->AddKey();
447 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
450 strLog
.Format("key pressed: %x", command
.parameters
[0]);
451 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
453 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
454 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
456 CCECBusDevice
*device
= GetDevice(command
.destination
);
458 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
461 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
467 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
469 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
470 m_busDevice
->GetProcessor()->AddKey();
475 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
478 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
479 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
482 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
484 unsigned int iReturn(0);
486 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
487 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
491 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
499 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
501 CCECBusDevice
*device
= NULL
;
503 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
504 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
509 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
511 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
514 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
516 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
519 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
521 if (command
.parameters
.size
< 3)
523 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
527 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
528 ((uint64_t)command
.parameters
[1] << 8) +
529 (uint64_t)command
.parameters
[2];
531 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
533 device
->SetVendorId(iVendorId
);
536 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
540 case CEC_MENU_STATE_ACTIVATED
:
542 case CEC_MENU_STATE_DEACTIVATED
:
543 return "deactivated";
549 const char *CCECCommandHandler::ToString(const cec_version version
)
553 case CEC_VERSION_1_2
:
555 case CEC_VERSION_1_2A
:
557 case CEC_VERSION_1_3
:
559 case CEC_VERSION_1_3A
:
561 case CEC_VERSION_1_4
:
568 const char *CCECCommandHandler::ToString(const cec_power_status status
)
572 case CEC_POWER_STATUS_ON
:
574 case CEC_POWER_STATUS_STANDBY
:
576 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
577 return "in transition from on to standby";
578 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
579 return "in transition from standby to on";
585 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
589 case CECDEVICE_AUDIOSYSTEM
:
591 case CECDEVICE_BROADCAST
:
593 case CECDEVICE_FREEUSE
:
595 case CECDEVICE_PLAYBACKDEVICE1
:
597 case CECDEVICE_PLAYBACKDEVICE2
:
599 case CECDEVICE_PLAYBACKDEVICE3
:
601 case CECDEVICE_RECORDINGDEVICE1
:
603 case CECDEVICE_RECORDINGDEVICE2
:
605 case CECDEVICE_RECORDINGDEVICE3
:
607 case CECDEVICE_RESERVED1
:
609 case CECDEVICE_RESERVED2
:
611 case CECDEVICE_TUNER1
:
613 case CECDEVICE_TUNER2
:
615 case CECDEVICE_TUNER3
:
617 case CECDEVICE_TUNER4
:
626 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
630 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
631 return "skip forward wind";
632 case CEC_DECK_CONTROL_MODE_EJECT
:
634 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
635 return "reverse rewind";
636 case CEC_DECK_CONTROL_MODE_STOP
:
643 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
647 case CEC_DECK_INFO_PLAY
:
649 case CEC_DECK_INFO_RECORD
:
651 case CEC_DECK_INFO_PLAY_REVERSE
:
652 return "play reverse";
653 case CEC_DECK_INFO_STILL
:
655 case CEC_DECK_INFO_SLOW
:
657 case CEC_DECK_INFO_SLOW_REVERSE
:
658 return "slow reverse";
659 case CEC_DECK_INFO_FAST_FORWARD
:
660 return "fast forward";
661 case CEC_DECK_INFO_FAST_REVERSE
:
662 return "fast reverse";
663 case CEC_DECK_INFO_NO_MEDIA
:
665 case CEC_DECK_INFO_STOP
:
667 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
668 return "info skip forward wind";
669 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
670 return "info skip reverse rewind";
671 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
672 return "info index search forward";
673 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
674 return "info index search reverse";
675 case CEC_DECK_INFO_OTHER_STATUS
:
682 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
686 case CEC_OPCODE_ACTIVE_SOURCE
:
687 return "active source";
688 case CEC_OPCODE_IMAGE_VIEW_ON
:
689 return "image view on";
690 case CEC_OPCODE_TEXT_VIEW_ON
:
691 return "text view on";
692 case CEC_OPCODE_INACTIVE_SOURCE
:
693 return "inactive source";
694 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
695 return "request active source";
696 case CEC_OPCODE_ROUTING_CHANGE
:
697 return "routing change";
698 case CEC_OPCODE_ROUTING_INFORMATION
:
699 return "routing information";
700 case CEC_OPCODE_SET_STREAM_PATH
:
701 return "set stream path";
702 case CEC_OPCODE_STANDBY
:
704 case CEC_OPCODE_RECORD_OFF
:
706 case CEC_OPCODE_RECORD_ON
:
708 case CEC_OPCODE_RECORD_STATUS
:
709 return "record status";
710 case CEC_OPCODE_RECORD_TV_SCREEN
:
711 return "record tv screen";
712 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
713 return "clear analogue timer";
714 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
715 return "clear digital timer";
716 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
717 return "clear external timer";
718 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
719 return "set analogue timer";
720 case CEC_OPCODE_SET_DIGITAL_TIMER
:
721 return "set digital timer";
722 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
723 return "set external timer";
724 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
725 return "set timer program title";
726 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
727 return "timer cleared status";
728 case CEC_OPCODE_TIMER_STATUS
:
729 return "timer status";
730 case CEC_OPCODE_CEC_VERSION
:
731 return "cec version";
732 case CEC_OPCODE_GET_CEC_VERSION
:
733 return "get cec version";
734 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
735 return "give physical address";
736 case CEC_OPCODE_GET_MENU_LANGUAGE
:
737 return "get menu language";
738 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
739 return "report physical address";
740 case CEC_OPCODE_SET_MENU_LANGUAGE
:
741 return "set menu language";
742 case CEC_OPCODE_DECK_CONTROL
:
743 return "deck control";
744 case CEC_OPCODE_DECK_STATUS
:
745 return "deck status";
746 case CEC_OPCODE_GIVE_DECK_STATUS
:
747 return "give deck status";
748 case CEC_OPCODE_PLAY
:
750 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
751 return "give tuner status";
752 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
753 return "select analogue service";
754 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
755 return "set digital service";
756 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
757 return "tuner device status";
758 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
759 return "tuner step decrement";
760 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
761 return "tuner step increment";
762 case CEC_OPCODE_DEVICE_VENDOR_ID
:
763 return "device vendor id";
764 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
765 return "give device vendor id";
766 case CEC_OPCODE_VENDOR_COMMAND
:
767 return "vendor command";
768 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
769 return "vendor command with id";
770 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
771 return "vendor remote button down";
772 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
773 return "vendor remote button up";
774 case CEC_OPCODE_SET_OSD_STRING
:
775 return "set osd string";
776 case CEC_OPCODE_GIVE_OSD_NAME
:
777 return "give osd name";
778 case CEC_OPCODE_SET_OSD_NAME
:
779 return "set osd name";
780 case CEC_OPCODE_MENU_REQUEST
:
781 return "menu request";
782 case CEC_OPCODE_MENU_STATUS
:
783 return "menu status";
784 case CEC_OPCODE_USER_CONTROL_PRESSED
:
785 return "user control pressed";
786 case CEC_OPCODE_USER_CONTROL_RELEASE
:
787 return "user control release";
788 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
789 return "give device power status";
790 case CEC_OPCODE_REPORT_POWER_STATUS
:
791 return "report power status";
792 case CEC_OPCODE_FEATURE_ABORT
:
793 return "feature abort";
794 case CEC_OPCODE_ABORT
:
796 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
797 return "give audio status";
798 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
799 return "give audio mode status";
800 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
801 return "report audio status";
802 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
803 return "set system audio mode";
804 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
805 return "system audio mode request";
806 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
807 return "system audio mode status";
808 case CEC_OPCODE_SET_AUDIO_RATE
:
809 return "set audio rate";
815 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
819 case CEC_SYSTEM_AUDIO_STATUS_ON
:
821 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
828 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
830 // TODO this is a mask
834 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
838 case CEC_VENDOR_SAMSUNG
:
842 case CEC_VENDOR_PANASONIC
:
844 case CEC_VENDOR_PIONEER
:
846 case CEC_VENDOR_ONKYO
: