enable silent rules by default
[deb_libcec.git] / src / lib / CECTypeUtils.h
CommitLineData
0d800fe5
LOK
1#pragma once
2/*
3 * This file is part of the libCEC(R) library.
4 *
5 * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
6 * libCEC(R) is an original work, containing original code.
7 *
8 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 *
10 * This program is dual-licensed; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 *
25 * Alternatively, you can license this library under a commercial license,
26 * please contact Pulse-Eight Licensing for more information.
27 *
28 * For more information contact:
29 * Pulse-Eight Licensing <license@pulse-eight.com>
30 * http://www.pulse-eight.com/
31 * http://www.pulse-eight.net/
32 */
33
0d800fe5
LOK
34namespace CEC
35{
36 class CCECTypeUtils
37 {
38 public:
39 /*!
40 * @brief Get the device type for the given logical address.
41 * @param address The address to get the type for.
42 * @return The type, or CEC_DEVICE_TYPE_RESERVED if unknown.
43 */
44 static cec_device_type GetType(const cec_logical_address address)
45 {
46 switch (address)
47 {
48 case CECDEVICE_AUDIOSYSTEM:
49 return CEC_DEVICE_TYPE_AUDIO_SYSTEM;
50 case CECDEVICE_PLAYBACKDEVICE1:
51 case CECDEVICE_PLAYBACKDEVICE2:
52 case CECDEVICE_PLAYBACKDEVICE3:
53 return CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
54 case CECDEVICE_RECORDINGDEVICE1:
55 case CECDEVICE_RECORDINGDEVICE2:
56 case CECDEVICE_RECORDINGDEVICE3:
57 return CEC_DEVICE_TYPE_RECORDING_DEVICE;
58 case CECDEVICE_TUNER1:
59 case CECDEVICE_TUNER2:
60 case CECDEVICE_TUNER3:
61 case CECDEVICE_TUNER4:
62 return CEC_DEVICE_TYPE_TUNER;
63 case CECDEVICE_TV:
64 return CEC_DEVICE_TYPE_TV;
65 default:
66 return CEC_DEVICE_TYPE_RESERVED;
67 }
68 }
69
70 /*!
71 * @brief Get the ackmask for all devices of the same type as the given logical address.
72 * @param address The address to get the ackmask for.
73 * @return The ackmask for this type.
74 */
75 static uint16_t GetMaskForType(cec_logical_address address)
76 {
77 return GetMaskForType(GetType(address));
78 }
79
80 /*!
81 * @brief Get the ackmask for all devices of the given type.
82 * @param type The type to get the ackmask for.
83 * @return The ackmask for this type, or 0 of no types match.
84 */
85 static uint16_t GetMaskForType(const cec_device_type type)
86 {
87 switch (type)
88 {
89 case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
90 {
91 cec_logical_addresses addr;
92 addr.Clear();
93 addr.Set(CECDEVICE_AUDIOSYSTEM);
94 return addr.AckMask();
95 }
96 case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
97 {
98 cec_logical_addresses addr;
99 addr.Clear();
100 addr.Set(CECDEVICE_PLAYBACKDEVICE1);
101 addr.Set(CECDEVICE_PLAYBACKDEVICE2);
102 addr.Set(CECDEVICE_PLAYBACKDEVICE3);
103 return addr.AckMask();
104 }
105 case CEC_DEVICE_TYPE_RECORDING_DEVICE:
106 {
107 cec_logical_addresses addr;
108 addr.Clear();
109 addr.Set(CECDEVICE_RECORDINGDEVICE1);
110 addr.Set(CECDEVICE_RECORDINGDEVICE2);
111 addr.Set(CECDEVICE_RECORDINGDEVICE3);
112 return addr.AckMask();
113 }
114 case CEC_DEVICE_TYPE_TUNER:
115 {
116 cec_logical_addresses addr;
117 addr.Clear();
118 addr.Set(CECDEVICE_TUNER1);
119 addr.Set(CECDEVICE_TUNER2);
120 addr.Set(CECDEVICE_TUNER3);
121 addr.Set(CECDEVICE_TUNER4);
122 return addr.AckMask();
123 }
124 case CEC_DEVICE_TYPE_TV:
125 {
126 cec_logical_addresses addr;
127 addr.Clear();
128 addr.Set(CECDEVICE_TV);
129 return addr.AckMask();
130 }
131 default:
132 return 0;
133 }
134 }
135
136 static const char *ToString(const cec_device_type type)
137 {
138 switch (type)
139 {
140 case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
141 return "audio system";
142 case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
143 return "playback device";
144 case CEC_DEVICE_TYPE_RECORDING_DEVICE:
145 return "recording device";
146 case CEC_DEVICE_TYPE_RESERVED:
147 return "reserved";
148 case CEC_DEVICE_TYPE_TUNER:
149 return "tuner";
150 case CEC_DEVICE_TYPE_TV:
151 return "TV";
152 default:
153 return "unknown";
154 }
155 }
156
157 static const char *ToString(const cec_menu_state state)
158 {
159 switch (state)
160 {
161 case CEC_MENU_STATE_ACTIVATED:
162 return "activated";
163 case CEC_MENU_STATE_DEACTIVATED:
164 return "deactivated";
165 default:
166 return "unknown";
167 }
168 }
169
170 static const char *ToString(const cec_version version)
171 {
172 switch (version)
173 {
174 case CEC_VERSION_1_2:
175 return "1.2";
176 case CEC_VERSION_1_2A:
177 return "1.2a";
178 case CEC_VERSION_1_3:
179 return "1.3";
180 case CEC_VERSION_1_3A:
181 return "1.3a";
182 case CEC_VERSION_1_4:
183 return "1.4";
184 default:
185 return "unknown";
186 }
187 }
188
189 static const char *ToString(const cec_power_status status)
190 {
191 switch (status)
192 {
193 case CEC_POWER_STATUS_ON:
194 return "on";
195 case CEC_POWER_STATUS_STANDBY:
196 return "standby";
197 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
198 return "in transition from on to standby";
199 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
200 return "in transition from standby to on";
201 default:
202 return "unknown";
203 }
204 }
205
206 static const char *ToString(const cec_logical_address address)
207 {
208 switch(address)
209 {
210 case CECDEVICE_AUDIOSYSTEM:
211 return "Audio";
212 case CECDEVICE_BROADCAST:
213 return "Broadcast";
214 case CECDEVICE_FREEUSE:
215 return "Free use";
216 case CECDEVICE_PLAYBACKDEVICE1:
217 return "Playback 1";
218 case CECDEVICE_PLAYBACKDEVICE2:
219 return "Playback 2";
220 case CECDEVICE_PLAYBACKDEVICE3:
221 return "Playback 3";
222 case CECDEVICE_RECORDINGDEVICE1:
223 return "Recorder 1";
224 case CECDEVICE_RECORDINGDEVICE2:
225 return "Recorder 2";
226 case CECDEVICE_RECORDINGDEVICE3:
227 return "Recorder 3";
228 case CECDEVICE_RESERVED1:
229 return "Reserved 1";
230 case CECDEVICE_RESERVED2:
231 return "Reserved 2";
232 case CECDEVICE_TUNER1:
233 return "Tuner 1";
234 case CECDEVICE_TUNER2:
235 return "Tuner 2";
236 case CECDEVICE_TUNER3:
237 return "Tuner 3";
238 case CECDEVICE_TUNER4:
239 return "Tuner 4";
240 case CECDEVICE_TV:
241 return "TV";
242 default:
243 return "unknown";
244 }
245 }
246
247 static const char *ToString(const cec_deck_control_mode mode)
248 {
249 switch (mode)
250 {
251 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND:
252 return "skip forward wind";
253 case CEC_DECK_CONTROL_MODE_EJECT:
254 return "eject";
255 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND:
256 return "reverse rewind";
257 case CEC_DECK_CONTROL_MODE_STOP:
258 return "stop";
259 default:
260 return "unknown";
261 }
262 }
263
264 static const char *ToString(const cec_deck_info status)
265 {
266 switch (status)
267 {
268 case CEC_DECK_INFO_PLAY:
269 return "play";
270 case CEC_DECK_INFO_RECORD:
271 return "record";
272 case CEC_DECK_INFO_PLAY_REVERSE:
273 return "play reverse";
274 case CEC_DECK_INFO_STILL:
275 return "still";
276 case CEC_DECK_INFO_SLOW:
277 return "slow";
278 case CEC_DECK_INFO_SLOW_REVERSE:
279 return "slow reverse";
280 case CEC_DECK_INFO_FAST_FORWARD:
281 return "fast forward";
282 case CEC_DECK_INFO_FAST_REVERSE:
283 return "fast reverse";
284 case CEC_DECK_INFO_NO_MEDIA:
285 return "no media";
286 case CEC_DECK_INFO_STOP:
287 return "stop";
288 case CEC_DECK_INFO_SKIP_FORWARD_WIND:
289 return "info skip forward wind";
290 case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
291 return "info skip reverse rewind";
292 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
293 return "info index search forward";
294 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
295 return "info index search reverse";
296 case CEC_DECK_INFO_OTHER_STATUS:
297 return "other";
298 case CEC_DECK_INFO_OTHER_STATUS_LG:
299 return "LG other";
300 default:
301 return "unknown";
302 }
303 }
304
305 static const char *ToString(const cec_opcode opcode)
306 {
307 switch (opcode)
308 {
309 case CEC_OPCODE_ACTIVE_SOURCE:
310 return "active source";
311 case CEC_OPCODE_IMAGE_VIEW_ON:
312 return "image view on";
313 case CEC_OPCODE_TEXT_VIEW_ON:
314 return "text view on";
315 case CEC_OPCODE_INACTIVE_SOURCE:
316 return "inactive source";
317 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
318 return "request active source";
319 case CEC_OPCODE_ROUTING_CHANGE:
320 return "routing change";
321 case CEC_OPCODE_ROUTING_INFORMATION:
322 return "routing information";
323 case CEC_OPCODE_SET_STREAM_PATH:
324 return "set stream path";
325 case CEC_OPCODE_STANDBY:
326 return "standby";
327 case CEC_OPCODE_RECORD_OFF:
328 return "record off";
329 case CEC_OPCODE_RECORD_ON:
330 return "record on";
331 case CEC_OPCODE_RECORD_STATUS:
332 return "record status";
333 case CEC_OPCODE_RECORD_TV_SCREEN:
334 return "record tv screen";
335 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
336 return "clear analogue timer";
337 case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
338 return "clear digital timer";
339 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
340 return "clear external timer";
341 case CEC_OPCODE_SET_ANALOGUE_TIMER:
342 return "set analogue timer";
343 case CEC_OPCODE_SET_DIGITAL_TIMER:
344 return "set digital timer";
345 case CEC_OPCODE_SET_EXTERNAL_TIMER:
346 return "set external timer";
347 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
348 return "set timer program title";
349 case CEC_OPCODE_TIMER_CLEARED_STATUS:
350 return "timer cleared status";
351 case CEC_OPCODE_TIMER_STATUS:
352 return "timer status";
353 case CEC_OPCODE_CEC_VERSION:
354 return "cec version";
355 case CEC_OPCODE_GET_CEC_VERSION:
356 return "get cec version";
357 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
358 return "give physical address";
359 case CEC_OPCODE_GET_MENU_LANGUAGE:
360 return "get menu language";
361 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
362 return "report physical address";
363 case CEC_OPCODE_SET_MENU_LANGUAGE:
364 return "set menu language";
365 case CEC_OPCODE_DECK_CONTROL:
366 return "deck control";
367 case CEC_OPCODE_DECK_STATUS:
368 return "deck status";
369 case CEC_OPCODE_GIVE_DECK_STATUS:
370 return "give deck status";
371 case CEC_OPCODE_PLAY:
372 return "play";
373 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
374 return "give tuner status";
375 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
376 return "select analogue service";
377 case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
378 return "set digital service";
379 case CEC_OPCODE_TUNER_DEVICE_STATUS:
380 return "tuner device status";
381 case CEC_OPCODE_TUNER_STEP_DECREMENT:
382 return "tuner step decrement";
383 case CEC_OPCODE_TUNER_STEP_INCREMENT:
384 return "tuner step increment";
385 case CEC_OPCODE_DEVICE_VENDOR_ID:
386 return "device vendor id";
387 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
388 return "give device vendor id";
389 case CEC_OPCODE_VENDOR_COMMAND:
390 return "vendor command";
391 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
392 return "vendor command with id";
393 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
394 return "vendor remote button down";
395 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
396 return "vendor remote button up";
397 case CEC_OPCODE_SET_OSD_STRING:
398 return "set osd string";
399 case CEC_OPCODE_GIVE_OSD_NAME:
400 return "give osd name";
401 case CEC_OPCODE_SET_OSD_NAME:
402 return "set osd name";
403 case CEC_OPCODE_MENU_REQUEST:
404 return "menu request";
405 case CEC_OPCODE_MENU_STATUS:
406 return "menu status";
407 case CEC_OPCODE_USER_CONTROL_PRESSED:
408 return "user control pressed";
409 case CEC_OPCODE_USER_CONTROL_RELEASE:
410 return "user control release";
411 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
412 return "give device power status";
413 case CEC_OPCODE_REPORT_POWER_STATUS:
414 return "report power status";
415 case CEC_OPCODE_FEATURE_ABORT:
416 return "feature abort";
417 case CEC_OPCODE_ABORT:
418 return "abort";
419 case CEC_OPCODE_GIVE_AUDIO_STATUS:
420 return "give audio status";
421 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
422 return "give audio mode status";
423 case CEC_OPCODE_REPORT_AUDIO_STATUS:
424 return "report audio status";
425 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
426 return "set system audio mode";
427 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
428 return "system audio mode request";
429 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
430 return "system audio mode status";
431 case CEC_OPCODE_SET_AUDIO_RATE:
432 return "set audio rate";
433 case CEC_OPCODE_START_ARC:
434 return "start ARC";
435 case CEC_OPCODE_REPORT_ARC_STARTED:
436 return "report ARC started";
437 case CEC_OPCODE_REPORT_ARC_ENDED:
438 return "report ARC ended";
439 case CEC_OPCODE_REQUEST_ARC_START:
440 return "request ARC start";
441 case CEC_OPCODE_REQUEST_ARC_END:
442 return "request ARC end";
443 case CEC_OPCODE_END_ARC:
444 return "end ARC";
445 case CEC_OPCODE_CDC:
446 return "CDC";
447 case CEC_OPCODE_NONE:
448 return "poll";
449 default:
450 return "UNKNOWN";
451 }
452 }
453
454 static const char *ToString(const cec_system_audio_status mode)
455 {
456 switch(mode)
457 {
458 case CEC_SYSTEM_AUDIO_STATUS_ON:
459 return "on";
460 case CEC_SYSTEM_AUDIO_STATUS_OFF:
461 return "off";
462 default:
463 return "unknown";
464 }
465 }
466
467 static const char *ToString(const cec_audio_status UNUSED(status))
468 {
469 // TODO this is a mask
470 return "TODO";
471 }
472
473 static const char *ToString(const cec_vendor_id vendor)
474 {
475 switch (vendor)
476 {
477 case CEC_VENDOR_SAMSUNG:
478 return "Samsung";
479 case CEC_VENDOR_LG:
480 return "LG";
481 case CEC_VENDOR_PANASONIC:
482 return "Panasonic";
483 case CEC_VENDOR_PIONEER:
484 return "Pioneer";
485 case CEC_VENDOR_ONKYO:
486 return "Onkyo";
487 case CEC_VENDOR_YAMAHA:
488 return "Yamaha";
489 case CEC_VENDOR_PHILIPS:
490 return "Philips";
491 case CEC_VENDOR_SONY:
492 return "Sony";
493 case CEC_VENDOR_TOSHIBA:
494 return "Toshiba";
23d38eec
LOK
495 case CEC_VENDOR_AKAI:
496 return "Akai";
497 case CEC_VENDOR_AOC:
498 return "AOC";
499 case CEC_VENDOR_BENQ:
500 return "Benq";
501 case CEC_VENDOR_DAEWOO:
502 return "Daewoo";
503 case CEC_VENDOR_GRUNDIG:
504 return "Grundig";
505 case CEC_VENDOR_MEDION:
506 return "Medion";
507 case CEC_VENDOR_SHARP:
508 return "Sharp";
509 case CEC_VENDOR_VIZIO:
510 return "Vizio";
2b44051c
LOK
511 case CEC_VENDOR_BROADCOM:
512 return "Broadcom";
9cd871e3 513 case CEC_VENDOR_LOEWE:
514 return "Loewe";
0d800fe5
LOK
515 default:
516 return "Unknown";
517 }
518 }
519
520 static const char *ToString(const cec_client_version version)
521 {
522 switch (version)
523 {
524 case CEC_CLIENT_VERSION_PRE_1_5:
525 return "pre-1.5";
526 case CEC_CLIENT_VERSION_1_5_0:
527 return "1.5.0";
528 case CEC_CLIENT_VERSION_1_5_1:
529 return "1.5.1";
530 case CEC_CLIENT_VERSION_1_5_2:
531 return "1.5.2";
532 case CEC_CLIENT_VERSION_1_5_3:
533 return "1.5.3";
534 case CEC_CLIENT_VERSION_1_6_0:
535 return "1.6.0";
536 case CEC_CLIENT_VERSION_1_6_1:
537 return "1.6.1";
538 case CEC_CLIENT_VERSION_1_6_2:
539 return "1.6.2";
540 case CEC_CLIENT_VERSION_1_6_3:
541 return "1.6.3";
0a61dc24
LOK
542 case CEC_CLIENT_VERSION_1_7_0:
543 return "1.7.0";
92eea1e7
LOK
544 case CEC_CLIENT_VERSION_1_7_1:
545 return "1.7.1";
2b44051c
LOK
546 case CEC_CLIENT_VERSION_1_7_2:
547 return "1.7.2";
548 case CEC_CLIENT_VERSION_1_8_0:
549 return "1.8.0";
7e316a2f
LOK
550 case CEC_CLIENT_VERSION_1_8_1:
551 return "1.8.1";
2d418322
LOK
552 case CEC_CLIENT_VERSION_1_8_2:
553 return "1.8.2";
1664420d
LOK
554 case CEC_CLIENT_VERSION_1_9_0:
555 return "1.9.0";
f81c0652
LOK
556 case CEC_CLIENT_VERSION_1_99_0:
557 return "2.0.0-pre";
0d800fe5
LOK
558 default:
559 return "Unknown";
560 }
561 }
562
563 static const char *ToString(const cec_server_version version)
564 {
565 switch (version)
566 {
567 case CEC_SERVER_VERSION_PRE_1_5:
568 return "pre-1.5";
569 case CEC_SERVER_VERSION_1_5_0:
570 return "1.5.0";
571 case CEC_SERVER_VERSION_1_5_1:
572 return "1.5.1";
573 case CEC_SERVER_VERSION_1_5_2:
574 return "1.5.2";
575 case CEC_SERVER_VERSION_1_5_3:
576 return "1.5.3";
577 case CEC_SERVER_VERSION_1_6_0:
578 return "1.6.0";
579 case CEC_SERVER_VERSION_1_6_1:
580 return "1.6.1";
581 case CEC_SERVER_VERSION_1_6_2:
582 return "1.6.2";
583 case CEC_SERVER_VERSION_1_6_3:
584 return "1.6.3";
0a61dc24
LOK
585 case CEC_SERVER_VERSION_1_7_0:
586 return "1.7.0";
92eea1e7
LOK
587 case CEC_SERVER_VERSION_1_7_1:
588 return "1.7.1";
2b44051c
LOK
589 case CEC_SERVER_VERSION_1_7_2:
590 return "1.7.2";
591 case CEC_SERVER_VERSION_1_8_0:
592 return "1.8.0";
7e316a2f
LOK
593 case CEC_SERVER_VERSION_1_8_1:
594 return "1.8.1";
2d418322
LOK
595 case CEC_SERVER_VERSION_1_8_2:
596 return "1.8.2";
1664420d
LOK
597 case CEC_SERVER_VERSION_1_9_0:
598 return "1.9.0";
f81c0652
LOK
599 case CEC_SERVER_VERSION_1_99_0:
600 return "2.0.0-pre";
0d800fe5
LOK
601 default:
602 return "Unknown";
603 }
604 }
9a54dc82
LOK
605
606 static const char *ToString(const cec_abort_reason reason)
607 {
608 switch(reason)
609 {
610 case CEC_ABORT_REASON_UNRECOGNIZED_OPCODE:
611 return "unrecognised opcode";
612 case CEC_ABORT_REASON_NOT_IN_CORRECT_MODE_TO_RESPOND:
613 return "not in correct mode to respond";
614 case CEC_ABORT_REASON_CANNOT_PROVIDE_SOURCE:
615 return "cannot provide source";
616 case CEC_ABORT_REASON_INVALID_OPERAND:
617 return "invalid operand";
618 case CEC_ABORT_REASON_REFUSED:
619 return "refused";
620 default:
621 return "unknown";
622 }
623 }
2b44051c
LOK
624
625 static const char *ToString(const cec_user_control_code key)
626 {
627 switch (key)
628 {
629 case CEC_USER_CONTROL_CODE_SELECT:
630 return "select";
631 case CEC_USER_CONTROL_CODE_UP:
632 return "up";
633 case CEC_USER_CONTROL_CODE_DOWN:
634 return "down";
635 case CEC_USER_CONTROL_CODE_LEFT:
636 return "left";
637 case CEC_USER_CONTROL_CODE_RIGHT:
638 return "right";
639 case CEC_USER_CONTROL_CODE_RIGHT_UP:
640 return "right+up";
641 case CEC_USER_CONTROL_CODE_RIGHT_DOWN:
642 return "right+down";
643 case CEC_USER_CONTROL_CODE_LEFT_UP:
644 return "left+up";
645 case CEC_USER_CONTROL_CODE_LEFT_DOWN:
646 return "left+down";
647 case CEC_USER_CONTROL_CODE_ROOT_MENU:
648 return "root menu";
649 case CEC_USER_CONTROL_CODE_SETUP_MENU:
650 return "setup menu";
651 case CEC_USER_CONTROL_CODE_CONTENTS_MENU:
652 return "contents menu";
653 case CEC_USER_CONTROL_CODE_FAVORITE_MENU:
654 return "favourite menu";
655 case CEC_USER_CONTROL_CODE_EXIT:
656 return "exit";
657 case CEC_USER_CONTROL_CODE_NUMBER0:
658 return "0";
659 case CEC_USER_CONTROL_CODE_NUMBER1:
660 return "1";
661 case CEC_USER_CONTROL_CODE_NUMBER2:
662 return "2";
663 case CEC_USER_CONTROL_CODE_NUMBER3:
664 return "3";
665 case CEC_USER_CONTROL_CODE_NUMBER4:
666 return "4";
667 case CEC_USER_CONTROL_CODE_NUMBER5:
668 return "5";
669 case CEC_USER_CONTROL_CODE_NUMBER6:
670 return "6";
671 case CEC_USER_CONTROL_CODE_NUMBER7:
672 return "7";
673 case CEC_USER_CONTROL_CODE_NUMBER8:
674 return "8";
675 case CEC_USER_CONTROL_CODE_NUMBER9:
676 return "9";
677 case CEC_USER_CONTROL_CODE_DOT:
678 return ".";
679 case CEC_USER_CONTROL_CODE_ENTER:
680 return "enter";
681 case CEC_USER_CONTROL_CODE_CLEAR:
682 return "clear";
683 case CEC_USER_CONTROL_CODE_NEXT_FAVORITE:
684 return "next favourite";
685 case CEC_USER_CONTROL_CODE_CHANNEL_UP:
686 return "channel up";
687 case CEC_USER_CONTROL_CODE_CHANNEL_DOWN:
688 return "channel down";
689 case CEC_USER_CONTROL_CODE_PREVIOUS_CHANNEL:
690 return "previous channel";
691 case CEC_USER_CONTROL_CODE_SOUND_SELECT:
692 return "sound select";
693 case CEC_USER_CONTROL_CODE_INPUT_SELECT:
694 return "input select";
695 case CEC_USER_CONTROL_CODE_DISPLAY_INFORMATION:
696 return "display information";
697 case CEC_USER_CONTROL_CODE_HELP:
698 return "help";
699 case CEC_USER_CONTROL_CODE_PAGE_UP:
700 return "page up";
701 case CEC_USER_CONTROL_CODE_PAGE_DOWN:
702 return "page down";
703 case CEC_USER_CONTROL_CODE_POWER:
704 return "power";
705 case CEC_USER_CONTROL_CODE_VOLUME_UP:
706 return "volume up";
707 case CEC_USER_CONTROL_CODE_VOLUME_DOWN:
708 return "volume down";
709 case CEC_USER_CONTROL_CODE_MUTE:
710 return "mute";
711 case CEC_USER_CONTROL_CODE_PLAY:
712 return "play";
713 case CEC_USER_CONTROL_CODE_STOP:
714 return "stop";
715 case CEC_USER_CONTROL_CODE_PAUSE:
716 return "pause";
717 case CEC_USER_CONTROL_CODE_RECORD:
718 return "record";
719 case CEC_USER_CONTROL_CODE_REWIND:
720 return "rewind";
721 case CEC_USER_CONTROL_CODE_FAST_FORWARD:
722 return "Fast forward";
723 case CEC_USER_CONTROL_CODE_EJECT:
724 return "eject";
725 case CEC_USER_CONTROL_CODE_FORWARD:
726 return "forward";
727 case CEC_USER_CONTROL_CODE_BACKWARD:
728 return "backward";
729 case CEC_USER_CONTROL_CODE_STOP_RECORD:
730 return "stop record";
731 case CEC_USER_CONTROL_CODE_PAUSE_RECORD:
732 return "pause record";
733 case CEC_USER_CONTROL_CODE_ANGLE:
734 return "angle";
735 case CEC_USER_CONTROL_CODE_SUB_PICTURE:
736 return "sub picture";
737 case CEC_USER_CONTROL_CODE_VIDEO_ON_DEMAND:
738 return "video on demand";
739 case CEC_USER_CONTROL_CODE_ELECTRONIC_PROGRAM_GUIDE:
740 return "electronic program guide";
741 case CEC_USER_CONTROL_CODE_TIMER_PROGRAMMING:
742 return "timer programming";
743 case CEC_USER_CONTROL_CODE_INITIAL_CONFIGURATION:
744 return "initial configuration";
745 case CEC_USER_CONTROL_CODE_PLAY_FUNCTION:
746 return "play (function)";
747 case CEC_USER_CONTROL_CODE_PAUSE_PLAY_FUNCTION:
748 return "pause play (function)";
749 case CEC_USER_CONTROL_CODE_RECORD_FUNCTION:
750 return "record (function)";
751 case CEC_USER_CONTROL_CODE_PAUSE_RECORD_FUNCTION:
752 return "pause record (function)";
753 case CEC_USER_CONTROL_CODE_STOP_FUNCTION:
754 return "stop (function)";
755 case CEC_USER_CONTROL_CODE_MUTE_FUNCTION:
756 return "mute (function)";
757 case CEC_USER_CONTROL_CODE_RESTORE_VOLUME_FUNCTION:
758 return "restore volume";
759 case CEC_USER_CONTROL_CODE_TUNE_FUNCTION:
760 return "tune";
761 case CEC_USER_CONTROL_CODE_SELECT_MEDIA_FUNCTION:
762 return "select media";
763 case CEC_USER_CONTROL_CODE_SELECT_AV_INPUT_FUNCTION:
764 return "select AV input";
765 case CEC_USER_CONTROL_CODE_SELECT_AUDIO_INPUT_FUNCTION:
766 return "select audio input";
767 case CEC_USER_CONTROL_CODE_POWER_TOGGLE_FUNCTION:
768 return "power toggle";
769 case CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION:
770 return "power off";
771 case CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION:
772 return "power on";
773 case CEC_USER_CONTROL_CODE_F1_BLUE:
774 return "F1 (blue)";
775 case CEC_USER_CONTROL_CODE_F2_RED:
776 return "F2 (red)";
777 case CEC_USER_CONTROL_CODE_F3_GREEN:
778 return "F3 (green)";
779 case CEC_USER_CONTROL_CODE_F4_YELLOW:
780 return "F4 (yellow)";
781 case CEC_USER_CONTROL_CODE_F5:
782 return "F5";
783 case CEC_USER_CONTROL_CODE_DATA:
784 return "data";
785 case CEC_USER_CONTROL_CODE_AN_RETURN:
786 return "return (Samsung)";
787 case CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST:
788 return "channels list (Samsung)";
789 default:
790 return "unknown";
791 }
792 }
2d418322
LOK
793
794 static const char *ToString(const cec_adapter_type type)
795 {
796 switch (type)
797 {
798 case ADAPTERTYPE_P8_EXTERNAL:
799 return "Pulse-Eight USB-CEC Adapter";
800 case ADAPTERTYPE_P8_DAUGHTERBOARD:
801 return "Pulse-Eight USB-CEC Daughterboard";
802 case ADAPTERTYPE_RPI:
803 return "Raspberry Pi";
804 default:
805 return "unknown";
806 }
807 }
0d800fe5
LOK
808 };
809}