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
);
141 case CEC_OPCODE_IMAGE_VIEW_ON
:
142 HandleImageViewOn(command
);
144 case CEC_OPCODE_TEXT_VIEW_ON
:
145 HandleTextViewOn(command
);
148 UnhandledCommand(command
);
153 if (command
.destination
== CECDEVICE_BROADCAST
|| m_busDevice
->MyLogicalAddressContains(command
.destination
))
154 m_busDevice
->GetProcessor()->AddCommand(command
);
159 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
161 if (command
.parameters
.size
== 2)
163 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
164 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
170 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
172 CCECBusDevice
*device
= GetDevice(command
.destination
);
173 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) && command
.parameters
.size
> 0)
175 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
182 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
184 if (command
.parameters
.size
== 1)
186 CCECBusDevice
*device
= GetDevice(command
.initiator
);
188 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
194 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
196 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
197 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
202 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
204 SetVendorId(command
);
208 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
210 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
212 CCECBusDevice
*device
= GetDevice(command
.destination
);
214 return device
->TransmitCECVersion(command
.initiator
);
220 bool CCECCommandHandler::HandleGiveAudioStatus(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_AUDIO_SYSTEM
)
226 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
232 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
234 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
236 CCECBusDevice
*device
= GetDevice(command
.destination
);
237 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
))
238 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
244 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
246 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
248 CCECBusDevice
*device
= GetDevice(command
.destination
);
250 return device
->TransmitPowerState(command
.initiator
);
256 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
258 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
260 CCECBusDevice
*device
= GetDevice(command
.destination
);
262 return device
->TransmitVendorID(command
.initiator
);
268 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
270 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
272 CCECBusDevice
*device
= GetDevice(command
.destination
);
274 return device
->TransmitOSDName(command
.initiator
);
280 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
282 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
284 CCECBusDevice
*device
= GetDevice(command
.destination
);
286 return device
->TransmitPhysicalAddress();
292 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
294 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
296 CCECBusDevice
*device
= GetDevice(command
.destination
);
297 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
298 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
304 bool CCECCommandHandler::HandleImageViewOn(const cec_command
&command
)
306 m_busDevice
->GetProcessor()->SetActiveSource(command
.initiator
);
310 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
312 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
314 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
316 CCECBusDevice
*device
= GetDevice(command
.destination
);
318 return device
->TransmitMenuState(command
.initiator
);
325 bool CCECCommandHandler::HandleReportAudioStatus(const cec_command
&command
)
327 if (command
.parameters
.size
== 1)
329 CCECBusDevice
*device
= GetDevice(command
.initiator
);
330 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
332 ((CCECAudioSystem
*)device
)->SetAudioStatus(command
.parameters
[0]);
339 bool CCECCommandHandler::HandleReportPhysicalAddress(const cec_command
&command
)
341 if (command
.parameters
.size
== 3)
343 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
344 cec_device_type type
= (cec_device_type
)command
.parameters
[2];
346 CCECBusDevice
*device
= GetDevice(command
.initiator
);
347 if (device
&& device
->GetType() == type
)
348 device
->SetPhysicalAddress(iNewAddress
);
353 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
355 if (command
.parameters
.size
== 1)
357 CCECBusDevice
*device
= GetDevice(command
.initiator
);
359 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
364 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
367 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
368 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
370 vector
<CCECBusDevice
*> devices
;
371 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
372 devices
[iDevicePtr
]->TransmitActiveSource();
377 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
379 if (command
.parameters
.size
== 4)
381 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
382 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
384 CCECBusDevice
*device
= GetDevice(command
.initiator
);
386 device
->SetStreamPath(iNewAddress
, iOldAddress
);
391 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
393 if (command
.parameters
.size
== 2)
395 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
397 CCECBusDevice
*device
= GetDevice(command
.initiator
);
400 device
->SetStreamPath(iNewAddress
);
408 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
410 if (command
.parameters
.size
== 3)
412 CCECBusDevice
*device
= GetDevice(command
.initiator
);
415 cec_menu_language language
;
416 language
.device
= command
.initiator
;
417 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
418 language
.language
[iPtr
] = command
.parameters
[iPtr
];
419 language
.language
[3] = 0;
420 device
->SetMenuLanguage(language
);
427 bool CCECCommandHandler::HandleSetOSDName(const cec_command
&command
)
429 if (command
.parameters
.size
> 0)
431 CCECBusDevice
*device
= GetDevice(command
.initiator
);
435 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
436 buf
[iPtr
] = (char)command
.parameters
[iPtr
];
437 buf
[command
.parameters
.size
] = 0;
439 CStdString
strName(buf
);
440 device
->SetOSDName(strName
);
448 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
450 if (command
.parameters
.size
>= 2)
452 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
454 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
455 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
457 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
459 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
462 return device
->TransmitActiveSource() &&
463 device
->TransmitMenuState(command
.initiator
);
470 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
472 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
474 CCECBusDevice
*device
= GetDevice(command
.destination
);
475 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
476 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
481 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
483 CCECBusDevice
*device
= GetDevice(command
.initiator
);
485 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
490 bool CCECCommandHandler::HandleSystemAudioStatus(const cec_command
&command
)
492 CCECBusDevice
*device
= GetDevice(command
.initiator
);
493 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
495 ((CCECAudioSystem
*)device
)->SetSystemAudioMode(command
);
502 bool CCECCommandHandler::HandleTextViewOn(const cec_command
&command
)
504 m_busDevice
->GetProcessor()->SetActiveSource(command
.initiator
);
508 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
510 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
512 m_busDevice
->GetProcessor()->AddKey();
514 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
517 strLog
.Format("key pressed: %x", command
.parameters
[0]);
518 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
520 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
521 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
523 CCECBusDevice
*device
= GetDevice(command
.destination
);
525 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
528 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
535 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
537 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
538 m_busDevice
->GetProcessor()->AddKey();
543 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
546 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
547 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
550 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
552 unsigned int iReturn(0);
554 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
555 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
559 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
567 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
569 CCECBusDevice
*device
= NULL
;
571 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
572 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
577 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
579 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
582 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
584 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
587 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
589 if (command
.parameters
.size
< 3)
591 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
595 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
596 ((uint64_t)command
.parameters
[1] << 8) +
597 (uint64_t)command
.parameters
[2];
599 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
601 device
->SetVendorId(iVendorId
);
604 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
608 case CEC_MENU_STATE_ACTIVATED
:
610 case CEC_MENU_STATE_DEACTIVATED
:
611 return "deactivated";
617 const char *CCECCommandHandler::ToString(const cec_version version
)
621 case CEC_VERSION_1_2
:
623 case CEC_VERSION_1_2A
:
625 case CEC_VERSION_1_3
:
627 case CEC_VERSION_1_3A
:
629 case CEC_VERSION_1_4
:
636 const char *CCECCommandHandler::ToString(const cec_power_status status
)
640 case CEC_POWER_STATUS_ON
:
642 case CEC_POWER_STATUS_STANDBY
:
644 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
645 return "in transition from on to standby";
646 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
647 return "in transition from standby to on";
653 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
657 case CECDEVICE_AUDIOSYSTEM
:
659 case CECDEVICE_BROADCAST
:
661 case CECDEVICE_FREEUSE
:
663 case CECDEVICE_PLAYBACKDEVICE1
:
665 case CECDEVICE_PLAYBACKDEVICE2
:
667 case CECDEVICE_PLAYBACKDEVICE3
:
669 case CECDEVICE_RECORDINGDEVICE1
:
671 case CECDEVICE_RECORDINGDEVICE2
:
673 case CECDEVICE_RECORDINGDEVICE3
:
675 case CECDEVICE_RESERVED1
:
677 case CECDEVICE_RESERVED2
:
679 case CECDEVICE_TUNER1
:
681 case CECDEVICE_TUNER2
:
683 case CECDEVICE_TUNER3
:
685 case CECDEVICE_TUNER4
:
694 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
698 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
699 return "skip forward wind";
700 case CEC_DECK_CONTROL_MODE_EJECT
:
702 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
703 return "reverse rewind";
704 case CEC_DECK_CONTROL_MODE_STOP
:
711 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
715 case CEC_DECK_INFO_PLAY
:
717 case CEC_DECK_INFO_RECORD
:
719 case CEC_DECK_INFO_PLAY_REVERSE
:
720 return "play reverse";
721 case CEC_DECK_INFO_STILL
:
723 case CEC_DECK_INFO_SLOW
:
725 case CEC_DECK_INFO_SLOW_REVERSE
:
726 return "slow reverse";
727 case CEC_DECK_INFO_FAST_FORWARD
:
728 return "fast forward";
729 case CEC_DECK_INFO_FAST_REVERSE
:
730 return "fast reverse";
731 case CEC_DECK_INFO_NO_MEDIA
:
733 case CEC_DECK_INFO_STOP
:
735 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
736 return "info skip forward wind";
737 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
738 return "info skip reverse rewind";
739 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
740 return "info index search forward";
741 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
742 return "info index search reverse";
743 case CEC_DECK_INFO_OTHER_STATUS
:
750 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
754 case CEC_OPCODE_ACTIVE_SOURCE
:
755 return "active source";
756 case CEC_OPCODE_IMAGE_VIEW_ON
:
757 return "image view on";
758 case CEC_OPCODE_TEXT_VIEW_ON
:
759 return "text view on";
760 case CEC_OPCODE_INACTIVE_SOURCE
:
761 return "inactive source";
762 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
763 return "request active source";
764 case CEC_OPCODE_ROUTING_CHANGE
:
765 return "routing change";
766 case CEC_OPCODE_ROUTING_INFORMATION
:
767 return "routing information";
768 case CEC_OPCODE_SET_STREAM_PATH
:
769 return "set stream path";
770 case CEC_OPCODE_STANDBY
:
772 case CEC_OPCODE_RECORD_OFF
:
774 case CEC_OPCODE_RECORD_ON
:
776 case CEC_OPCODE_RECORD_STATUS
:
777 return "record status";
778 case CEC_OPCODE_RECORD_TV_SCREEN
:
779 return "record tv screen";
780 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
781 return "clear analogue timer";
782 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
783 return "clear digital timer";
784 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
785 return "clear external timer";
786 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
787 return "set analogue timer";
788 case CEC_OPCODE_SET_DIGITAL_TIMER
:
789 return "set digital timer";
790 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
791 return "set external timer";
792 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
793 return "set timer program title";
794 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
795 return "timer cleared status";
796 case CEC_OPCODE_TIMER_STATUS
:
797 return "timer status";
798 case CEC_OPCODE_CEC_VERSION
:
799 return "cec version";
800 case CEC_OPCODE_GET_CEC_VERSION
:
801 return "get cec version";
802 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
803 return "give physical address";
804 case CEC_OPCODE_GET_MENU_LANGUAGE
:
805 return "get menu language";
806 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
807 return "report physical address";
808 case CEC_OPCODE_SET_MENU_LANGUAGE
:
809 return "set menu language";
810 case CEC_OPCODE_DECK_CONTROL
:
811 return "deck control";
812 case CEC_OPCODE_DECK_STATUS
:
813 return "deck status";
814 case CEC_OPCODE_GIVE_DECK_STATUS
:
815 return "give deck status";
816 case CEC_OPCODE_PLAY
:
818 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
819 return "give tuner status";
820 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
821 return "select analogue service";
822 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
823 return "set digital service";
824 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
825 return "tuner device status";
826 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
827 return "tuner step decrement";
828 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
829 return "tuner step increment";
830 case CEC_OPCODE_DEVICE_VENDOR_ID
:
831 return "device vendor id";
832 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
833 return "give device vendor id";
834 case CEC_OPCODE_VENDOR_COMMAND
:
835 return "vendor command";
836 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
837 return "vendor command with id";
838 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
839 return "vendor remote button down";
840 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
841 return "vendor remote button up";
842 case CEC_OPCODE_SET_OSD_STRING
:
843 return "set osd string";
844 case CEC_OPCODE_GIVE_OSD_NAME
:
845 return "give osd name";
846 case CEC_OPCODE_SET_OSD_NAME
:
847 return "set osd name";
848 case CEC_OPCODE_MENU_REQUEST
:
849 return "menu request";
850 case CEC_OPCODE_MENU_STATUS
:
851 return "menu status";
852 case CEC_OPCODE_USER_CONTROL_PRESSED
:
853 return "user control pressed";
854 case CEC_OPCODE_USER_CONTROL_RELEASE
:
855 return "user control release";
856 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
857 return "give device power status";
858 case CEC_OPCODE_REPORT_POWER_STATUS
:
859 return "report power status";
860 case CEC_OPCODE_FEATURE_ABORT
:
861 return "feature abort";
862 case CEC_OPCODE_ABORT
:
864 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
865 return "give audio status";
866 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
867 return "give audio mode status";
868 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
869 return "report audio status";
870 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
871 return "set system audio mode";
872 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
873 return "system audio mode request";
874 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
875 return "system audio mode status";
876 case CEC_OPCODE_SET_AUDIO_RATE
:
877 return "set audio rate";
883 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
887 case CEC_SYSTEM_AUDIO_STATUS_ON
:
889 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
896 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
898 // TODO this is a mask
902 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
906 case CEC_VENDOR_SAMSUNG
:
910 case CEC_VENDOR_PANASONIC
:
912 case CEC_VENDOR_PIONEER
:
914 case CEC_VENDOR_ONKYO
: