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 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
57 switch(command
.opcode
)
59 case CEC_OPCODE_REPORT_POWER_STATUS
:
60 HandleReportPowerStatus(command
);
62 case CEC_OPCODE_CEC_VERSION
:
63 HandleDeviceCecVersion(command
);
65 case CEC_OPCODE_SET_MENU_LANGUAGE
:
66 HandleSetMenuLanguage(command
);
67 /* pass to listeners */
68 m_busDevice
->GetProcessor()->AddCommand(command
);
70 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
71 HandleGivePhysicalAddress(command
);
73 case CEC_OPCODE_GIVE_OSD_NAME
:
74 HandleGiveOSDName(command
);
76 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
77 HandleGiveDeviceVendorId(command
);
79 case CEC_OPCODE_DEVICE_VENDOR_ID
:
80 HandleDeviceVendorId(command
);
82 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
83 HandleDeviceVendorCommandWithId(command
);
85 case CEC_OPCODE_GIVE_DECK_STATUS
:
86 HandleGiveDeckStatus(command
);
88 case CEC_OPCODE_DECK_CONTROL
:
89 HandleDeckControl(command
);
91 case CEC_OPCODE_MENU_REQUEST
:
92 HandleMenuRequest(command
);
94 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
95 HandleGiveDevicePowerStatus(command
);
97 case CEC_OPCODE_GET_CEC_VERSION
:
98 HandleGetCecVersion(command
);
100 case CEC_OPCODE_USER_CONTROL_PRESSED
:
101 HandleUserControlPressed(command
);
103 case CEC_OPCODE_USER_CONTROL_RELEASE
:
104 HandleUserControlRelease(command
);
106 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
107 HandleGiveAudioStatus(command
);
109 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
110 HandleGiveSystemAudioModeStatus(command
);
112 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
113 HandleSetSystemAudioModeRequest(command
);
116 UnhandledCommand(command
);
117 /* pass to listeners */
118 m_busDevice
->GetProcessor()->AddCommand(command
);
123 else if (command
.destination
== CECDEVICE_BROADCAST
)
126 switch (command
.opcode
)
128 case CEC_OPCODE_SET_MENU_LANGUAGE
:
129 HandleSetMenuLanguage(command
);
130 /* pass to listeners */
131 m_busDevice
->GetProcessor()->AddCommand(command
);
133 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
134 HandleRequestActiveSource(command
);
136 case CEC_OPCODE_SET_STREAM_PATH
:
137 HandleSetStreamPath(command
);
139 case CEC_OPCODE_ROUTING_CHANGE
:
140 HandleRoutingChange(command
);
142 case CEC_OPCODE_DEVICE_VENDOR_ID
:
143 HandleDeviceVendorId(command
);
145 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
146 HandleDeviceVendorCommandWithId(command
);
148 case CEC_OPCODE_STANDBY
:
149 HandleStandby(command
);
150 /* pass to listeners */
151 m_busDevice
->GetProcessor()->AddCommand(command
);
153 case CEC_OPCODE_ACTIVE_SOURCE
:
154 HandleActiveSource(command
);
155 /* pass to listeners */
156 m_busDevice
->GetProcessor()->AddCommand(command
);
159 UnhandledCommand(command
);
160 /* pass to listeners */
161 m_busDevice
->GetProcessor()->AddCommand(command
);
169 strLog
.Format("ignoring frame: we're not at destination %x", command
.destination
);
170 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
177 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
179 if (command
.parameters
.size
== 2)
181 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
182 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
188 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
190 CCECBusDevice
*device
= GetDevice(command
.destination
);
191 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
&& command
.parameters
.size
> 0)
193 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
200 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
202 if (command
.parameters
.size
== 1)
204 CCECBusDevice
*device
= GetDevice(command
.initiator
);
206 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
212 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
214 SetVendorId(command
);
215 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
219 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
221 SetVendorId(command
);
225 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
227 CCECBusDevice
*device
= GetDevice(command
.destination
);
229 return device
->TransmitCECVersion(command
.initiator
);
234 bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command
&command
)
236 CCECBusDevice
*device
= GetDevice(command
.destination
);
237 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
238 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
243 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
245 CCECBusDevice
*device
= GetDevice(command
.destination
);
246 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
)
247 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
252 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
254 CCECBusDevice
*device
= GetDevice(command
.destination
);
256 return device
->TransmitPowerState(command
.initiator
);
261 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
263 CCECBusDevice
*device
= GetDevice(command
.destination
);
265 return device
->TransmitVendorID(command
.initiator
);
270 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
272 CCECBusDevice
*device
= GetDevice(command
.destination
);
274 return device
->TransmitOSDName(command
.initiator
);
279 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
281 CCECBusDevice
*device
= GetDevice(command
.destination
);
283 return device
->TransmitPhysicalAddress();
288 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
290 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
292 CCECBusDevice
*device
= GetDevice(command
.destination
);
294 return device
->TransmitMenuState(command
.initiator
);
299 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
301 if (command
.parameters
.size
== 1)
303 CCECBusDevice
*device
= GetDevice(command
.initiator
);
305 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
310 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
313 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
314 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
316 vector
<CCECBusDevice
*> devices
;
317 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
318 devices
[iDevicePtr
]->TransmitActiveSource();
323 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
325 if (command
.parameters
.size
== 4)
327 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
328 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
330 CCECBusDevice
*device
= GetDevice(command
.initiator
);
332 device
->SetStreamPath(iNewAddress
, iOldAddress
);
337 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
339 if (command
.parameters
.size
== 3)
341 CCECBusDevice
*device
= GetDevice(command
.initiator
);
344 cec_menu_language language
;
345 language
.device
= command
.initiator
;
346 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
347 language
.language
[iPtr
] = command
.parameters
[iPtr
];
348 language
.language
[3] = 0;
349 device
->SetMenuLanguage(language
);
355 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
357 if (command
.parameters
.size
>= 2)
359 uint16_t streamaddr
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
361 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, streamaddr
);
362 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
364 return m_busDevice
->GetProcessor()->SetStreamPath(streamaddr
);
369 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
371 if (command
.parameters
.size
>= 1)
373 CCECBusDevice
*device
= GetDevice(command
.destination
);
374 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
375 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
380 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
382 CCECBusDevice
*device
= GetDevice(command
.initiator
);
384 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
388 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
390 CCECBusDevice
*device
= GetDevice(command
.destination
);
391 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
392 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
397 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
399 if (command
.parameters
.size
> 0)
401 m_busDevice
->GetProcessor()->AddKey();
403 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
406 strLog
.Format("key pressed: %x", command
.parameters
[0]);
407 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
409 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
410 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
412 CCECBusDevice
*device
= GetDevice(command
.destination
);
414 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
417 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
423 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
425 m_busDevice
->GetProcessor()->AddKey();
429 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
432 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
433 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
436 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
438 unsigned int iReturn(0);
440 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
441 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
445 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
453 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
455 CCECBusDevice
*device
= NULL
;
457 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
458 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
463 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
465 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
468 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
470 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
473 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
475 if (command
.parameters
.size
< 3)
477 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
481 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
482 ((uint64_t)command
.parameters
[1] << 8) +
483 (uint64_t)command
.parameters
[2];
485 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
487 device
->SetVendorId(iVendorId
);
490 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
494 case CEC_MENU_STATE_ACTIVATED
:
496 case CEC_MENU_STATE_DEACTIVATED
:
497 return "deactivated";
503 const char *CCECCommandHandler::ToString(const cec_version version
)
507 case CEC_VERSION_1_2
:
509 case CEC_VERSION_1_2A
:
511 case CEC_VERSION_1_3
:
513 case CEC_VERSION_1_3A
:
515 case CEC_VERSION_1_4
:
522 const char *CCECCommandHandler::ToString(const cec_power_status status
)
526 case CEC_POWER_STATUS_ON
:
528 case CEC_POWER_STATUS_STANDBY
:
530 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
531 return "in transition from on to standby";
532 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
533 return "in transition from standby to on";
539 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
543 case CECDEVICE_AUDIOSYSTEM
:
545 case CECDEVICE_BROADCAST
:
547 case CECDEVICE_FREEUSE
:
549 case CECDEVICE_PLAYBACKDEVICE1
:
551 case CECDEVICE_PLAYBACKDEVICE2
:
553 case CECDEVICE_PLAYBACKDEVICE3
:
555 case CECDEVICE_RECORDINGDEVICE1
:
557 case CECDEVICE_RECORDINGDEVICE2
:
559 case CECDEVICE_RECORDINGDEVICE3
:
561 case CECDEVICE_RESERVED1
:
563 case CECDEVICE_RESERVED2
:
565 case CECDEVICE_TUNER1
:
567 case CECDEVICE_TUNER2
:
569 case CECDEVICE_TUNER3
:
571 case CECDEVICE_TUNER4
:
580 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
584 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
585 return "skip forward wind";
586 case CEC_DECK_CONTROL_MODE_EJECT
:
588 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
589 return "reverse rewind";
590 case CEC_DECK_CONTROL_MODE_STOP
:
597 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
601 case CEC_DECK_INFO_PLAY
:
603 case CEC_DECK_INFO_RECORD
:
605 case CEC_DECK_INFO_PLAY_REVERSE
:
606 return "play reverse";
607 case CEC_DECK_INFO_STILL
:
609 case CEC_DECK_INFO_SLOW
:
611 case CEC_DECK_INFO_SLOW_REVERSE
:
612 return "slow reverse";
613 case CEC_DECK_INFO_FAST_FORWARD
:
614 return "fast forward";
615 case CEC_DECK_INFO_FAST_REVERSE
:
616 return "fast reverse";
617 case CEC_DECK_INFO_NO_MEDIA
:
619 case CEC_DECK_INFO_STOP
:
621 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
622 return "info skip forward wind";
623 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
624 return "info skip reverse rewind";
625 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
626 return "info index search forward";
627 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
628 return "info index search reverse";
629 case CEC_DECK_INFO_OTHER_STATUS
:
636 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
640 case CEC_OPCODE_ACTIVE_SOURCE
:
641 return "active source";
642 case CEC_OPCODE_IMAGE_VIEW_ON
:
643 return "image view on";
644 case CEC_OPCODE_TEXT_VIEW_ON
:
645 return "text view on";
646 case CEC_OPCODE_INACTIVE_SOURCE
:
647 return "inactive source";
648 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
649 return "request active source";
650 case CEC_OPCODE_ROUTING_CHANGE
:
651 return "routing change";
652 case CEC_OPCODE_ROUTING_INFORMATION
:
653 return "routing information";
654 case CEC_OPCODE_SET_STREAM_PATH
:
655 return "set stream path";
656 case CEC_OPCODE_STANDBY
:
658 case CEC_OPCODE_RECORD_OFF
:
660 case CEC_OPCODE_RECORD_ON
:
662 case CEC_OPCODE_RECORD_STATUS
:
663 return "record status";
664 case CEC_OPCODE_RECORD_TV_SCREEN
:
665 return "record tv screen";
666 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
667 return "clear analogue timer";
668 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
669 return "clear digital timer";
670 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
671 return "clear external timer";
672 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
673 return "set analogue timer";
674 case CEC_OPCODE_SET_DIGITAL_TIMER
:
675 return "set digital timer";
676 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
677 return "set external timer";
678 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
679 return "set timer program title";
680 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
681 return "timer cleared status";
682 case CEC_OPCODE_TIMER_STATUS
:
683 return "timer status";
684 case CEC_OPCODE_CEC_VERSION
:
685 return "cec version";
686 case CEC_OPCODE_GET_CEC_VERSION
:
687 return "get cec version";
688 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
689 return "give physical address";
690 case CEC_OPCODE_GET_MENU_LANGUAGE
:
691 return "get menu language";
692 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
693 return "report physical address";
694 case CEC_OPCODE_SET_MENU_LANGUAGE
:
695 return "set menu language";
696 case CEC_OPCODE_DECK_CONTROL
:
697 return "deck control";
698 case CEC_OPCODE_DECK_STATUS
:
699 return "deck status";
700 case CEC_OPCODE_GIVE_DECK_STATUS
:
701 return "give deck status";
702 case CEC_OPCODE_PLAY
:
704 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
705 return "give tuner status";
706 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
707 return "select analogue service";
708 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
709 return "set digital service";
710 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
711 return "tuner device status";
712 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
713 return "tuner step decrement";
714 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
715 return "tuner step increment";
716 case CEC_OPCODE_DEVICE_VENDOR_ID
:
717 return "device vendor id";
718 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
719 return "give device vendor id";
720 case CEC_OPCODE_VENDOR_COMMAND
:
721 return "vendor command";
722 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
723 return "vendor command with id";
724 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
725 return "vendor remote button down";
726 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
727 return "vendor remote button up";
728 case CEC_OPCODE_SET_OSD_STRING
:
729 return "set osd string";
730 case CEC_OPCODE_GIVE_OSD_NAME
:
731 return "give osd name";
732 case CEC_OPCODE_SET_OSD_NAME
:
733 return "set osd name";
734 case CEC_OPCODE_MENU_REQUEST
:
735 return "menu request";
736 case CEC_OPCODE_MENU_STATUS
:
737 return "menu status";
738 case CEC_OPCODE_USER_CONTROL_PRESSED
:
739 return "user control pressed";
740 case CEC_OPCODE_USER_CONTROL_RELEASE
:
741 return "user control release";
742 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
743 return "give device power status";
744 case CEC_OPCODE_REPORT_POWER_STATUS
:
745 return "report power status";
746 case CEC_OPCODE_FEATURE_ABORT
:
747 return "feature abort";
748 case CEC_OPCODE_ABORT
:
750 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
751 return "give audio status";
752 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
753 return "give audio mode status";
754 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
755 return "report audio status";
756 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
757 return "set system audio mode";
758 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
759 return "system audio mode request";
760 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
761 return "system audio mode status";
762 case CEC_OPCODE_SET_AUDIO_RATE
:
763 return "set audio rate";
769 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
773 case CEC_SYSTEM_AUDIO_STATUS_ON
:
775 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
782 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
784 // TODO this is a mask
788 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
792 case CEC_VENDOR_SAMSUNG
:
796 case CEC_VENDOR_PANASONIC
:
798 case CEC_VENDOR_PIONEER
: