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
== 2)
303 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
305 CCECBusDevice
*device
= GetDevice(command
.initiator
);
307 device
->SetPhysicalAddress(iNewAddress
);
312 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
314 if (command
.parameters
.size
== 1)
316 CCECBusDevice
*device
= GetDevice(command
.initiator
);
318 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
323 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
326 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
327 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
329 vector
<CCECBusDevice
*> devices
;
330 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
331 devices
[iDevicePtr
]->TransmitActiveSource();
336 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
338 if (command
.parameters
.size
== 4)
340 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
341 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
343 CCECBusDevice
*device
= GetDevice(command
.initiator
);
345 device
->SetStreamPath(iNewAddress
, iOldAddress
);
350 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
352 if (command
.parameters
.size
== 2)
354 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
356 CCECBusDevice
*device
= GetDevice(command
.initiator
);
358 device
->SetPhysicalAddress(iNewAddress
);
362 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
364 if (command
.parameters
.size
== 3)
366 CCECBusDevice
*device
= GetDevice(command
.initiator
);
369 cec_menu_language language
;
370 language
.device
= command
.initiator
;
371 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
372 language
.language
[iPtr
] = command
.parameters
[iPtr
];
373 language
.language
[3] = 0;
374 device
->SetMenuLanguage(language
);
376 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
377 m_busDevice
->GetProcessor()->AddCommand(command
);
383 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
385 if (command
.parameters
.size
>= 2)
387 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
389 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
390 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
392 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
394 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
397 return device
->TransmitActiveSource() &&
398 device
->TransmitMenuState(command
.initiator
);
406 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
408 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
410 CCECBusDevice
*device
= GetDevice(command
.destination
);
411 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
412 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
417 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
419 CCECBusDevice
*device
= GetDevice(command
.initiator
);
421 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
423 m_busDevice
->GetProcessor()->AddCommand(command
);
428 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
430 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
432 CCECBusDevice
*device
= GetDevice(command
.destination
);
433 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
434 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
440 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
442 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
444 m_busDevice
->GetProcessor()->AddKey();
446 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
449 strLog
.Format("key pressed: %x", command
.parameters
[0]);
450 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
452 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
453 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
455 CCECBusDevice
*device
= GetDevice(command
.destination
);
457 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
460 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
466 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
468 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
469 m_busDevice
->GetProcessor()->AddKey();
474 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
477 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
478 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
481 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
483 unsigned int iReturn(0);
485 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
486 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
490 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
498 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
500 CCECBusDevice
*device
= NULL
;
502 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
503 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
508 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
510 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
513 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
515 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
518 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
520 if (command
.parameters
.size
< 3)
522 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
526 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
527 ((uint64_t)command
.parameters
[1] << 8) +
528 (uint64_t)command
.parameters
[2];
530 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
532 device
->SetVendorId(iVendorId
);
535 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
539 case CEC_MENU_STATE_ACTIVATED
:
541 case CEC_MENU_STATE_DEACTIVATED
:
542 return "deactivated";
548 const char *CCECCommandHandler::ToString(const cec_version version
)
552 case CEC_VERSION_1_2
:
554 case CEC_VERSION_1_2A
:
556 case CEC_VERSION_1_3
:
558 case CEC_VERSION_1_3A
:
560 case CEC_VERSION_1_4
:
567 const char *CCECCommandHandler::ToString(const cec_power_status status
)
571 case CEC_POWER_STATUS_ON
:
573 case CEC_POWER_STATUS_STANDBY
:
575 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
576 return "in transition from on to standby";
577 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
578 return "in transition from standby to on";
584 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
588 case CECDEVICE_AUDIOSYSTEM
:
590 case CECDEVICE_BROADCAST
:
592 case CECDEVICE_FREEUSE
:
594 case CECDEVICE_PLAYBACKDEVICE1
:
596 case CECDEVICE_PLAYBACKDEVICE2
:
598 case CECDEVICE_PLAYBACKDEVICE3
:
600 case CECDEVICE_RECORDINGDEVICE1
:
602 case CECDEVICE_RECORDINGDEVICE2
:
604 case CECDEVICE_RECORDINGDEVICE3
:
606 case CECDEVICE_RESERVED1
:
608 case CECDEVICE_RESERVED2
:
610 case CECDEVICE_TUNER1
:
612 case CECDEVICE_TUNER2
:
614 case CECDEVICE_TUNER3
:
616 case CECDEVICE_TUNER4
:
625 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
629 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
630 return "skip forward wind";
631 case CEC_DECK_CONTROL_MODE_EJECT
:
633 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
634 return "reverse rewind";
635 case CEC_DECK_CONTROL_MODE_STOP
:
642 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
646 case CEC_DECK_INFO_PLAY
:
648 case CEC_DECK_INFO_RECORD
:
650 case CEC_DECK_INFO_PLAY_REVERSE
:
651 return "play reverse";
652 case CEC_DECK_INFO_STILL
:
654 case CEC_DECK_INFO_SLOW
:
656 case CEC_DECK_INFO_SLOW_REVERSE
:
657 return "slow reverse";
658 case CEC_DECK_INFO_FAST_FORWARD
:
659 return "fast forward";
660 case CEC_DECK_INFO_FAST_REVERSE
:
661 return "fast reverse";
662 case CEC_DECK_INFO_NO_MEDIA
:
664 case CEC_DECK_INFO_STOP
:
666 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
667 return "info skip forward wind";
668 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
669 return "info skip reverse rewind";
670 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
671 return "info index search forward";
672 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
673 return "info index search reverse";
674 case CEC_DECK_INFO_OTHER_STATUS
:
681 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
685 case CEC_OPCODE_ACTIVE_SOURCE
:
686 return "active source";
687 case CEC_OPCODE_IMAGE_VIEW_ON
:
688 return "image view on";
689 case CEC_OPCODE_TEXT_VIEW_ON
:
690 return "text view on";
691 case CEC_OPCODE_INACTIVE_SOURCE
:
692 return "inactive source";
693 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
694 return "request active source";
695 case CEC_OPCODE_ROUTING_CHANGE
:
696 return "routing change";
697 case CEC_OPCODE_ROUTING_INFORMATION
:
698 return "routing information";
699 case CEC_OPCODE_SET_STREAM_PATH
:
700 return "set stream path";
701 case CEC_OPCODE_STANDBY
:
703 case CEC_OPCODE_RECORD_OFF
:
705 case CEC_OPCODE_RECORD_ON
:
707 case CEC_OPCODE_RECORD_STATUS
:
708 return "record status";
709 case CEC_OPCODE_RECORD_TV_SCREEN
:
710 return "record tv screen";
711 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
712 return "clear analogue timer";
713 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
714 return "clear digital timer";
715 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
716 return "clear external timer";
717 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
718 return "set analogue timer";
719 case CEC_OPCODE_SET_DIGITAL_TIMER
:
720 return "set digital timer";
721 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
722 return "set external timer";
723 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
724 return "set timer program title";
725 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
726 return "timer cleared status";
727 case CEC_OPCODE_TIMER_STATUS
:
728 return "timer status";
729 case CEC_OPCODE_CEC_VERSION
:
730 return "cec version";
731 case CEC_OPCODE_GET_CEC_VERSION
:
732 return "get cec version";
733 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
734 return "give physical address";
735 case CEC_OPCODE_GET_MENU_LANGUAGE
:
736 return "get menu language";
737 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
738 return "report physical address";
739 case CEC_OPCODE_SET_MENU_LANGUAGE
:
740 return "set menu language";
741 case CEC_OPCODE_DECK_CONTROL
:
742 return "deck control";
743 case CEC_OPCODE_DECK_STATUS
:
744 return "deck status";
745 case CEC_OPCODE_GIVE_DECK_STATUS
:
746 return "give deck status";
747 case CEC_OPCODE_PLAY
:
749 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
750 return "give tuner status";
751 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
752 return "select analogue service";
753 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
754 return "set digital service";
755 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
756 return "tuner device status";
757 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
758 return "tuner step decrement";
759 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
760 return "tuner step increment";
761 case CEC_OPCODE_DEVICE_VENDOR_ID
:
762 return "device vendor id";
763 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
764 return "give device vendor id";
765 case CEC_OPCODE_VENDOR_COMMAND
:
766 return "vendor command";
767 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
768 return "vendor command with id";
769 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
770 return "vendor remote button down";
771 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
772 return "vendor remote button up";
773 case CEC_OPCODE_SET_OSD_STRING
:
774 return "set osd string";
775 case CEC_OPCODE_GIVE_OSD_NAME
:
776 return "give osd name";
777 case CEC_OPCODE_SET_OSD_NAME
:
778 return "set osd name";
779 case CEC_OPCODE_MENU_REQUEST
:
780 return "menu request";
781 case CEC_OPCODE_MENU_STATUS
:
782 return "menu status";
783 case CEC_OPCODE_USER_CONTROL_PRESSED
:
784 return "user control pressed";
785 case CEC_OPCODE_USER_CONTROL_RELEASE
:
786 return "user control release";
787 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
788 return "give device power status";
789 case CEC_OPCODE_REPORT_POWER_STATUS
:
790 return "report power status";
791 case CEC_OPCODE_FEATURE_ABORT
:
792 return "feature abort";
793 case CEC_OPCODE_ABORT
:
795 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
796 return "give audio status";
797 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
798 return "give audio mode status";
799 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
800 return "report audio status";
801 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
802 return "set system audio mode";
803 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
804 return "system audio mode request";
805 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
806 return "system audio mode status";
807 case CEC_OPCODE_SET_AUDIO_RATE
:
808 return "set audio rate";
814 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
818 case CEC_SYSTEM_AUDIO_STATUS_ON
:
820 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
827 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
829 // TODO this is a mask
833 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
837 case CEC_VENDOR_SAMSUNG
:
841 case CEC_VENDOR_PANASONIC
:
843 case CEC_VENDOR_PIONEER
:
845 case CEC_VENDOR_ONKYO
: