RDK Documentation (Open Sourced RDK Components)
Operands.hpp
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 /**
23 * @defgroup hdmicec
24 * @{
25 * @defgroup ccec
26 * @{
27 **/
28 
29 #ifndef HDMI_CCEC_OPERANDS_HPP_
30 #define HDMI_CCEC_OPERANDS_HPP_
31 #include <stdint.h>
32 
33 #include <cstring>
34 #include <cstdio>
35 #include <vector>
36 
37 #include <sstream>
38 
39 #include "CCEC.hpp"
40 #include "Assert.hpp"
41 #include "Operand.hpp"
42 #include "Util.hpp"
43 #include "ccec/CECFrame.hpp"
44 #include "ccec/Exception.hpp"
45 
46 CCEC_BEGIN_NAMESPACE
47 
48 class CECBytes : public Operand
49 {
50 protected:
51  CECBytes(const uint8_t val) : str(1, val) {}
52  CECBytes(const uint8_t *buf, size_t len) {
53  if (buf && len) {
54  for (size_t i = 0; i < len; i++) {
55  str.push_back(buf[i]);
56  }
57  }
58  }
59 
60  bool validate(void) const {
61  return (str.size() && (str.size() <= getMaxLen()));
62  }
63 
64  CECBytes(const CECFrame &frame, size_t startPos, size_t len) {
65  /*
66  * For HDMI CEC definition, the [OSD Name] and [OSD STring] are always the one
67  * and only one operands in the message. It is not clear if these strings are
68  * null terminated. Therefore, consume all remaining bytes in the frame as
69  * CECBytes
70  */
71  const uint8_t *buf = 0;
72  size_t frameLen = 0;
73  frame.getBuffer(&buf, &frameLen);
74  str.clear();
75  len = ((startPos + len) > frameLen) ? frameLen - startPos : len;
76  str.insert(str.begin(), buf + startPos, buf + startPos + len);
77  if (!validate())
78  {
79  throw InvalidParamException();
80  }
81  }
82 
83 public:
84  CECFrame &serialize(CECFrame &frame) const {
85  for (size_t i = 0; i < str.size(); i++) {
86  frame.append(str[i]);
87  }
88 
89  return frame;
90  }
91  using Operand::serialize;
92 
93  ~CECBytes(void) {}
94 
95  virtual const std::string toString(void) const {
96  std::stringstream stream;
97  for (size_t i = 0; i < str.size(); i++) {
98  stream << std::hex << (int)str[i];
99  }
100  return stream.str();
101  };
102 
103  bool operator == (const CECBytes &in) const {
104  return this->str == in.str;
105  }
106 
107 protected:
108  std::vector<uint8_t> str;
109  virtual size_t getMaxLen(void) const {
110  return CECFrame::MAX_LENGTH;
111  }
112 };
113 
114 class OSDString : public CECBytes
115 {
116 public:
117  enum {
118  MAX_LEN = 13,
119  };
120 
121  OSDString(const char *str) : CECBytes((const uint8_t *)str, strlen(str)) {
122  validate();
123  }
124 
125  OSDString(const CECFrame &frame, size_t startPos) : CECBytes(frame, startPos, MAX_LEN) {
126  }
127 
128  const std::string toString(void) const {
129  return std::string(str.begin(), str.end());
130  }
131 protected:
132  size_t getMaxLen() const {return MAX_LEN;}
133 };
134 
135 class OSDName : public CECBytes
136 {
137 public:
138  enum {
139  MAX_LEN = 14,
140  };
141 
142  OSDName(const char *str) : CECBytes((const uint8_t *)str, strlen(str)) {
143  validate();
144  }
145 
146  OSDName(const CECFrame &frame, size_t startPos) : CECBytes(frame, startPos, MAX_LEN) {
147  }
148 
149  const std::string toString(void) const {
150  return std::string(str.begin(), str.end());
151  }
152 protected:
153  size_t getMaxLen() const {return MAX_LEN;}
154 };
155 
156 class AbortReason : public CECBytes
157 {
158 public :
159  enum {
160  MAX_LEN = 1,
161  };
162 
163  enum {
164  UNRECOGNIZED_OPCODE,
165  NOT_IN_CORRECT_MODE_TO_RESPOND,
166  CANNOT_OVERIDE_SOURCE,
167  INVALID_OPERAND,
168  REFUSED,
169  UNABLE_TO_DETERMINE,
170  };
171 
172  AbortReason(int reason) : CECBytes((uint8_t)reason) { }
173 
174  const std::string toString(void) const {
175  static const char *names_[] = {
176  "Unrecognized opcode",
177  "Not in correct mode to respond",
178  "Cannot provide source",
179  "Invalid operand",
180  "Refused",
181  "Unable to determine",
182  };
183 
184  if (validate())
185  {
186  return names_[str[0]];
187  }
188  else
189  {
190  CCEC_LOG(LOG_WARN,"Unknown abort reason:%x\n", str[0]);
191  return "Unknown";
192  }
193  }
194 
195  bool validate(void) const {
196  return (/*(str[0]>= UNRECOGNIZED_OPCODE) && */(str[0]<= UNABLE_TO_DETERMINE));
197  }
198 
199  int toInt(void) const {
200  return str[0];
201  }
202 
203  AbortReason(const CECFrame &frame, size_t startPos) : CECBytes(frame, startPos, MAX_LEN) { }
204 
205 
206 protected:
207  size_t getMaxLen() const {return MAX_LEN;}
208 
209 };
210 
211 class DeviceType : public CECBytes
212 {
213 public :
214  enum {
215  MAX_LEN = 1,
216  };
217 
218  enum {
219  TV = 0x0,
220  RECORDING_DEVICE,
221  RESERVED,
222  TUNER,
223  PLAYBACK_DEVICE,
224  AUDIO_SYSTEM,
225  PURE_CEC_SWITCH,
226  VIDEO_PROCESSOR,
227  };
228 
229  DeviceType(int type) : CECBytes((uint8_t)type) {}
230 
231  const std::string toString(void) const {
232  static const char *names_[] = {
233  "TV",
234  "Recording Device",
235  "Reserved",
236  "Tuner",
237  "Playback Device",
238  "Audio System",
239  "Pure CEC Switch",
240  "Video Processor",
241  };
242 
243  if (validate())
244  {
245  return names_[str[0]];
246  }
247  else
248  {
249  CCEC_LOG(LOG_WARN,"Unknown device type:%x\n", str[0]);
250  return "Unknown";
251  }
252  }
253 
254  bool validate(void) const {
255  return (/*(str[0] >= TV) && */(str[0] <= VIDEO_PROCESSOR));
256  }
257 
258  DeviceType(const CECFrame &frame, size_t startPos) : CECBytes(frame, startPos, MAX_LEN) {}
259 
260  ~DeviceType(void) {}
261 
262 protected:
263  size_t getMaxLen() const {return MAX_LEN;}
264 };
265 
266 class Language : public CECBytes
267 {
268 public:
269  enum {
270  MAX_LEN = 3,
271  };
272 
273  Language(const char *str) : CECBytes((const uint8_t*)str, MAX_LEN) {
274  validate();
275  }
276 
277  Language(const CECFrame &frame, size_t startPos) : CECBytes(frame, startPos, MAX_LEN) {
278  }
279 
280  const std::string toString(void) const {
281  return std::string(str.begin(), str.end());
282  }
283 protected:
284  size_t getMaxLen() const {return MAX_LEN;}
285 };
286 
287 
288 class VendorID : public CECBytes
289 {
290 public:
291  enum {
292  MAX_LEN = 3,
293  };
294 
295  VendorID(uint8_t byte0, uint8_t byte1, uint8_t byte2) : CECBytes (NULL, 0) {
296  uint8_t bytes[MAX_LEN];
297  bytes[0] = byte0;
298  bytes[1] = byte1;
299  bytes[2] = byte2;
300  str.insert(str.begin(), bytes, bytes + MAX_LEN);
301  }
302 
303  VendorID(const uint8_t *buf, size_t len) : CECBytes (buf, len > MAX_LEN ? MAX_LEN : len) {
304  }
305 
306  VendorID(const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
307  };
308 
309 protected:
310  size_t getMaxLen() const {return MAX_LEN;}
311 
312 };
313 
314 class PhysicalAddress : public CECBytes
315 {
316  public:
317  enum {
318  MAX_LEN = 2,
319  };
320 
321  PhysicalAddress(uint8_t byte0, uint8_t byte1, uint8_t byte2, uint8_t byte3) : CECBytes (NULL, 0) {
322  uint8_t bytes[MAX_LEN];
323  bytes[0] = (byte0 & 0x0F)<< 4 | (byte1 & 0x0F);
324  bytes[1] = (byte2 & 0x0F)<< 4 | (byte3 & 0x0F);
325  str.insert(str.begin(), bytes, bytes + MAX_LEN);
326  }
327 
328  PhysicalAddress(uint8_t *buf, size_t len = MAX_LEN) : CECBytes(buf, MAX_LEN) {
329  Assert(len >= MAX_LEN);
330  }
331 
332  PhysicalAddress(const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
333  };
334 
335  PhysicalAddress(std::string &addr) : CECBytes (NULL, 0) {
336  uint8_t byte[4];
337  uint8_t bytes[MAX_LEN];
338  size_t dotposition = 0;
339  int i = 0;
340 
341  Assert((addr.length() != 0 && addr.length() == 7));
342 
343  while (addr.length() && i < 4)
344  {
345  byte[i++] = stoi(addr,&dotposition,16);
346  if (addr.length() > 1)
347  {
348  addr = addr.substr(dotposition+1);
349  }
350  else
351  {
352  break;
353  }
354  }
355 
356  bytes[0] = (byte[0] & 0x0F)<< 4 | (byte[1] & 0x0F);
357  bytes[1] = (byte[2] & 0x0F)<< 4 | (byte[3] & 0x0F);
358  str.insert(str.begin(), bytes, bytes + MAX_LEN);
359  }
360 
361  const uint8_t getByteValue( int index) const {
362  uint8_t val = 0;
363 
364  Assert(index < 4);
365 
366  switch(index)
367  {
368  case 0:
369  {
370  val = (int) ((str[0] & 0xF0) >> 4);
371  }
372  break;
373  case 1:
374  {
375  val = (int) (str[0] & 0x0F);
376  }
377  break;
378 
379  case 2:
380  {
381  val = (int) ((str[1] & 0xF0) >> 4);
382  }
383  break;
384 
385  case 3:
386  {
387  val = (int) (str[1] & 0x0F);
388  }
389  break;
390  }
391 
392  return val;
393  }
394 
395  const std::string toString(void) const {
396  std::stringstream stream;
397  stream << (int)((str[0] & 0xF0) >> 4)<< "." << (int)(str[0] & 0x0F) << "." << (int)((str[1] & 0xF0) >> 4) << "." << (int)(str[1] & 0x0F);
398  return stream.str();
399  }
400 
401  const std::string name(void) const {
402  return "PhysicalAddress";
403  }
404 
405 protected:
406  size_t getMaxLen() const {return MAX_LEN;}
407 };
408 
409 class LogicalAddress : public CECBytes
410 {
411 public:
412  enum {
413  MAX_LEN = 1,
414  };
415 
416  static const LogicalAddress kTv;
417 
418  enum {
419  TV = 0,
420  RECORDING_DEVICE_1 = 1,
421  RECORDING_DEVICE_2 = 2,
422  TUNER_1 = 3,
423  PLAYBACK_DEVICE_1 = 4,
424  AUDIO_SYSTEM = 5,
425  TUNER_2 = 6,
426  TUNER_3 = 7,
427  PLAYBACK_DEVICE_2 = 8,
428  RECORDING_DEVICE_3 = 9,
429  TUNER_4 = 10,
430  PLAYBACK_DEVICE_3 = 11,
431  RESERVED_12 = 12,
432  RESERVED_13 = 13,
433  SPECIFIC_USE = 14,
434  UNREGISTERED = 15,
435  BROADCAST = UNREGISTERED,
436  };
437 
438  LogicalAddress(int addr = UNREGISTERED) : CECBytes((uint8_t)addr) { };
439 
440  const std::string toString(void) const
441  {
442  static const char *names_[] = {
443  "TV",
444  "Recording Device 1",
445  "Recording Device 2",
446  "Tuner 1",
447  "Playback Device 1",
448  "Audio System",
449  "Tuner 2",
450  "Tuner 3",
451  "Playback Device 2",
452  "Recording Device 3",
453  "Tuner 4",
454  "Playback Device 3",
455  "Reserved 12",
456  "Reserved 13",
457  "Specific Use",
458  "Broadcast/Unregistered",
459  };
460 
461  if (validate())
462  {
463  return names_[str[0]];
464  }
465  else
466  {
467  CCEC_LOG(LOG_WARN,"Unknown logical address:%x\n", str[0]);
468  return "Unknown";
469  }
470  }
471 
472  int toInt(void) const {
473  return str[0];
474  }
475 
476  bool validate(void) const {
477  return ((str[0] <= BROADCAST) && (str[0] >= TV));
478  }
479 
480  int getType(void) const {
481 
482  if (!validate()) {
483  throw InvalidParamException();
484  }
485 
486  static int _type[] = {
487  DeviceType::TV,
488  DeviceType::RECORDING_DEVICE,
489  DeviceType::RECORDING_DEVICE,
490  DeviceType::TUNER,
491  DeviceType::PLAYBACK_DEVICE,
492  DeviceType::AUDIO_SYSTEM,
493  DeviceType::TUNER,
494  DeviceType::TUNER,
495  DeviceType::PLAYBACK_DEVICE,
496  DeviceType::RECORDING_DEVICE,
497  DeviceType::TUNER,
498  DeviceType::PLAYBACK_DEVICE,
499  DeviceType::RESERVED,
500  DeviceType::RESERVED,
501  DeviceType::RESERVED,
502  DeviceType::RESERVED,
503  };
504 
505  return _type[str[0]];
506  }
507 
508  LogicalAddress(const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
509  };
510 protected:
511  size_t getMaxLen() const {return MAX_LEN;}
512 };
513 
514 class Version : public CECBytes
515 {
516 public:
517  enum {
518  MAX_LEN = 1,
519  };
520 
521  enum {
522  V_RESERVED_0,
523  V_RESERVED_1,
524  V_RESERVED_2,
525  V_RESERVED_3,
526  V_1_3a,
527  V_1_4,
528  };
529 
530  Version(int version) : CECBytes((uint8_t)version) { };
531 
532  bool validate(void) const {
533  return ((str[0] <= V_1_4) && (str[0] >= V_1_3a));
534  }
535 
536  const std::string toString(void) const
537  {
538  static const char *names_[] = {
539  "Reserved",
540  "Reserved",
541  "Reserved",
542  "Reserved",
543  "Version 1.3a",
544  "Version 1.4",
545  };
546 
547  if (validate())
548  {
549  return names_[str[0]];
550  }
551  else
552  {
553  CCEC_LOG(LOG_WARN,"Unknown version:%x\n", str[0]);
554  return "Unknown";
555  }
556  }
557 
558  Version (const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
559  };
560 protected:
561  size_t getMaxLen() const {return MAX_LEN;}
562 };
563 
564 class PowerStatus : public CECBytes
565 {
566 public:
567  enum {
568  MAX_LEN = 1,
569  };
570 
571  enum {
572  ON = 0,
573  STANDBY = 0x01,
574  IN_TRANSITION_STANDBY_TO_ON = 0x02,
575  IN_TRANSITION_ON_TO_STANDBY = 0x03,
576  POWER_STATUS_NOT_KNOWN = 0x4,
577  POWER_STATUS_FEATURE_ABORT = 0x05,
578  };
579 
580  PowerStatus(int status) : CECBytes((uint8_t)status) { };
581 
582  bool validate(void) const {
583  return ((str[0] <= IN_TRANSITION_ON_TO_STANDBY)/* && (str[0] >= ON)*/);
584  }
585 
586  const std::string toString(void) const
587  {
588  static const char *names_[] = {
589  "On",
590  "Standby",
591  "In transition Standby to On",
592  "In transition On to Standby",
593  "Not Known",
594  "Feature Abort"
595  };
596 
597  if (validate())
598  {
599  return names_[str[0]];
600  }
601  else
602  {
603  CCEC_LOG(LOG_WARN,"Unknown powerstatus:%x\n", str[0]);
604  return "Unknown";
605  }
606  }
607 
608  int toInt(void) const {
609  return str[0];
610  }
611 
612  PowerStatus (const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
613  };
614 
615 protected:
616  size_t getMaxLen() const {return MAX_LEN;}
617 };
618 
620 {
621  public :
622  enum {
623  MAX_LEN = 1,
624  };
625 
626  enum {
627 
628  SAD_FMT_CODE_LPCM =1 , // 1
629  SAD_FMT_CODE_AC3, // 2
630  SAD_FMT_CODE_MPEG1, // 3
631  SAD_FMT_CODE_MP3, // 4
632  SAD_FMT_CODE_MPEG2, // 5
633  SAD_FMT_CODE_AAC_LC, // 6
634  SAD_FMT_CODE_DTS, // 7
635  SAD_FMT_CODE_ATRAC, // 8
636  SAD_FMT_CODE_ONE_BIT_AUDIO, // 9
637  SAD_FMT_CODE_ENHANCED_AC3, // 10
638  SAD_FMT_CODE_DTS_HD, // 11
639  SAD_FMT_CODE_MAT, // 12
640  SAD_FMT_CODE_DST, // 13
641  SAD_FMT_CODE_WMA_PRO, // 14
642  SAD_FMT_CODE_EXTENDED, // 15
643  };
644  RequestAudioFormat(uint8_t AudioFormatIdCode) : CECBytes((uint8_t)AudioFormatIdCode) { };
645  RequestAudioFormat(const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos,MAX_LEN) { };
646  const std::string toString(void) const
647  {
648  static const char *AudioFormtCode[] = {
649  "Reserved",
650  "LPCM",
651  "AC3",
652  "MPEG1",
653  "MP3",
654  "MPEG2",
655  "AAC",
656  "DTS",
657  "ATRAC",
658  "One Bit Audio",
659  "E-AC3",
660  "DTS-HD",
661  "MAT",
662  "DST",
663  "WMA PRO",
664  "Reserved for Audio format 15",
665  };
666  /* audio formt code uses 6 bits but codes are defined only for 15 codes */
667  return AudioFormtCode[str[0] & 0xF];
668  }
669  int getAudioformatId(void) const {
670 
671  return (str[0]>>6);
672  };
673 
674  int getAudioformatCode(void) const {
675 
676  return (str[0] & 0x3F);
677 
678  };
679 protected:
680  size_t getMaxLen() const {return MAX_LEN;}
681 };
682 
684 {
685  public :
686  enum {
687  MAX_LEN = 3,
688  };
689 
690  enum {
691 
692  SAD_FMT_CODE_LPCM =1 , // 1
693  SAD_FMT_CODE_AC3, // 2
694  SAD_FMT_CODE_MPEG1, // 3
695  SAD_FMT_CODE_MP3, // 4
696  SAD_FMT_CODE_MPEG2, // 5
697  SAD_FMT_CODE_AAC_LC, // 6
698  SAD_FMT_CODE_DTS, // 7
699  SAD_FMT_CODE_ATRAC, // 8
700  SAD_FMT_CODE_ONE_BIT_AUDIO, // 9
701  SAD_FMT_CODE_ENHANCED_AC3, // 10
702  SAD_FMT_CODE_DTS_HD, // 11
703  SAD_FMT_CODE_MAT, // 12
704  SAD_FMT_CODE_DST, // 13
705  SAD_FMT_CODE_WMA_PRO, // 14
706  SAD_FMT_CODE_EXTENDED, // 15
707 
708  };
709 
710  ShortAudioDescriptor(uint8_t *buf, size_t len = MAX_LEN) : CECBytes(buf, MAX_LEN) {
711  Assert(len >= MAX_LEN);
712  };
713  ShortAudioDescriptor(const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos,MAX_LEN) {
714  };
715  const std::string toString(void) const
716  {
717 
718  static const char *AudioFormtCode[] = {
719  "Reserved",
720  "LPCM",
721  "AC3",
722  "MPEG1",
723  "MP3",
724  "MPEG2",
725  "AAC",
726  "DTS",
727  "ATRAC",
728  "One Bit Audio",
729  "E-AC3",
730  "DTS-HD",
731  "MAT",
732  "DST",
733  "WMA PRO",
734  "Reserved for Audio format 15",
735  };
736  /* audio formt code uses 6 bits but codes are defined only for 15 codes */
737  return AudioFormtCode[(str[0] >> 3) & 0xF];
738  }
739 
740  uint32_t getAudiodescriptor(void) const {
741  uint32_t audiodescriptor;
742 
743  audiodescriptor = (str[0] | str[1] << 8 | str[2] << 16);
744  return audiodescriptor;
745 
746  };
747 
748  int getAudioformatCode(void) const {
749  uint8_t audioformatCode;
750  audioformatCode = ((str[0] >> 3) & 0xF);
751  return audioformatCode;
752 
753  };
754  uint8_t getAtmosbit(void) const {
755 
756  bool atmosSupport = false;
757  if ((((str[0] >> 3) & 0xF) >= 9) && (((str[0] >> 3) & 0xF) <= 15))
758  {
759  if((str[2] & 0x3) != 0)
760  {
761  atmosSupport = true;
762  }
763 
764  }
765  return atmosSupport;
766  };
767 
768 protected:
769  size_t getMaxLen() const {return MAX_LEN;}
770 
771 };
773 {
774 public:
775  enum {
776  MAX_LEN = 1,
777  };
778 
779  enum {
780  OFF = 0x00,
781  ON = 0x01,
782  };
783 
784  SystemAudioStatus(int status) : CECBytes((uint8_t)status) { };
785 
786  bool validate(void) const {
787  return ((str[0] <= ON) );
788  }
789 
790  const std::string toString(void) const
791  {
792  static const char *names_[] = {
793  "Off",
794  "On",
795  };
796 
797  if (validate())
798  {
799  return names_[str[0]];
800  }
801  else
802  {
803  CCEC_LOG(LOG_WARN,"Unknown SystemAudioStatus:%x\n", str[0]);
804  return "Unknown";
805  }
806  }
807 
808  int toInt(void) const {
809  return str[0];
810  }
811 
812  SystemAudioStatus (const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
813  };
814 
815 protected:
816  size_t getMaxLen() const {return MAX_LEN;}
817 };
818 class AudioStatus : public CECBytes
819 {
820  public:
821  enum {
822  MAX_LEN = 1,
823  };
824 
825  enum {
826  AUDIO_MUTE_OFF = 0x00,
827  AUDIO_MUTE_ON = 0x01,
828  };
829  AudioStatus(uint8_t status) : CECBytes((uint8_t)status) { };
830 
831  bool validate(void) const {
832  return (((str[0] & 0x80) >> 7) <= AUDIO_MUTE_ON) ;
833  }
834  const std::string toString(void) const
835  {
836  static const char *names_[] = {
837  "Audio Mute Off",
838  "Audio Mute On",
839  };
840  if (validate())
841  {
842  return names_[((str[0] & 0x80) >> 7)];
843  }
844  else
845  {
846  CCEC_LOG(LOG_WARN,"Unknown Audio Mute Status:%x\n", str[0]);
847  return "Unknown";
848  }
849  }
850  int getAudioMuteStatus(void) const {
851  return ((str[0] & 0x80) >> 7);
852  };
853  int getAudioVolume(void) const {
854  return (str[0] & 0x7F);
855  }
856  AudioStatus ( const CECFrame &frame, size_t startPos) : CECBytes (frame, startPos, MAX_LEN) {
857  };
858 protected:
859  size_t getMaxLen() const {return MAX_LEN;}
860 };
861 class UICommand : public CECBytes
862 {
863 public:
864  enum {
865  MAX_LEN = 1,
866  };
867 
868  enum {
869  UI_COMMAND_VOLUME_UP = 0x41,
870  UI_COMMAND_VOLUME_DOWN = 0x42,
871  UI_COMMAND_MUTE = 0x43,
872  UI_COMMAND_MUTE_FUNCTION = 0x65,
873  UI_COMMAND_RESTORE_FUNCTION = 0x66,
874  UI_COMMAND_POWER_OFF_FUNCTION = 0x6C,
875  UI_COMMAND_POWER_ON_FUNCTION = 0x6D,
876  UI_COMMAND_UP = 0x01,
877  UI_COMMAND_DOWN = 0x02,
878  UI_COMMAND_LEFT = 0x03,
879  UI_COMMAND_RIGHT = 0x04,
880  UI_COMMAND_SELECT = 0x00,
881  UI_COMMAND_HOME = 0x09,
882  UI_COMMAND_BACK = 0x0D,
883  UI_COMMAND_NUM_0 = 0x20,
884  UI_COMMAND_NUM_1 = 0x21,
885  UI_COMMAND_NUM_2 = 0x22,
886  UI_COMMAND_NUM_3 = 0x23,
887  UI_COMMAND_NUM_4 = 0x24,
888  UI_COMMAND_NUM_5 = 0x25,
889  UI_COMMAND_NUM_6 = 0x26,
890  UI_COMMAND_NUM_7 = 0x27,
891  UI_COMMAND_NUM_8 = 0x28,
892  UI_COMMAND_NUM_9 = 0x29,
893  };
894 
895  UICommand(int command) : CECBytes((uint8_t)command) { };
896 
897  int toInt(void) const {
898  return str[0];
899  }
900 
901 protected:
902  size_t getMaxLen() const {return MAX_LEN;}
903 };
904 
905 
906 CCEC_END_NAMESPACE
907 
908 #endif
909 
910 
911 /** @} */
912 /** @} */
OSDName
Definition: Operands.hpp:135
ShortAudioDescriptor
Definition: Operands.hpp:683
VendorID
Definition: Operands.hpp:288
Version
Definition: Operands.hpp:514
LogicalAddress
Definition: Operands.hpp:409
PhysicalAddress
Definition: Operands.hpp:314
InvalidParamException
Definition: Exception.hpp:90
DeviceType
Definition: Operands.hpp:211
SystemAudioStatus
Definition: Operands.hpp:772
AbortReason
Definition: Operands.hpp:156
Language
Definition: Operands.hpp:266
OSDString
Definition: Operands.hpp:114
UICommand
Definition: Operands.hpp:861
Operand
Definition: Operand.hpp:45
PowerStatus
Definition: Operands.hpp:564
AudioStatus
Definition: Operands.hpp:818
RequestAudioFormat
Definition: Operands.hpp:619
CECBytes
Definition: Operands.hpp:48
CECFrame
Definition: CECFrame.hpp:40
CCEC_LOG
void CCEC_LOG(int level, const char *format ...)
This function is used to gets the logs depending on the level of log and print these to standard outp...
Definition: Util.cpp:120