RDK Documentation (Open Sourced RDK Components)
Util.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_UTIL_HPP_
30 #define HDMI_CCEC_UTIL_HPP_
31 
32 #include "ccec/CCEC.hpp"
33 
34 CCEC_BEGIN_NAMESPACE
35 class CECFrame;
36 
37 class Noop
38 {
39 public:
40  inline size_t deserialize(const CECFrame &frame, size_t startPos = 0) {
41  /* Noop */
42  return 0;
43  }
44  inline CECFrame &serialize(CECFrame &frame) const {
45  /* Noop */
46  return frame;
47  }
48 
49  void print(void) const {
50 
51  }
52 };
53 
54 
55 #define LOG_FATAL 0
56 #define LOG_ERROR 1
57 #define LOG_WARN 2
58 #define LOG_EXP 3
59 #define LOG_NOTICE 4
60 #define LOG_INFO 5
61 #define LOG_DEBUG 6
62 #define LOG_TRACE 7
63 #define LOG_MAX 8
64 
65 
66 void check_cec_log_status(void);
67 void CCEC_LOG(int level,const char *format, ...);
68 void dump_buffer(unsigned char * buf, int len);
69 
70 //#define CCEC_DBG_PRINTF(x) do{printf x;}while(0)
71 //#define CCEC_ERR_PRINTF(x) do{printf x;}while(0)
72 //#define CCEC_EXP_PRINTF(x) do{printf x;}while(0)
73 
74 #define BYTE_TO_BCD(byte_) (((((byte_) / 10) & 0x0F) << 4) | (((byte_) % 10) & 0x0F))
75 #define BCD_TO_BYTE(byte_) (((((byte_) & 0xF0) >> 4) * 10) + (((byte_) & 0x0F)))
76 
77 CCEC_END_NAMESPACE
78 #endif
79 
80 
81 /** @} */
82 /** @} */
dump_buffer
void dump_buffer(unsigned char *buf, int len)
This function is used to print the content of log buffer in hexadecimal format.
Definition: Util.cpp:142
Noop
Definition: Util.hpp:37
check_cec_log_status
void check_cec_log_status(void)
This function is used to get the cec log from the log file and checks the level of log received.
Definition: Util.cpp:75
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