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 SetPhysicalAddress(command
.initiator
, iNewAddress
);
349 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
351 if (command
.parameters
.size
== 1)
353 CCECBusDevice
*device
= GetDevice(command
.initiator
);
355 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
360 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
363 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
364 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
366 vector
<CCECBusDevice
*> devices
;
367 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
368 devices
[iDevicePtr
]->TransmitActiveSource();
373 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
375 if (command
.parameters
.size
== 4)
377 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
378 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
380 CCECBusDevice
*device
= GetDevice(command
.initiator
);
382 device
->SetStreamPath(iNewAddress
, iOldAddress
);
387 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
389 if (command
.parameters
.size
== 2)
391 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
392 m_busDevice
->GetProcessor()->SetStreamPath(iNewAddress
);
398 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
400 if (command
.parameters
.size
== 3)
402 CCECBusDevice
*device
= GetDevice(command
.initiator
);
405 cec_menu_language language
;
406 language
.device
= command
.initiator
;
407 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
408 language
.language
[iPtr
] = command
.parameters
[iPtr
];
409 language
.language
[3] = 0;
410 device
->SetMenuLanguage(language
);
417 bool CCECCommandHandler::HandleSetOSDName(const cec_command
&command
)
419 if (command
.parameters
.size
> 0)
421 CCECBusDevice
*device
= GetDevice(command
.initiator
);
425 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
426 buf
[iPtr
] = (char)command
.parameters
[iPtr
];
427 buf
[command
.parameters
.size
] = 0;
429 CStdString
strName(buf
);
430 device
->SetOSDName(strName
);
438 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
440 if (command
.parameters
.size
>= 2)
442 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
444 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
445 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
447 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
449 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
452 return device
->TransmitActiveSource() &&
453 device
->TransmitMenuState(command
.initiator
);
460 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
462 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
464 CCECBusDevice
*device
= GetDevice(command
.destination
);
465 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
466 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
471 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
473 CCECBusDevice
*device
= GetDevice(command
.initiator
);
475 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
480 bool CCECCommandHandler::HandleSystemAudioStatus(const cec_command
&command
)
482 CCECBusDevice
*device
= GetDevice(command
.initiator
);
483 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
485 ((CCECAudioSystem
*)device
)->SetSystemAudioMode(command
);
492 bool CCECCommandHandler::HandleTextViewOn(const cec_command
&command
)
494 m_busDevice
->GetProcessor()->SetActiveSource(command
.initiator
);
498 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
500 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
502 m_busDevice
->GetProcessor()->AddKey();
504 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
507 strLog
.Format("key pressed: %x", command
.parameters
[0]);
508 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
510 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
511 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
513 CCECBusDevice
*device
= GetDevice(command
.destination
);
515 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
518 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
525 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
527 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
528 m_busDevice
->GetProcessor()->AddKey();
533 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
536 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
537 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
540 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
542 unsigned int iReturn(0);
544 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
545 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
549 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
557 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
559 CCECBusDevice
*device
= NULL
;
561 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
562 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
567 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
569 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
572 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
574 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
577 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
579 if (command
.parameters
.size
< 3)
581 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
585 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
586 ((uint64_t)command
.parameters
[1] << 8) +
587 (uint64_t)command
.parameters
[2];
589 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
591 device
->SetVendorId(iVendorId
);
594 void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress
, uint16_t iNewAddress
)
596 if (!m_busDevice
->MyLogicalAddressContains(iAddress
))
598 bool bOurAddress(m_busDevice
->GetProcessor()->GetPhysicalAddress() == iNewAddress
);
599 GetDevice(iAddress
)->SetPhysicalAddress(iNewAddress
);
602 /* another device reported the same physical address as ours
603 * since we don't have physical address detection yet, we'll just use the
604 * given address, increased by 0x100 for now */
605 m_busDevice
->GetProcessor()->SetPhysicalAddress(iNewAddress
+ 0x100);
610 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
614 case CEC_MENU_STATE_ACTIVATED
:
616 case CEC_MENU_STATE_DEACTIVATED
:
617 return "deactivated";
623 const char *CCECCommandHandler::ToString(const cec_version version
)
627 case CEC_VERSION_1_2
:
629 case CEC_VERSION_1_2A
:
631 case CEC_VERSION_1_3
:
633 case CEC_VERSION_1_3A
:
635 case CEC_VERSION_1_4
:
642 const char *CCECCommandHandler::ToString(const cec_power_status status
)
646 case CEC_POWER_STATUS_ON
:
648 case CEC_POWER_STATUS_STANDBY
:
650 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
651 return "in transition from on to standby";
652 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
653 return "in transition from standby to on";
659 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
663 case CECDEVICE_AUDIOSYSTEM
:
665 case CECDEVICE_BROADCAST
:
667 case CECDEVICE_FREEUSE
:
669 case CECDEVICE_PLAYBACKDEVICE1
:
671 case CECDEVICE_PLAYBACKDEVICE2
:
673 case CECDEVICE_PLAYBACKDEVICE3
:
675 case CECDEVICE_RECORDINGDEVICE1
:
677 case CECDEVICE_RECORDINGDEVICE2
:
679 case CECDEVICE_RECORDINGDEVICE3
:
681 case CECDEVICE_RESERVED1
:
683 case CECDEVICE_RESERVED2
:
685 case CECDEVICE_TUNER1
:
687 case CECDEVICE_TUNER2
:
689 case CECDEVICE_TUNER3
:
691 case CECDEVICE_TUNER4
:
700 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
704 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
705 return "skip forward wind";
706 case CEC_DECK_CONTROL_MODE_EJECT
:
708 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
709 return "reverse rewind";
710 case CEC_DECK_CONTROL_MODE_STOP
:
717 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
721 case CEC_DECK_INFO_PLAY
:
723 case CEC_DECK_INFO_RECORD
:
725 case CEC_DECK_INFO_PLAY_REVERSE
:
726 return "play reverse";
727 case CEC_DECK_INFO_STILL
:
729 case CEC_DECK_INFO_SLOW
:
731 case CEC_DECK_INFO_SLOW_REVERSE
:
732 return "slow reverse";
733 case CEC_DECK_INFO_FAST_FORWARD
:
734 return "fast forward";
735 case CEC_DECK_INFO_FAST_REVERSE
:
736 return "fast reverse";
737 case CEC_DECK_INFO_NO_MEDIA
:
739 case CEC_DECK_INFO_STOP
:
741 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
742 return "info skip forward wind";
743 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
744 return "info skip reverse rewind";
745 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
746 return "info index search forward";
747 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
748 return "info index search reverse";
749 case CEC_DECK_INFO_OTHER_STATUS
:
756 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
760 case CEC_OPCODE_ACTIVE_SOURCE
:
761 return "active source";
762 case CEC_OPCODE_IMAGE_VIEW_ON
:
763 return "image view on";
764 case CEC_OPCODE_TEXT_VIEW_ON
:
765 return "text view on";
766 case CEC_OPCODE_INACTIVE_SOURCE
:
767 return "inactive source";
768 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
769 return "request active source";
770 case CEC_OPCODE_ROUTING_CHANGE
:
771 return "routing change";
772 case CEC_OPCODE_ROUTING_INFORMATION
:
773 return "routing information";
774 case CEC_OPCODE_SET_STREAM_PATH
:
775 return "set stream path";
776 case CEC_OPCODE_STANDBY
:
778 case CEC_OPCODE_RECORD_OFF
:
780 case CEC_OPCODE_RECORD_ON
:
782 case CEC_OPCODE_RECORD_STATUS
:
783 return "record status";
784 case CEC_OPCODE_RECORD_TV_SCREEN
:
785 return "record tv screen";
786 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
787 return "clear analogue timer";
788 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
789 return "clear digital timer";
790 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
791 return "clear external timer";
792 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
793 return "set analogue timer";
794 case CEC_OPCODE_SET_DIGITAL_TIMER
:
795 return "set digital timer";
796 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
797 return "set external timer";
798 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
799 return "set timer program title";
800 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
801 return "timer cleared status";
802 case CEC_OPCODE_TIMER_STATUS
:
803 return "timer status";
804 case CEC_OPCODE_CEC_VERSION
:
805 return "cec version";
806 case CEC_OPCODE_GET_CEC_VERSION
:
807 return "get cec version";
808 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
809 return "give physical address";
810 case CEC_OPCODE_GET_MENU_LANGUAGE
:
811 return "get menu language";
812 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
813 return "report physical address";
814 case CEC_OPCODE_SET_MENU_LANGUAGE
:
815 return "set menu language";
816 case CEC_OPCODE_DECK_CONTROL
:
817 return "deck control";
818 case CEC_OPCODE_DECK_STATUS
:
819 return "deck status";
820 case CEC_OPCODE_GIVE_DECK_STATUS
:
821 return "give deck status";
822 case CEC_OPCODE_PLAY
:
824 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
825 return "give tuner status";
826 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
827 return "select analogue service";
828 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
829 return "set digital service";
830 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
831 return "tuner device status";
832 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
833 return "tuner step decrement";
834 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
835 return "tuner step increment";
836 case CEC_OPCODE_DEVICE_VENDOR_ID
:
837 return "device vendor id";
838 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
839 return "give device vendor id";
840 case CEC_OPCODE_VENDOR_COMMAND
:
841 return "vendor command";
842 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
843 return "vendor command with id";
844 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
845 return "vendor remote button down";
846 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
847 return "vendor remote button up";
848 case CEC_OPCODE_SET_OSD_STRING
:
849 return "set osd string";
850 case CEC_OPCODE_GIVE_OSD_NAME
:
851 return "give osd name";
852 case CEC_OPCODE_SET_OSD_NAME
:
853 return "set osd name";
854 case CEC_OPCODE_MENU_REQUEST
:
855 return "menu request";
856 case CEC_OPCODE_MENU_STATUS
:
857 return "menu status";
858 case CEC_OPCODE_USER_CONTROL_PRESSED
:
859 return "user control pressed";
860 case CEC_OPCODE_USER_CONTROL_RELEASE
:
861 return "user control release";
862 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
863 return "give device power status";
864 case CEC_OPCODE_REPORT_POWER_STATUS
:
865 return "report power status";
866 case CEC_OPCODE_FEATURE_ABORT
:
867 return "feature abort";
868 case CEC_OPCODE_ABORT
:
870 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
871 return "give audio status";
872 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
873 return "give audio mode status";
874 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
875 return "report audio status";
876 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
877 return "set system audio mode";
878 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
879 return "system audio mode request";
880 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
881 return "system audio mode status";
882 case CEC_OPCODE_SET_AUDIO_RATE
:
883 return "set audio rate";
889 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
893 case CEC_SYSTEM_AUDIO_STATUS_ON
:
895 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
902 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
904 // TODO this is a mask
908 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
912 case CEC_VENDOR_SAMSUNG
:
916 case CEC_VENDOR_PANASONIC
:
918 case CEC_VENDOR_PIONEER
:
920 case CEC_VENDOR_ONKYO
: