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
);
132 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
133 HandleReportAudioStatus(command
);
135 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
136 HandleSystemAudioStatus(command
);
138 case CEC_OPCODE_SET_OSD_NAME
:
139 HandleSetOSDName(command
);
142 UnhandledCommand(command
);
147 if (command
.destination
== CECDEVICE_BROADCAST
|| m_busDevice
->MyLogicalAddressContains(command
.destination
))
148 m_busDevice
->GetProcessor()->AddCommand(command
);
153 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
155 if (command
.parameters
.size
== 2)
157 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
158 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
164 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
166 CCECBusDevice
*device
= GetDevice(command
.destination
);
167 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) && command
.parameters
.size
> 0)
169 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
176 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
178 if (command
.parameters
.size
== 1)
180 CCECBusDevice
*device
= GetDevice(command
.initiator
);
182 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
188 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
190 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
191 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
196 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
198 SetVendorId(command
);
202 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
204 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
206 CCECBusDevice
*device
= GetDevice(command
.destination
);
208 return device
->TransmitCECVersion(command
.initiator
);
214 bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command
&command
)
216 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
218 CCECBusDevice
*device
= GetDevice(command
.destination
);
219 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
220 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
226 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
228 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
230 CCECBusDevice
*device
= GetDevice(command
.destination
);
231 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
))
232 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
238 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
240 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
242 CCECBusDevice
*device
= GetDevice(command
.destination
);
244 return device
->TransmitPowerState(command
.initiator
);
250 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
252 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
254 CCECBusDevice
*device
= GetDevice(command
.destination
);
256 return device
->TransmitVendorID(command
.initiator
);
262 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
264 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
266 CCECBusDevice
*device
= GetDevice(command
.destination
);
268 return device
->TransmitOSDName(command
.initiator
);
274 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
276 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
278 CCECBusDevice
*device
= GetDevice(command
.destination
);
280 return device
->TransmitPhysicalAddress();
286 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
288 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
290 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
292 CCECBusDevice
*device
= GetDevice(command
.destination
);
294 return device
->TransmitMenuState(command
.initiator
);
301 bool CCECCommandHandler::HandleReportAudioStatus(const cec_command
&command
)
303 if (command
.parameters
.size
== 1)
305 CCECBusDevice
*device
= GetDevice(command
.initiator
);
306 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
308 ((CCECAudioSystem
*)device
)->SetAudioStatus(command
.parameters
[0]);
315 bool CCECCommandHandler::HandleReportPhysicalAddress(const cec_command
&command
)
317 if (command
.parameters
.size
== 3)
319 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
320 cec_device_type type
= (cec_device_type
)command
.parameters
[2];
322 CCECBusDevice
*device
= GetDevice(command
.initiator
);
323 if (device
&& device
->GetType() == type
)
324 device
->SetPhysicalAddress(iNewAddress
);
329 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
331 if (command
.parameters
.size
== 1)
333 CCECBusDevice
*device
= GetDevice(command
.initiator
);
335 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
340 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
343 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
344 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
346 vector
<CCECBusDevice
*> devices
;
347 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
348 devices
[iDevicePtr
]->TransmitActiveSource();
353 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
355 if (command
.parameters
.size
== 4)
357 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
358 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
360 CCECBusDevice
*device
= GetDevice(command
.initiator
);
362 device
->SetStreamPath(iNewAddress
, iOldAddress
);
367 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
369 if (command
.parameters
.size
== 2)
371 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
373 CCECBusDevice
*device
= GetDevice(command
.initiator
);
376 device
->SetPhysicalAddress(iNewAddress
);
384 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
386 if (command
.parameters
.size
== 3)
388 CCECBusDevice
*device
= GetDevice(command
.initiator
);
391 cec_menu_language language
;
392 language
.device
= command
.initiator
;
393 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
394 language
.language
[iPtr
] = command
.parameters
[iPtr
];
395 language
.language
[3] = 0;
396 device
->SetMenuLanguage(language
);
403 bool CCECCommandHandler::HandleSetOSDName(const cec_command
&command
)
405 if (command
.parameters
.size
> 0)
407 CCECBusDevice
*device
= GetDevice(command
.initiator
);
411 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
412 buf
[iPtr
] = (char)command
.parameters
[iPtr
];
413 buf
[command
.parameters
.size
] = 0;
415 CStdString
strName(buf
);
416 device
->SetOSDName(strName
);
424 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
426 if (command
.parameters
.size
>= 2)
428 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
430 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
431 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
433 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
435 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
438 return device
->TransmitActiveSource() &&
439 device
->TransmitMenuState(command
.initiator
);
446 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
448 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
450 CCECBusDevice
*device
= GetDevice(command
.destination
);
451 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
452 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
457 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
459 CCECBusDevice
*device
= GetDevice(command
.initiator
);
461 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
466 bool CCECCommandHandler::HandleSystemAudioStatus(const cec_command
&command
)
468 CCECBusDevice
*device
= GetDevice(command
.initiator
);
469 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
471 ((CCECAudioSystem
*)device
)->SetSystemAudioMode(command
);
478 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
480 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
482 CCECBusDevice
*device
= GetDevice(command
.destination
);
483 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
484 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
490 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
492 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
494 m_busDevice
->GetProcessor()->AddKey();
496 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
499 strLog
.Format("key pressed: %x", command
.parameters
[0]);
500 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
502 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
503 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
505 CCECBusDevice
*device
= GetDevice(command
.destination
);
507 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
510 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
517 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
519 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
520 m_busDevice
->GetProcessor()->AddKey();
525 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
528 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
529 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
532 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
534 unsigned int iReturn(0);
536 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
537 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
541 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
549 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
551 CCECBusDevice
*device
= NULL
;
553 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
554 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
559 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
561 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
564 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
566 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
569 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
571 if (command
.parameters
.size
< 3)
573 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
577 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
578 ((uint64_t)command
.parameters
[1] << 8) +
579 (uint64_t)command
.parameters
[2];
581 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
583 device
->SetVendorId(iVendorId
);
586 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
590 case CEC_MENU_STATE_ACTIVATED
:
592 case CEC_MENU_STATE_DEACTIVATED
:
593 return "deactivated";
599 const char *CCECCommandHandler::ToString(const cec_version version
)
603 case CEC_VERSION_1_2
:
605 case CEC_VERSION_1_2A
:
607 case CEC_VERSION_1_3
:
609 case CEC_VERSION_1_3A
:
611 case CEC_VERSION_1_4
:
618 const char *CCECCommandHandler::ToString(const cec_power_status status
)
622 case CEC_POWER_STATUS_ON
:
624 case CEC_POWER_STATUS_STANDBY
:
626 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
627 return "in transition from on to standby";
628 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
629 return "in transition from standby to on";
635 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
639 case CECDEVICE_AUDIOSYSTEM
:
641 case CECDEVICE_BROADCAST
:
643 case CECDEVICE_FREEUSE
:
645 case CECDEVICE_PLAYBACKDEVICE1
:
647 case CECDEVICE_PLAYBACKDEVICE2
:
649 case CECDEVICE_PLAYBACKDEVICE3
:
651 case CECDEVICE_RECORDINGDEVICE1
:
653 case CECDEVICE_RECORDINGDEVICE2
:
655 case CECDEVICE_RECORDINGDEVICE3
:
657 case CECDEVICE_RESERVED1
:
659 case CECDEVICE_RESERVED2
:
661 case CECDEVICE_TUNER1
:
663 case CECDEVICE_TUNER2
:
665 case CECDEVICE_TUNER3
:
667 case CECDEVICE_TUNER4
:
676 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
680 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
681 return "skip forward wind";
682 case CEC_DECK_CONTROL_MODE_EJECT
:
684 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
685 return "reverse rewind";
686 case CEC_DECK_CONTROL_MODE_STOP
:
693 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
697 case CEC_DECK_INFO_PLAY
:
699 case CEC_DECK_INFO_RECORD
:
701 case CEC_DECK_INFO_PLAY_REVERSE
:
702 return "play reverse";
703 case CEC_DECK_INFO_STILL
:
705 case CEC_DECK_INFO_SLOW
:
707 case CEC_DECK_INFO_SLOW_REVERSE
:
708 return "slow reverse";
709 case CEC_DECK_INFO_FAST_FORWARD
:
710 return "fast forward";
711 case CEC_DECK_INFO_FAST_REVERSE
:
712 return "fast reverse";
713 case CEC_DECK_INFO_NO_MEDIA
:
715 case CEC_DECK_INFO_STOP
:
717 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
718 return "info skip forward wind";
719 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
720 return "info skip reverse rewind";
721 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
722 return "info index search forward";
723 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
724 return "info index search reverse";
725 case CEC_DECK_INFO_OTHER_STATUS
:
732 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
736 case CEC_OPCODE_ACTIVE_SOURCE
:
737 return "active source";
738 case CEC_OPCODE_IMAGE_VIEW_ON
:
739 return "image view on";
740 case CEC_OPCODE_TEXT_VIEW_ON
:
741 return "text view on";
742 case CEC_OPCODE_INACTIVE_SOURCE
:
743 return "inactive source";
744 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
745 return "request active source";
746 case CEC_OPCODE_ROUTING_CHANGE
:
747 return "routing change";
748 case CEC_OPCODE_ROUTING_INFORMATION
:
749 return "routing information";
750 case CEC_OPCODE_SET_STREAM_PATH
:
751 return "set stream path";
752 case CEC_OPCODE_STANDBY
:
754 case CEC_OPCODE_RECORD_OFF
:
756 case CEC_OPCODE_RECORD_ON
:
758 case CEC_OPCODE_RECORD_STATUS
:
759 return "record status";
760 case CEC_OPCODE_RECORD_TV_SCREEN
:
761 return "record tv screen";
762 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
763 return "clear analogue timer";
764 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
765 return "clear digital timer";
766 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
767 return "clear external timer";
768 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
769 return "set analogue timer";
770 case CEC_OPCODE_SET_DIGITAL_TIMER
:
771 return "set digital timer";
772 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
773 return "set external timer";
774 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
775 return "set timer program title";
776 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
777 return "timer cleared status";
778 case CEC_OPCODE_TIMER_STATUS
:
779 return "timer status";
780 case CEC_OPCODE_CEC_VERSION
:
781 return "cec version";
782 case CEC_OPCODE_GET_CEC_VERSION
:
783 return "get cec version";
784 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
785 return "give physical address";
786 case CEC_OPCODE_GET_MENU_LANGUAGE
:
787 return "get menu language";
788 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
789 return "report physical address";
790 case CEC_OPCODE_SET_MENU_LANGUAGE
:
791 return "set menu language";
792 case CEC_OPCODE_DECK_CONTROL
:
793 return "deck control";
794 case CEC_OPCODE_DECK_STATUS
:
795 return "deck status";
796 case CEC_OPCODE_GIVE_DECK_STATUS
:
797 return "give deck status";
798 case CEC_OPCODE_PLAY
:
800 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
801 return "give tuner status";
802 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
803 return "select analogue service";
804 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
805 return "set digital service";
806 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
807 return "tuner device status";
808 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
809 return "tuner step decrement";
810 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
811 return "tuner step increment";
812 case CEC_OPCODE_DEVICE_VENDOR_ID
:
813 return "device vendor id";
814 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
815 return "give device vendor id";
816 case CEC_OPCODE_VENDOR_COMMAND
:
817 return "vendor command";
818 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
819 return "vendor command with id";
820 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
821 return "vendor remote button down";
822 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
823 return "vendor remote button up";
824 case CEC_OPCODE_SET_OSD_STRING
:
825 return "set osd string";
826 case CEC_OPCODE_GIVE_OSD_NAME
:
827 return "give osd name";
828 case CEC_OPCODE_SET_OSD_NAME
:
829 return "set osd name";
830 case CEC_OPCODE_MENU_REQUEST
:
831 return "menu request";
832 case CEC_OPCODE_MENU_STATUS
:
833 return "menu status";
834 case CEC_OPCODE_USER_CONTROL_PRESSED
:
835 return "user control pressed";
836 case CEC_OPCODE_USER_CONTROL_RELEASE
:
837 return "user control release";
838 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
839 return "give device power status";
840 case CEC_OPCODE_REPORT_POWER_STATUS
:
841 return "report power status";
842 case CEC_OPCODE_FEATURE_ABORT
:
843 return "feature abort";
844 case CEC_OPCODE_ABORT
:
846 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
847 return "give audio status";
848 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
849 return "give audio mode status";
850 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
851 return "report audio status";
852 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
853 return "set system audio mode";
854 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
855 return "system audio mode request";
856 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
857 return "system audio mode status";
858 case CEC_OPCODE_SET_AUDIO_RATE
:
859 return "set audio rate";
865 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
869 case CEC_SYSTEM_AUDIO_STATUS_ON
:
871 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
878 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
880 // TODO this is a mask
884 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
888 case CEC_VENDOR_SAMSUNG
:
892 case CEC_VENDOR_PANASONIC
:
894 case CEC_VENDOR_PIONEER
:
896 case CEC_VENDOR_ONKYO
: