RDK Documentation (Open Sourced RDK Components)
plat_ir.h
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  * @defgroup IARM_PLAT_IR_API IR Manager (HAL Types and Public API)
22  * Described here in are the IARM-Bus HAL types and functions that are part of the
23  * IR Manager application. The IR Manager application manages user input on the IR interface.
24  * @ingroup IARMMGR_HAL
25  */
26 
27 /**
28 * @defgroup iarmmgrs
29 * @{
30 * @defgroup hal
31 * @{
32 */
33 
34 #ifndef _IARM_IRMGR_PLATFORM_
35 #define _IARM_IRMGR_PLATFORM_
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** @addtogroup IARM_PLAT_IR_API HAL
41  * @{
42  */
43 
44 typedef enum PLAT_xmp_tag {
45  XMP_TAG_COMCAST = 0x00,
46  XMP_TAG_PLATCO = 0x01,
47  XMP_TAG_XR11V2 = 0x02,
48  XMP_TAG_XR15V1 = 0x03,
49  XMP_TAG_XR15V2 = 0x04,
50  XMP_TAG_XR16V1 = 0x05,
51  XMP_TAG_XRAV1 = 0x06,
52  XMP_TAG_XR20V1 = 0x07,
53  XMP_TAG_UNDEFINED,
54 } PLAT_xmp_tag_t;
55 
56 typedef enum PLAT_xmp_owner {
57  XMP_OWNER_NORMAL = 0x00,
58  XMP_OWNER_PAIRING = 0x01,
59  XMP_OWNER_UNDEFINED,
60 } PLAT_xmp_owner_t;
61 
62 /**
63  * @brief IR Key struct that maintains meta data
64  */
65 typedef struct PLAT_irKey_metadata {
66  int type; ///< Event type of key press (up, down, repeat, etc)
67  int code; ///< Code of the pressed key (left, right, power, etc)
68  PLAT_xmp_tag_t tag; ///< Designates which device key belongs
69  PLAT_xmp_owner_t owner; ///< Designates how key should be handled
71 
72 /**
73 * @brief IR Input key event handler callback function type definition.
74 *
75 * The Event Data sent contains Key Type, Code, Owner, and Tag of the pressed IR key.
76 *
77 * @param[in] irKey IR Key struct that contains data on pressed IR Key
78 *
79 * @return None.
80 *
81 * @note This function must not suspend and must not invoke any blocking system
82 * calls. It should probably just send a message to a driver event handler task.
83 */
85 
86 /**
87  * @brief This API must registers a callback function to which IR Key events should be posted.
88  *
89  * This function registers the calling applications callback function. The application will then
90  * be notified of IR Key events via this callback function.
91  *
92  * @param[in] func Function reference of the callback function to be registered.
93  *
94  * @return None.
95 */
97 
98 /**
99 * @brief IR Input key event handler callback function type definition.
100 *
101 * The Event Data sent contains Key Type and Key Code of the pressed IR key.
102 *
103 * @param[in] keyType Key Type (e.g. Key Down, Key Up, Key Repeat) of the pressed IR key.
104 * @param[in] keyCode Key Code of the pressed IR key.
105 *
106 * @return None.
107 *
108 * @note This function must not suspend and must not invoke any blocking system
109 * calls. It should probably just send a message to a driver event handler task.
110 */
111 typedef void (*PLAT_IrKeyCallback_t)(int keyType, int keyCode);
112 
113 /**
114  * @brief This API must registers a callback function to which IR Key events should be posted.
115  *
116  * This function registers the calling applications callback function. The application will then
117  * be notified of IR Key events via this callback function.
118  *
119  * @param[in] func Function reference of the callback function to be registered.
120  *
121  * @return None.
122 */
124 
125 /**
126  * @brief This API initializes the underlying IR module.
127  *
128  * This function must initialize all the IR specific user input device modules.
129  *
130  * @return The status of the operation.
131  * @retval Returns O if successful, appropriate error code otherwise
132  */
133 int PLAT_API_INIT(void);
134 
135 /**
136  * @brief This API is used to terminate the IR device module.
137  *
138  * This function must terminate all the IR specific user input device modules. It must
139  * reset any data structures used within IR module and release any IR specific handles
140  * and resources.
141  */
142 void PLAT_API_TERM(void);
143 
144 /**
145  * @brief This function executes the key event loop.
146  *
147  * This function executes the platform-specific key event loop. This will generally
148  * translate between platform-specific key codes and Comcast standard keycode definitions.
149  */
150 void PLAT_API_LOOP();
151 
152 /** @} */ //End of Doxygen Tag
153 
154 #ifdef __cplusplus
155 }
156 #endif /* __cplusplus */
157 #endif
158 
159 
160 /** @} */
161 /** @} */
PLAT_irKey_metadata::tag
PLAT_xmp_tag_t tag
Designates which device key belongs.
Definition: plat_ir.h:68
PLAT_API_LOOP
void PLAT_API_LOOP()
This function executes the key event loop.
PLAT_irKey_metadata::code
int code
Code of the pressed key (left, right, power, etc)
Definition: plat_ir.h:67
PLAT_irKey_metadata
IR Key struct that maintains meta data.
Definition: plat_ir.h:65
PLAT_API_TERM
void PLAT_API_TERM(void)
This API is used to terminate the IR device module.
PLAT_irKey_metadata::owner
PLAT_xmp_owner_t owner
Designates how key should be handled.
Definition: plat_ir.h:69
PLAT_API_RegisterIRKeyCallback
void PLAT_API_RegisterIRKeyCallback(PLAT_IrKeyCallback_t func)
This API must registers a callback function to which IR Key events should be posted.
PLAT_API_RegisterIRKeyCallbackExtended
void PLAT_API_RegisterIRKeyCallbackExtended(PLAT_IrKeyCallback_Extended_t func)
This API must registers a callback function to which IR Key events should be posted.
PLAT_IrKeyCallback_t
void(* PLAT_IrKeyCallback_t)(int keyType, int keyCode)
IR Input key event handler callback function type definition.
Definition: plat_ir.h:111
PLAT_API_INIT
int PLAT_API_INIT(void)
This API initializes the underlying IR module.
PLAT_irKey_metadata::type
int type
Event type of key press (up, down, repeat, etc)
Definition: plat_ir.h:66
PLAT_IrKeyCallback_Extended_t
void(* PLAT_IrKeyCallback_Extended_t)(PLAT_irKey_metadata_t *irKey)
IR Input key event handler callback function type definition.
Definition: plat_ir.h:84
PLAT_irKey_metadata_t
struct PLAT_irKey_metadata PLAT_irKey_metadata_t
IR Key struct that maintains meta data.
keyType
Definition: reset.c:85