RDK Documentation (Open Sourced RDK Components)
irMgrInternal.h
Go to the documentation of this file.
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 * @file irMgrInternal.h
22 *
23 * @brief IARM-Bus IR Manager Internal API.
24 *
25 * This API defines the operations for key management.
26 *
27 * @par Document
28 * Document reference.
29 *
30 * @par Open Issues (in no particular order)
31 * -# None
32 *
33 * @par Assumptions
34 * -# None
35 *
36 * @par Abbreviations
37 * - BE: ig-Endian.
38 * - cb: allback function (suffix).
39 * - DS: Device Settings.
40 * - FPD: Front-Panel Display.
41 * - HAL: Hardware Abstraction Layer.
42 * - LE: Little-Endian.
43 * - LS: Least Significant.
44 * - MBZ: Must be zero.
45 * - MS: Most Significant.
46 * - RDK: Reference Design Kit.
47 * - _t: Type (suffix).
48 *
49 * @par Implementation Notes
50 * -# None
51 *
52 */
53 
54 
55 
56 /**
57 * @defgroup iarmmgrs
58 * @{
59 * @defgroup ir
60 * @{
61 **/
62 
63 
64 #ifndef _IARM_IRMGR_INTERNAL_
65 #define _IARM_IRMGR_INTERNAL_
66 #include "libIARM.h"
67 #include <string.h>
68 
69 
70 #ifdef RDK_LOGGER_ENABLED
71 #include "rdk_debug.h"
72 #include "iarmUtil.h"
73 
74 extern int b_rdk_logger_enabled;
75 
76 #define LOG(...) INT_LOG(__VA_ARGS__, "")
77 #define INT_LOG(FORMAT, ...) if(b_rdk_logger_enabled) {\
78 RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.IRMGR", FORMAT , __VA_ARGS__);\
79 }\
80 else\
81 {\
82 printf(FORMAT, __VA_ARGS__);\
83 }
84 
85 #else
86 
87 #define LOG(...) printf(__VA_ARGS__)
88 
89 #endif
90 
91 
92 #if defined _SKQ_KEY_MAP_1_
93 typedef void (* uinput_dispatcherScancode_t) (int scanCode, int keyCode, int keyType, int source);
94 #endif
95 typedef void (* uinput_dispatcher_t) (int keyCode, int keyType, int source);
96 
97 /** @addtogroup IARM_BUS_IRMGR_INTERNAL_API IARM-Bus IR Manager internal API.
98 * @ingroup IARM_BUS
99 *
100 * Described here in are functions to manage the lifecycle of IR manager.
101 *
102 * @{
103 */
104 
105 /**
106  * @brief Starts the IR manager.
107  *
108  * This function registers and connects IR Manager to the IARM bus.
109  *
110  * @return Error code if start fails.
111  */
112 IARM_Result_t IRMgr_Start(int argc, char *argv[]);
113 /**
114  * @brief Loop to keep the IR manager alive.
115  *
116  * This function will loop around to keep IR manager alive.
117  *
118  */
119 IARM_Result_t IRMgr_Loop();
120 
121 /**
122  * @brief Terminates the IR manager.
123  *
124  *This function disconnects and terminates IR manager from IARM bus.
125  *
126  * @return Error code if stop fails.
127  */
128 
129 IARM_Result_t IRMgr_Stop(void);
130 
131 /**
132  * @brief register a uinput dispatcher.
133  *
134  * This function is invoked whenever a IR key event is sent out on IARM
135  * This should be called before IRMgr_Start()
136  *
137  * @return Error code if stop fails.
138  */
139 
140 IARM_Result_t IRMgr_Register_uinput(uinput_dispatcher_t f);
141 
142 #ifdef __cplusplus
143 extern "C" {
144 #endif
145 
146 typedef enum _IRMgr_UINPUTSrc {
147  IRMGR_UINPUT_SRC_IRMGR,
148  IRMGR_UINPUT_SRC_KEYSIM,
149  IRMGR_UINPUT_SRC_MAX
150 } IRMg_UINPUT_Src_t;
151 
152 
153 /**
154  * @brief uinput module init.
155  *
156  * initialize uinput module. If /dev/uinput does not exist, fail;
157  *
158  * @return Error code if fails.
159  */
160 int UINPUT_init(void);
161 
162 int UINPUT_init_src(IRMg_UINPUT_Src_t eSrc);
163 
164 /**
165  * @brief get the dispather that will listen for IARM IR
166  *
167  * @return NULL if uinput is not available.
168  */
169 uinput_dispatcher_t UINPUT_GetDispatcher(void);
170 
171 #if defined _SKQ_KEY_MAP_1_
172 uinput_dispatcherScancode_t UINPUT_GetDispatcherScancode(void);
173 #endif
174 
175 /**
176  * @brief uinput module term.
177  *
178  * release uinput module.
179  *
180  * @return Error code if fails.
181  */
182 int UINPUT_term(void);
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 IARM_Result_t IRMgr_Register_uinput(uinput_dispatcher_t f);
188 #endif
189 
190 
191 /* End of IARM_BUS_IRMGR_INTERNAL_API doxygen group */
192 /**
193  * @}
194  */
195 
196 
197 /** @} */
198 /** @} */
UINPUT_init
int UINPUT_init(void)
uinput module init.
Definition: uinput.c:225
IRMgr_Loop
IARM_Result_t IRMgr_Loop()
Loop to keep the IR manager alive.
Definition: irMgr.c:221
rdk_debug.h
IRMgr_Stop
IARM_Result_t IRMgr_Stop(void)
Terminates the IR manager.
Definition: irMgr.c:235
IRMgr_Start
IARM_Result_t IRMgr_Start(int argc, char *argv[])
Starts the IR manager.
Definition: irMgr.c:151
UINPUT_GetDispatcher
uinput_dispatcher_t UINPUT_GetDispatcher(void)
get the dispather that will listen for IARM IR
Definition: uinput.c:325
IRMgr_Register_uinput
IARM_Result_t IRMgr_Register_uinput(uinput_dispatcher_t f)
register a uinput dispatcher.
Definition: irMgr.c:145
keyType
Definition: reset.c:85
UINPUT_term
int UINPUT_term(void)
uinput module term.
Definition: uinput.c:339