le_ips_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_ips_common.h
12  *
13  * Type definitions for le_ips.
14  *
15  */
16 #ifndef LE_IPS_COMMON_H_INCLUDE_GUARD
17 #define LE_IPS_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 #define IFGEN_LE_IPS_PROTOCOL_ID "90ad953c761aa71f85c44f94ee91aff1"
23 #define IFGEN_LE_IPS_MSG_SIZE 20
24 /** @addtogroup le_ips
25  * @{ **/
26 
27 
28 //--------------------------------------------------------------------------------------------------
29 /**
30  * Platform input voltage event type.
31  */
32 //--------------------------------------------------------------------------------------------------
33 typedef enum
34 {
36  ///< High Critical input voltage threshold is reached.
38  ///< Normal input voltage threshold is reached.
40  ///< Warning input voltage threshold is reached.
42  ///< Critical input voltage threshold is reached.
43 }
45 
46 
47 //--------------------------------------------------------------------------------------------------
48 /**
49  * Platform power source type.
50  */
51 //--------------------------------------------------------------------------------------------------
52 typedef enum
53 {
55  ///< Platform is powered by an external source.
57  ///< Platform is powered by a battery.
58 }
60 
61 
62 //--------------------------------------------------------------------------------------------------
63 /**
64  * Reference type used by Add/Remove functions for EVENT 'le_ips_ThresholdEvent'
65  */
66 //--------------------------------------------------------------------------------------------------
67 typedef struct le_ips_ThresholdEventHandler* le_ips_ThresholdEventHandlerRef_t;
68 
69 
70 //--------------------------------------------------------------------------------------------------
71 /**
72  * Handler for Platform input voltage event.
73  */
74 //--------------------------------------------------------------------------------------------------
76 (
78  ///< Input voltage threshold event reached.
79  void* contextPtr
80  ///<
81 );
82 
83 
84 //--------------------------------------------------------------------------------------------------
85 /**
86  * Get if this client bound locally.
87  */
88 //--------------------------------------------------------------------------------------------------
89 LE_SHARED bool ifgen_le_ips_HasLocalBinding
90 (
91  void
92 );
93 
94 
95 //--------------------------------------------------------------------------------------------------
96 /**
97  * Init data that is common across all threads
98  */
99 //--------------------------------------------------------------------------------------------------
100 LE_SHARED void ifgen_le_ips_InitCommonData
101 (
102  void
103 );
104 
105 
106 //--------------------------------------------------------------------------------------------------
107 /**
108  * Perform common initialization and open a session
109  */
110 //--------------------------------------------------------------------------------------------------
111 LE_SHARED le_result_t ifgen_le_ips_OpenSession
112 (
113  le_msg_SessionRef_t _ifgen_sessionRef,
114  bool isBlocking
115 );
116 
117 //--------------------------------------------------------------------------------------------------
118 /**
119  * Add handler function for EVENT 'le_ips_ThresholdEvent'
120  *
121  * This event provides information on Threshold reached.
122  *
123  */
124 //--------------------------------------------------------------------------------------------------
125 LE_SHARED le_ips_ThresholdEventHandlerRef_t ifgen_le_ips_AddThresholdEventHandler
126 (
127  le_msg_SessionRef_t _ifgen_sessionRef,
129  ///< [IN]
130  void* contextPtr
131  ///< [IN]
132 );
133 
134 //--------------------------------------------------------------------------------------------------
135 /**
136  * Remove handler function for EVENT 'le_ips_ThresholdEvent'
137  */
138 //--------------------------------------------------------------------------------------------------
139 LE_SHARED void ifgen_le_ips_RemoveThresholdEventHandler
140 (
141  le_msg_SessionRef_t _ifgen_sessionRef,
143  ///< [IN]
144 );
145 
146 //--------------------------------------------------------------------------------------------------
147 /**
148  * Get the Platform input voltage in [mV].
149  *
150  * @return
151  * - LE_OK The function succeeded.
152  * - LE_FAULT The function failed to get the value.
153  *
154  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
155  * function will not return.
156  */
157 //--------------------------------------------------------------------------------------------------
158 LE_SHARED le_result_t ifgen_le_ips_GetInputVoltage
159 (
160  le_msg_SessionRef_t _ifgen_sessionRef,
161  uint32_t* inputVoltagePtr
162  ///< [OUT] [OUT] The input voltage in [mV]
163 );
164 
165 //--------------------------------------------------------------------------------------------------
166 /**
167  * Set the Platform warning and critical input voltage thresholds in [mV].
168  * When thresholds input voltage are reached, a input voltage event is triggered.
169  *
170  * @return
171  * - LE_OK The function succeeded.
172  * - LE_BAD_PARAMETER The hiCriticalVolt threshold is equal or lower than the (normalVolt+1)
173  * threshold.
174  * The warningVolt threshold is equal to or higher than the normalVolt
175  * threshold.
176  * The warningVolt threshold is equal to or lower than the criticalVolt
177  * threshold.
178  * - LE_FAULT The function failed to set the thresholds.
179  */
180 //--------------------------------------------------------------------------------------------------
181 LE_SHARED le_result_t ifgen_le_ips_SetVoltageThresholds
182 (
183  le_msg_SessionRef_t _ifgen_sessionRef,
184  uint16_t criticalVolt,
185  ///< [IN] [IN] The critical input voltage threshold in [mV].
186  uint16_t warningVolt,
187  ///< [IN] [IN] The warning input voltage threshold in [mV].
188  uint16_t normalVolt,
189  ///< [IN] [IN] The normal input voltage threshold in [mV].
190  uint16_t hiCriticalVolt
191  ///< [IN] [IN] The high critical input voltage threshold in [mV].
192 );
193 
194 //--------------------------------------------------------------------------------------------------
195 /**
196  * Get the Platform warning and critical input voltage thresholds in [mV].
197  *
198  * @return
199  * - LE_OK The function succeeded.
200  * - LE_FAULT The function failed to get the thresholds.
201  *
202  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
203  * function will not return.
204  */
205 //--------------------------------------------------------------------------------------------------
206 LE_SHARED le_result_t ifgen_le_ips_GetVoltageThresholds
207 (
208  le_msg_SessionRef_t _ifgen_sessionRef,
209  uint16_t* criticalVoltPtr,
210  ///< [OUT] [OUT] The critical input voltage threshold in [mV].
211  uint16_t* warningVoltPtr,
212  ///< [OUT] [OUT] The warning input voltage threshold in [mV].
213  uint16_t* normalVoltPtr,
214  ///< [OUT] [OUT] The normal input voltage threshold in [mV].
215  uint16_t* hiCriticalVoltPtr
216  ///< [OUT] [IN] The high critical input voltage threshold in [mV].
217 );
218 
219 //--------------------------------------------------------------------------------------------------
220 /**
221  * Get the Platform power source.
222  *
223  * @return
224  * - LE_OK The function succeeded.
225  * - LE_FAULT The function failed to get the value.
226  *
227  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
228  * function will not return.
229  */
230 //--------------------------------------------------------------------------------------------------
231 LE_SHARED le_result_t ifgen_le_ips_GetPowerSource
232 (
233  le_msg_SessionRef_t _ifgen_sessionRef,
234  le_ips_PowerSource_t* powerSourcePtr
235  ///< [OUT] [OUT] The power source.
236 );
237 
238 //--------------------------------------------------------------------------------------------------
239 /**
240  * Get the Platform battery level in percent:
241  * - 0: battery is exhausted or platform does not have a battery connected
242  * - 1 to 100: percentage of battery capacity remaining
243  *
244  * @return
245  * - LE_OK The function succeeded.
246  * - LE_FAULT The function failed to get the value.
247  *
248  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
249  * function will not return.
250  */
251 //--------------------------------------------------------------------------------------------------
252 LE_SHARED le_result_t ifgen_le_ips_GetBatteryLevel
253 (
254  le_msg_SessionRef_t _ifgen_sessionRef,
255  uint8_t* batteryLevelPtr
256  ///< [OUT] [OUT] The battery level in percent.
257 );
258 
259 //--------------------------------------------------------------------------------------------------
260 /**
261  * Set the Platform battery level in percent.
262  * This is useful when an external battery is used and its level is provided by the application
263  * monitoring it.
264  *
265  * @note The battery level set through this API will be the value reported by
266  * le_ips_GetBatteryLevel() until Legato is restarted.
267  *
268  * @return
269  * - LE_OK The function succeeded.
270  * - LE_BAD_PARAMETER Incorrect battery level provided.
271  */
272 //--------------------------------------------------------------------------------------------------
273 LE_SHARED le_result_t ifgen_le_ips_SetBatteryLevel
274 (
275  le_msg_SessionRef_t _ifgen_sessionRef,
276  uint8_t batteryLevel
277  ///< [IN] [IN] The battery level in percent.
278 );
279 /** @} **/
280 #endif // LE_IPS_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
void(* le_ips_ThresholdEventHandlerFunc_t)(le_ips_ThresholdStatus_t event, void *contextPtr)
Definition: le_ips_common.h:76
High Critical input voltage threshold is reached.
Definition: le_ips_common.h:35
Critical input voltage threshold is reached.
Definition: le_ips_common.h:41
Warning input voltage threshold is reached.
Definition: le_ips_common.h:39
le_ips_PowerSource_t
Definition: le_ips_common.h:52
Normal input voltage threshold is reached.
Definition: le_ips_common.h:37
le_ips_ThresholdStatus_t
Definition: le_ips_common.h:33
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
Platform is powered by an external source.
Definition: le_ips_common.h:54
Platform is powered by a battery.
Definition: le_ips_common.h:56
struct le_ips_ThresholdEventHandler * le_ips_ThresholdEventHandlerRef_t
Definition: le_ips_common.h:67