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_SET_OSD_NAME
:
136 HandleSetOSDName(command
);
139 UnhandledCommand(command
);
144 if (command
.destination
== CECDEVICE_BROADCAST
|| m_busDevice
->MyLogicalAddressContains(command
.destination
))
145 m_busDevice
->GetProcessor()->AddCommand(command
);
150 bool CCECCommandHandler::HandleActiveSource(const cec_command
&command
)
152 if (command
.parameters
.size
== 2)
154 uint16_t iAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
155 return m_busDevice
->GetProcessor()->SetStreamPath(iAddress
);
161 bool CCECCommandHandler::HandleDeckControl(const cec_command
&command
)
163 CCECBusDevice
*device
= GetDevice(command
.destination
);
164 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) && command
.parameters
.size
> 0)
166 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode((cec_deck_control_mode
) command
.parameters
[0]);
173 bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command
&command
)
175 if (command
.parameters
.size
== 1)
177 CCECBusDevice
*device
= GetDevice(command
.initiator
);
179 device
->SetCecVersion((cec_version
) command
.parameters
[0]);
185 bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command
&command
)
187 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
188 m_busDevice
->GetProcessor()->TransmitAbort(command
.initiator
, command
.opcode
, CEC_ABORT_REASON_REFUSED
);
193 bool CCECCommandHandler::HandleDeviceVendorId(const cec_command
&command
)
195 SetVendorId(command
);
199 bool CCECCommandHandler::HandleGetCecVersion(const cec_command
&command
)
201 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
203 CCECBusDevice
*device
= GetDevice(command
.destination
);
205 return device
->TransmitCECVersion(command
.initiator
);
211 bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command
&command
)
213 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
215 CCECBusDevice
*device
= GetDevice(command
.destination
);
216 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
217 return ((CCECAudioSystem
*) device
)->TransmitAudioStatus(command
.initiator
);
223 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command
&command
)
225 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
227 CCECBusDevice
*device
= GetDevice(command
.destination
);
228 if (device
&& (device
->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| device
->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
))
229 return ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(command
.initiator
);
235 bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command
&command
)
237 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
239 CCECBusDevice
*device
= GetDevice(command
.destination
);
241 return device
->TransmitPowerState(command
.initiator
);
247 bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command
&command
)
249 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
251 CCECBusDevice
*device
= GetDevice(command
.destination
);
253 return device
->TransmitVendorID(command
.initiator
);
259 bool CCECCommandHandler::HandleGiveOSDName(const cec_command
&command
)
261 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
263 CCECBusDevice
*device
= GetDevice(command
.destination
);
265 return device
->TransmitOSDName(command
.initiator
);
271 bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command
&command
)
273 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
275 CCECBusDevice
*device
= GetDevice(command
.destination
);
277 return device
->TransmitPhysicalAddress();
283 bool CCECCommandHandler::HandleMenuRequest(const cec_command
&command
)
285 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
287 if (command
.parameters
[0] == CEC_MENU_REQUEST_TYPE_QUERY
)
289 CCECBusDevice
*device
= GetDevice(command
.destination
);
291 return device
->TransmitMenuState(command
.initiator
);
298 bool CCECCommandHandler::HandleReportAudioStatus(const cec_command
&command
)
300 if (command
.parameters
.size
== 1)
302 CCECBusDevice
*device
= GetDevice(command
.initiator
);
303 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
305 ((CCECAudioSystem
*)device
)->SetAudioStatus(command
.parameters
[0]);
312 bool CCECCommandHandler::HandleReportPhysicalAddress(const cec_command
&command
)
314 if (command
.parameters
.size
== 3)
316 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
317 cec_device_type type
= (cec_device_type
)command
.parameters
[2];
319 CCECBusDevice
*device
= GetDevice(command
.initiator
);
320 if (device
&& device
->GetType() == type
)
321 device
->SetPhysicalAddress(iNewAddress
);
326 bool CCECCommandHandler::HandleReportPowerStatus(const cec_command
&command
)
328 if (command
.parameters
.size
== 1)
330 CCECBusDevice
*device
= GetDevice(command
.initiator
);
332 device
->SetPowerStatus((cec_power_status
) command
.parameters
[0]);
337 bool CCECCommandHandler::HandleRequestActiveSource(const cec_command
&command
)
340 strLog
.Format(">> %i requests active source", (uint8_t) command
.initiator
);
341 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
343 vector
<CCECBusDevice
*> devices
;
344 for (int iDevicePtr
= (int)GetMyDevices(devices
)-1; iDevicePtr
>=0; iDevicePtr
--)
345 devices
[iDevicePtr
]->TransmitActiveSource();
350 bool CCECCommandHandler::HandleRoutingChange(const cec_command
&command
)
352 if (command
.parameters
.size
== 4)
354 uint16_t iOldAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
355 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[2] << 8) | ((uint16_t)command
.parameters
[3]);
357 CCECBusDevice
*device
= GetDevice(command
.initiator
);
359 device
->SetStreamPath(iNewAddress
, iOldAddress
);
364 bool CCECCommandHandler::HandleRoutingInformation(const cec_command
&command
)
366 if (command
.parameters
.size
== 2)
368 uint16_t iNewAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
370 CCECBusDevice
*device
= GetDevice(command
.initiator
);
373 device
->SetPhysicalAddress(iNewAddress
);
381 bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command
&command
)
383 if (command
.parameters
.size
== 3)
385 CCECBusDevice
*device
= GetDevice(command
.initiator
);
388 cec_menu_language language
;
389 language
.device
= command
.initiator
;
390 for (uint8_t iPtr
= 0; iPtr
< 4; iPtr
++)
391 language
.language
[iPtr
] = command
.parameters
[iPtr
];
392 language
.language
[3] = 0;
393 device
->SetMenuLanguage(language
);
400 bool CCECCommandHandler::HandleSetOSDName(const cec_command
&command
)
402 if (command
.parameters
.size
> 0)
404 CCECBusDevice
*device
= GetDevice(command
.initiator
);
408 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
409 buf
[iPtr
] = (char)command
.parameters
[iPtr
];
410 buf
[command
.parameters
.size
] = 0;
412 CStdString
strName(buf
);
413 device
->SetOSDName(strName
);
421 bool CCECCommandHandler::HandleSetStreamPath(const cec_command
&command
)
423 if (command
.parameters
.size
>= 2)
425 uint16_t iStreamAddress
= ((uint16_t)command
.parameters
[0] << 8) | ((uint16_t)command
.parameters
[1]);
427 strLog
.Format(">> %i sets stream path to physical address %04x", command
.initiator
, iStreamAddress
);
428 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
430 if (m_busDevice
->GetProcessor()->SetStreamPath(iStreamAddress
))
432 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamAddress
);
435 return device
->TransmitActiveSource() &&
436 device
->TransmitMenuState(command
.initiator
);
443 bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command
&command
)
445 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
>= 1)
447 CCECBusDevice
*device
= GetDevice(command
.destination
);
448 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
449 return ((CCECAudioSystem
*) device
)->SetSystemAudioMode(command
);
454 bool CCECCommandHandler::HandleStandby(const cec_command
&command
)
456 CCECBusDevice
*device
= GetDevice(command
.initiator
);
458 device
->SetPowerStatus(CEC_POWER_STATUS_STANDBY
);
463 bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command
&command
)
465 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
467 CCECBusDevice
*device
= GetDevice(command
.destination
);
468 if (device
&& device
->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
469 return ((CCECAudioSystem
*) device
)->TransmitSystemAudioModeStatus(command
.initiator
);
475 bool CCECCommandHandler::HandleUserControlPressed(const cec_command
&command
)
477 if (m_busDevice
->MyLogicalAddressContains(command
.destination
) && command
.parameters
.size
> 0)
479 m_busDevice
->GetProcessor()->AddKey();
481 if (command
.parameters
[0] <= CEC_USER_CONTROL_CODE_MAX
)
484 strLog
.Format("key pressed: %x", command
.parameters
[0]);
485 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
487 if (command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER
||
488 command
.parameters
[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION
)
490 CCECBusDevice
*device
= GetDevice(command
.destination
);
492 device
->SetPowerStatus(CEC_POWER_STATUS_ON
);
495 m_busDevice
->GetProcessor()->SetCurrentButton((cec_user_control_code
) command
.parameters
[0]);
502 bool CCECCommandHandler::HandleUserControlRelease(const cec_command
&command
)
504 if (m_busDevice
->MyLogicalAddressContains(command
.destination
))
505 m_busDevice
->GetProcessor()->AddKey();
510 void CCECCommandHandler::UnhandledCommand(const cec_command
&command
)
513 strLog
.Format("unhandled command with opcode %02x from address %d", command
.opcode
, command
.initiator
);
514 m_busDevice
->AddLog(CEC_LOG_DEBUG
, strLog
);
517 unsigned int CCECCommandHandler::GetMyDevices(vector
<CCECBusDevice
*> &devices
) const
519 unsigned int iReturn(0);
521 cec_logical_addresses addresses
= m_busDevice
->GetProcessor()->GetLogicalAddresses();
522 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
526 devices
.push_back(GetDevice((cec_logical_address
) iPtr
));
534 CCECBusDevice
*CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress
) const
536 CCECBusDevice
*device
= NULL
;
538 if (iLogicalAddress
>= CECDEVICE_TV
&& iLogicalAddress
<= CECDEVICE_BROADCAST
)
539 device
= m_busDevice
->GetProcessor()->m_busDevices
[iLogicalAddress
];
544 CCECBusDevice
*CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
) const
546 return m_busDevice
->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress
);
549 CCECBusDevice
*CCECCommandHandler::GetDeviceByType(cec_device_type type
) const
551 return m_busDevice
->GetProcessor()->GetDeviceByType(type
);
554 void CCECCommandHandler::SetVendorId(const cec_command
&command
)
556 if (command
.parameters
.size
< 3)
558 m_busDevice
->AddLog(CEC_LOG_WARNING
, "invalid vendor ID received");
562 uint64_t iVendorId
= ((uint64_t)command
.parameters
[0] << 16) +
563 ((uint64_t)command
.parameters
[1] << 8) +
564 (uint64_t)command
.parameters
[2];
566 CCECBusDevice
*device
= GetDevice((cec_logical_address
) command
.initiator
);
568 device
->SetVendorId(iVendorId
);
571 const char *CCECCommandHandler::ToString(const cec_menu_state state
)
575 case CEC_MENU_STATE_ACTIVATED
:
577 case CEC_MENU_STATE_DEACTIVATED
:
578 return "deactivated";
584 const char *CCECCommandHandler::ToString(const cec_version version
)
588 case CEC_VERSION_1_2
:
590 case CEC_VERSION_1_2A
:
592 case CEC_VERSION_1_3
:
594 case CEC_VERSION_1_3A
:
596 case CEC_VERSION_1_4
:
603 const char *CCECCommandHandler::ToString(const cec_power_status status
)
607 case CEC_POWER_STATUS_ON
:
609 case CEC_POWER_STATUS_STANDBY
:
611 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
612 return "in transition from on to standby";
613 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
614 return "in transition from standby to on";
620 const char *CCECCommandHandler::ToString(const cec_logical_address address
)
624 case CECDEVICE_AUDIOSYSTEM
:
626 case CECDEVICE_BROADCAST
:
628 case CECDEVICE_FREEUSE
:
630 case CECDEVICE_PLAYBACKDEVICE1
:
632 case CECDEVICE_PLAYBACKDEVICE2
:
634 case CECDEVICE_PLAYBACKDEVICE3
:
636 case CECDEVICE_RECORDINGDEVICE1
:
638 case CECDEVICE_RECORDINGDEVICE2
:
640 case CECDEVICE_RECORDINGDEVICE3
:
642 case CECDEVICE_RESERVED1
:
644 case CECDEVICE_RESERVED2
:
646 case CECDEVICE_TUNER1
:
648 case CECDEVICE_TUNER2
:
650 case CECDEVICE_TUNER3
:
652 case CECDEVICE_TUNER4
:
661 const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode
)
665 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
666 return "skip forward wind";
667 case CEC_DECK_CONTROL_MODE_EJECT
:
669 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
670 return "reverse rewind";
671 case CEC_DECK_CONTROL_MODE_STOP
:
678 const char *CCECCommandHandler::ToString(const cec_deck_info status
)
682 case CEC_DECK_INFO_PLAY
:
684 case CEC_DECK_INFO_RECORD
:
686 case CEC_DECK_INFO_PLAY_REVERSE
:
687 return "play reverse";
688 case CEC_DECK_INFO_STILL
:
690 case CEC_DECK_INFO_SLOW
:
692 case CEC_DECK_INFO_SLOW_REVERSE
:
693 return "slow reverse";
694 case CEC_DECK_INFO_FAST_FORWARD
:
695 return "fast forward";
696 case CEC_DECK_INFO_FAST_REVERSE
:
697 return "fast reverse";
698 case CEC_DECK_INFO_NO_MEDIA
:
700 case CEC_DECK_INFO_STOP
:
702 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
703 return "info skip forward wind";
704 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
705 return "info skip reverse rewind";
706 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
707 return "info index search forward";
708 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
709 return "info index search reverse";
710 case CEC_DECK_INFO_OTHER_STATUS
:
717 const char *CCECCommandHandler::ToString(const cec_opcode opcode
)
721 case CEC_OPCODE_ACTIVE_SOURCE
:
722 return "active source";
723 case CEC_OPCODE_IMAGE_VIEW_ON
:
724 return "image view on";
725 case CEC_OPCODE_TEXT_VIEW_ON
:
726 return "text view on";
727 case CEC_OPCODE_INACTIVE_SOURCE
:
728 return "inactive source";
729 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
730 return "request active source";
731 case CEC_OPCODE_ROUTING_CHANGE
:
732 return "routing change";
733 case CEC_OPCODE_ROUTING_INFORMATION
:
734 return "routing information";
735 case CEC_OPCODE_SET_STREAM_PATH
:
736 return "set stream path";
737 case CEC_OPCODE_STANDBY
:
739 case CEC_OPCODE_RECORD_OFF
:
741 case CEC_OPCODE_RECORD_ON
:
743 case CEC_OPCODE_RECORD_STATUS
:
744 return "record status";
745 case CEC_OPCODE_RECORD_TV_SCREEN
:
746 return "record tv screen";
747 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
748 return "clear analogue timer";
749 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
750 return "clear digital timer";
751 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
752 return "clear external timer";
753 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
754 return "set analogue timer";
755 case CEC_OPCODE_SET_DIGITAL_TIMER
:
756 return "set digital timer";
757 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
758 return "set external timer";
759 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
760 return "set timer program title";
761 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
762 return "timer cleared status";
763 case CEC_OPCODE_TIMER_STATUS
:
764 return "timer status";
765 case CEC_OPCODE_CEC_VERSION
:
766 return "cec version";
767 case CEC_OPCODE_GET_CEC_VERSION
:
768 return "get cec version";
769 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
770 return "give physical address";
771 case CEC_OPCODE_GET_MENU_LANGUAGE
:
772 return "get menu language";
773 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
774 return "report physical address";
775 case CEC_OPCODE_SET_MENU_LANGUAGE
:
776 return "set menu language";
777 case CEC_OPCODE_DECK_CONTROL
:
778 return "deck control";
779 case CEC_OPCODE_DECK_STATUS
:
780 return "deck status";
781 case CEC_OPCODE_GIVE_DECK_STATUS
:
782 return "give deck status";
783 case CEC_OPCODE_PLAY
:
785 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
786 return "give tuner status";
787 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
788 return "select analogue service";
789 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
790 return "set digital service";
791 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
792 return "tuner device status";
793 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
794 return "tuner step decrement";
795 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
796 return "tuner step increment";
797 case CEC_OPCODE_DEVICE_VENDOR_ID
:
798 return "device vendor id";
799 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
800 return "give device vendor id";
801 case CEC_OPCODE_VENDOR_COMMAND
:
802 return "vendor command";
803 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
804 return "vendor command with id";
805 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
806 return "vendor remote button down";
807 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
808 return "vendor remote button up";
809 case CEC_OPCODE_SET_OSD_STRING
:
810 return "set osd string";
811 case CEC_OPCODE_GIVE_OSD_NAME
:
812 return "give osd name";
813 case CEC_OPCODE_SET_OSD_NAME
:
814 return "set osd name";
815 case CEC_OPCODE_MENU_REQUEST
:
816 return "menu request";
817 case CEC_OPCODE_MENU_STATUS
:
818 return "menu status";
819 case CEC_OPCODE_USER_CONTROL_PRESSED
:
820 return "user control pressed";
821 case CEC_OPCODE_USER_CONTROL_RELEASE
:
822 return "user control release";
823 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
824 return "give device power status";
825 case CEC_OPCODE_REPORT_POWER_STATUS
:
826 return "report power status";
827 case CEC_OPCODE_FEATURE_ABORT
:
828 return "feature abort";
829 case CEC_OPCODE_ABORT
:
831 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
832 return "give audio status";
833 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
834 return "give audio mode status";
835 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
836 return "report audio status";
837 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
838 return "set system audio mode";
839 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
840 return "system audio mode request";
841 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
842 return "system audio mode status";
843 case CEC_OPCODE_SET_AUDIO_RATE
:
844 return "set audio rate";
850 const char *CCECCommandHandler::ToString(const cec_system_audio_status mode
)
854 case CEC_SYSTEM_AUDIO_STATUS_ON
:
856 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
863 const char *CCECCommandHandler::ToString(const cec_audio_status status
)
865 // TODO this is a mask
869 const char *CCECCommandHandler::ToString(const cec_vendor_id vendor
)
873 case CEC_VENDOR_SAMSUNG
:
877 case CEC_VENDOR_PANASONIC
:
879 case CEC_VENDOR_PIONEER
:
881 case CEC_VENDOR_ONKYO
: