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_STANDBY
:
121 HandleStandby(command
);
123 case CEC_OPCODE_ACTIVE_SOURCE
:
124 HandleActiveSource(command
);
127 UnhandledCommand(command
);
128 if (command
.destination
== CECDEVICE_BROADCAST
|| m_busDevice
->MyLogicalAddressContains(command
.destination
))
129 m_busDevice
->GetProcessor()->AddCommand(command
);
137 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
139 if (command
.parameters
.size
== 2)
141 m_busDevice
->GetProcessor()->AddCommand(command
);
143 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
144 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
150 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
152 CCECBusDevice
*device
= GetDevice(command
.destination
);
153 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) && command
.parameters
.size
> 0)
155 m_busDevice
->GetProcessor()->AddCommand(command
);
157 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
164 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
166 if (command
.parameters
.size
== 1)
168 CCECBusDevice
*device
= GetDevice(command
.initiator
);
170 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
176 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
178 SetVendorId(command
);
180 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
181 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
186 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
188 SetVendorId(command
);
192 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
194 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
196 CCECBusDevice
*device
= GetDevice(command
.destination
);
198 return device
->TransmitCECVersion(command
.initiator
);
204 bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command
&command
)
206 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
208 CCECBusDevice
*device
= GetDevice(command
.destination
);
209 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
210 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
216 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
218 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
220 CCECBusDevice
*device
= GetDevice(command
.destination
);
221 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
))
222 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
228 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
230 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
232 CCECBusDevice
*device
= GetDevice(command
.destination
);
234 return device
->TransmitPowerState(command
.initiator
);
240 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
242 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
244 CCECBusDevice
*device
= GetDevice(command
.destination
);
246 return device
->TransmitVendorID(command
.initiator
);
252 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
254 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
256 CCECBusDevice
*device
= GetDevice(command
.destination
);
258 return device
->TransmitOSDName(command
.initiator
);
264 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
266 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
268 CCECBusDevice
*device
= GetDevice(command
.destination
);
270 return device
->TransmitPhysicalAddress();
276 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
278 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
280 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
282 CCECBusDevice
*device
= GetDevice(command
.destination
);
284 return device
->TransmitMenuState(command
.initiator
);
288 m_busDevice
->GetProcessor()->AddCommand(command
);
295 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
297 if (command
.parameters
.size
== 1)
299 CCECBusDevice
*device
= GetDevice(command
.initiator
);
301 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
306 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
309 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
310 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
312 vector
<CCECBusDevice
*> devices
;
313 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
314 devices
[iDevicePtr
]->TransmitActiveSource();
319 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
321 if (command
.parameters
.size
== 4)
323 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
324 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
326 CCECBusDevice
*device
= GetDevice(command
.initiator
);
328 device
->SetStreamPath(iNewAddress
, iOldAddress
);
333 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
335 if (command
.parameters
.size
== 3)
337 CCECBusDevice
*device
= GetDevice(command
.initiator
);
340 cec_menu_language language
;
341 language
.device
= command
.initiator
;
342 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
343 language
.language
[iPtr
] = command
.parameters
[iPtr
];
344 language
.language
[3] = 0;
345 device
->SetMenuLanguage(language
);
347 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
348 m_busDevice
->GetProcessor()->AddCommand(command
);
354 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
356 if (command
.parameters
.size
>= 2)
358 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
360 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
361 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
363 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
365 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
368 return device
->TransmitActiveSource() &&
369 device
->TransmitMenuState(command
.initiator
);
377 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
379 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
381 CCECBusDevice
*device
= GetDevice(command
.destination
);
382 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
383 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
388 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
390 CCECBusDevice
*device
= GetDevice(command
.initiator
);
392 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
394 m_busDevice
->GetProcessor()->AddCommand(command
);
399 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
401 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
403 CCECBusDevice
*device
= GetDevice(command
.destination
);
404 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
405 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
411 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
413 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
415 m_busDevice
->GetProcessor()->AddKey();
417 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
420 strLog
.Format("key pressed: %x", command
.parameters
[0]);
421 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
423 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
424 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
426 CCECBusDevice
*device
= GetDevice(command
.destination
);
428 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
431 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
437 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
439 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
440 m_busDevice
->GetProcessor()->AddKey();
445 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
448 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
449 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
452 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
454 unsigned int iReturn(0);
456 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
457 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
461 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
469 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
471 CCECBusDevice
*device
= NULL
;
473 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
474 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
479 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
481 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
484 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
486 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
489 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
491 if (command
.parameters
.size
< 3)
493 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
497 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
498 ((uint64_t)command
.parameters
[1] << 8) +
499 (uint64_t)command
.parameters
[2];
501 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
503 device
->SetVendorId(iVendorId
);
506 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
510 case CEC_MENU_STATE_ACTIVATED
:
512 case CEC_MENU_STATE_DEACTIVATED
:
513 return "deactivated";
519 const char *CCECCommandHandler::ToString(const cec_version version
)
523 case CEC_VERSION_1_2
:
525 case CEC_VERSION_1_2A
:
527 case CEC_VERSION_1_3
:
529 case CEC_VERSION_1_3A
:
531 case CEC_VERSION_1_4
:
538 const char *CCECCommandHandler::ToString(const cec_power_status status
)
542 case CEC_POWER_STATUS_ON
:
544 case CEC_POWER_STATUS_STANDBY
:
546 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
547 return "in transition from on to standby";
548 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
549 return "in transition from standby to on";
555 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
559 case CECDEVICE_AUDIOSYSTEM
:
561 case CECDEVICE_BROADCAST
:
563 case CECDEVICE_FREEUSE
:
565 case CECDEVICE_PLAYBACKDEVICE1
:
567 case CECDEVICE_PLAYBACKDEVICE2
:
569 case CECDEVICE_PLAYBACKDEVICE3
:
571 case CECDEVICE_RECORDINGDEVICE1
:
573 case CECDEVICE_RECORDINGDEVICE2
:
575 case CECDEVICE_RECORDINGDEVICE3
:
577 case CECDEVICE_RESERVED1
:
579 case CECDEVICE_RESERVED2
:
581 case CECDEVICE_TUNER1
:
583 case CECDEVICE_TUNER2
:
585 case CECDEVICE_TUNER3
:
587 case CECDEVICE_TUNER4
:
596 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
600 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
601 return "skip forward wind";
602 case CEC_DECK_CONTROL_MODE_EJECT
:
604 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
605 return "reverse rewind";
606 case CEC_DECK_CONTROL_MODE_STOP
:
613 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
617 case CEC_DECK_INFO_PLAY
:
619 case CEC_DECK_INFO_RECORD
:
621 case CEC_DECK_INFO_PLAY_REVERSE
:
622 return "play reverse";
623 case CEC_DECK_INFO_STILL
:
625 case CEC_DECK_INFO_SLOW
:
627 case CEC_DECK_INFO_SLOW_REVERSE
:
628 return "slow reverse";
629 case CEC_DECK_INFO_FAST_FORWARD
:
630 return "fast forward";
631 case CEC_DECK_INFO_FAST_REVERSE
:
632 return "fast reverse";
633 case CEC_DECK_INFO_NO_MEDIA
:
635 case CEC_DECK_INFO_STOP
:
637 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
638 return "info skip forward wind";
639 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
640 return "info skip reverse rewind";
641 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
642 return "info index search forward";
643 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
644 return "info index search reverse";
645 case CEC_DECK_INFO_OTHER_STATUS
:
652 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
656 case CEC_OPCODE_ACTIVE_SOURCE
:
657 return "active source";
658 case CEC_OPCODE_IMAGE_VIEW_ON
:
659 return "image view on";
660 case CEC_OPCODE_TEXT_VIEW_ON
:
661 return "text view on";
662 case CEC_OPCODE_INACTIVE_SOURCE
:
663 return "inactive source";
664 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
665 return "request active source";
666 case CEC_OPCODE_ROUTING_CHANGE
:
667 return "routing change";
668 case CEC_OPCODE_ROUTING_INFORMATION
:
669 return "routing information";
670 case CEC_OPCODE_SET_STREAM_PATH
:
671 return "set stream path";
672 case CEC_OPCODE_STANDBY
:
674 case CEC_OPCODE_RECORD_OFF
:
676 case CEC_OPCODE_RECORD_ON
:
678 case CEC_OPCODE_RECORD_STATUS
:
679 return "record status";
680 case CEC_OPCODE_RECORD_TV_SCREEN
:
681 return "record tv screen";
682 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
683 return "clear analogue timer";
684 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
685 return "clear digital timer";
686 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
687 return "clear external timer";
688 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
689 return "set analogue timer";
690 case CEC_OPCODE_SET_DIGITAL_TIMER
:
691 return "set digital timer";
692 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
693 return "set external timer";
694 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
695 return "set timer program title";
696 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
697 return "timer cleared status";
698 case CEC_OPCODE_TIMER_STATUS
:
699 return "timer status";
700 case CEC_OPCODE_CEC_VERSION
:
701 return "cec version";
702 case CEC_OPCODE_GET_CEC_VERSION
:
703 return "get cec version";
704 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
705 return "give physical address";
706 case CEC_OPCODE_GET_MENU_LANGUAGE
:
707 return "get menu language";
708 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
709 return "report physical address";
710 case CEC_OPCODE_SET_MENU_LANGUAGE
:
711 return "set menu language";
712 case CEC_OPCODE_DECK_CONTROL
:
713 return "deck control";
714 case CEC_OPCODE_DECK_STATUS
:
715 return "deck status";
716 case CEC_OPCODE_GIVE_DECK_STATUS
:
717 return "give deck status";
718 case CEC_OPCODE_PLAY
:
720 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
721 return "give tuner status";
722 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
723 return "select analogue service";
724 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
725 return "set digital service";
726 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
727 return "tuner device status";
728 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
729 return "tuner step decrement";
730 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
731 return "tuner step increment";
732 case CEC_OPCODE_DEVICE_VENDOR_ID
:
733 return "device vendor id";
734 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
735 return "give device vendor id";
736 case CEC_OPCODE_VENDOR_COMMAND
:
737 return "vendor command";
738 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
739 return "vendor command with id";
740 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
741 return "vendor remote button down";
742 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
743 return "vendor remote button up";
744 case CEC_OPCODE_SET_OSD_STRING
:
745 return "set osd string";
746 case CEC_OPCODE_GIVE_OSD_NAME
:
747 return "give osd name";
748 case CEC_OPCODE_SET_OSD_NAME
:
749 return "set osd name";
750 case CEC_OPCODE_MENU_REQUEST
:
751 return "menu request";
752 case CEC_OPCODE_MENU_STATUS
:
753 return "menu status";
754 case CEC_OPCODE_USER_CONTROL_PRESSED
:
755 return "user control pressed";
756 case CEC_OPCODE_USER_CONTROL_RELEASE
:
757 return "user control release";
758 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
759 return "give device power status";
760 case CEC_OPCODE_REPORT_POWER_STATUS
:
761 return "report power status";
762 case CEC_OPCODE_FEATURE_ABORT
:
763 return "feature abort";
764 case CEC_OPCODE_ABORT
:
766 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
767 return "give audio status";
768 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
769 return "give audio mode status";
770 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
771 return "report audio status";
772 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
773 return "set system audio mode";
774 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
775 return "system audio mode request";
776 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
777 return "system audio mode status";
778 case CEC_OPCODE_SET_AUDIO_RATE
:
779 return "set audio rate";
785 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
789 case CEC_SYSTEM_AUDIO_STATUS_ON
:
791 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
798 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
800 // TODO this is a mask
804 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
808 case CEC_VENDOR_SAMSUNG
:
812 case CEC_VENDOR_PANASONIC
:
814 case CEC_VENDOR_PIONEER
:
816 case CEC_VENDOR_ONKYO
: