RDK Documentation (Open Sourced RDK Components)
Operand.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 * @defgroup hdmicec
23 * @{
24 * @defgroup ccec
25 * @{
26 **/
27 
28 
29 #ifndef HDMI_CCEC_OPERAND_HPP_
30 #define HDMI_CCEC_OPERAND_HPP_
31 
32 #include <stdint.h>
33 
34 #include <vector>
35 #include <string>
36 
37 
38 #include "CCEC.hpp"
39 #include "ccec/CECFrame.hpp"
40 
41 CCEC_BEGIN_NAMESPACE
42 
43 class CECFrame;
44 
45 class Operand
46 {
47 public:
48  virtual CECFrame &serialize(CECFrame &frame) const = 0;
49 
50  virtual const std::string toString(void) const {
51  return "Not Implemented";
52  }
53  virtual const std::string name(void) const {
54  return "Operand";
55  }
56  virtual bool validate(void) const {
57  return true;
58  }
59  CECFrame serialize(void) const {
60  CECFrame frame;
61  return serialize(frame);
62  }
63 };
64 
65 enum
66 {
67  BROADCAST = (0x01),
68  UNICAST = (0x01 << 1),
69 };
70 
71 
72 #define BYTE_TO_BCD(byte_) (((((byte_) / 10) & 0x0F) << 4) | (((byte_) % 10) & 0x0F))
73 #define BCD_TO_BYTE(byte_) (((((byte_) & 0xF0) >> 4) * 10) + (((byte_) & 0x0F)))
74 
75 CCEC_END_NAMESPACE
76 #endif
77 
78 
79 /** @} */
80 /** @} */
Operand
Definition: Operand.hpp:45
CECFrame
Definition: CECFrame.hpp:40