le_bootReason_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_bootReason Boot Reason Query
14  *
15  * @ref le_bootReason_interface.h "API Reference"
16  *
17  * <HR>
18  *
19  * This API can be used to determine the reason for the last OS boot when using @ref c_ulpm
20  * (e.g., power on due to pre-configured time setty or GPIO toggled externally).
21  *
22  * Boot may occur due to exit from ultra low power mode or press on Power button. Exit from low
23  * power state may occur through various sources (e.g., GPIO pins or timers that are specific to the
24  * device hardware).
25  *
26  * @section bootReason_example Sample Code
27  *
28  * This C code sample sows an API calling sequence to get boot-reason:
29  *
30  * @code
31  *
32  * void CheckMDMBootReason
33  * (
34  * void
35  * )
36  * {
37  * if (le_bootReason_WasTimer())
38  * {
39  * LE_INFO("Timer boot");
40  * }
41  * else if (le_bootReason_WasGpio(<gpioNum>))
42  * {
43  * LE_INFO("GPIO<gpioNum> boot");
44  * }
45  * else
46  * {
47  * LE_INFO("Power-on");
48  * }
49  * }
50  *
51  * @endcode
52  *
53  * <HR>
54  *
55  * Copyright (C) Sierra Wireless Inc.
56  */
57 
58 #ifndef LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
59 #define LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
60 
61 
62 #include "legato.h"
63 
64 // Internal includes for this interface
65 #include "le_bootReason_common.h"
66 /** @addtogroup le_bootReason le_bootReason API Reference
67  * @{
68  * @file le_bootReason_common.h
69  * @file le_bootReason_interface.h **/
70 //--------------------------------------------------------------------------------------------------
71 /**
72  * Type for handler called when a server disconnects.
73  */
74 //--------------------------------------------------------------------------------------------------
75 typedef void (*le_bootReason_DisconnectHandler_t)(void *);
76 
77 //--------------------------------------------------------------------------------------------------
78 /**
79  *
80  * Connect the current client thread to the service providing this API. Block until the service is
81  * available.
82  *
83  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
84  * called before any other functions in this API. Normally, ConnectService is automatically called
85  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
86  *
87  * This function is created automatically.
88  */
89 //--------------------------------------------------------------------------------------------------
91 (
92  void
93 );
94 
95 //--------------------------------------------------------------------------------------------------
96 /**
97  *
98  * Try to connect the current client thread to the service providing this API. Return with an error
99  * if the service is not available.
100  *
101  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
102  * called before any other functions in this API. Normally, ConnectService is automatically called
103  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
104  *
105  * This function is created automatically.
106  *
107  * @return
108  * - LE_OK if the client connected successfully to the service.
109  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
110  * bound.
111  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
112  * - LE_COMM_ERROR if the Service Directory cannot be reached.
113  */
114 //--------------------------------------------------------------------------------------------------
116 (
117  void
118 );
119 
120 //--------------------------------------------------------------------------------------------------
121 /**
122  * Set handler called when server disconnection is detected.
123  *
124  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
125  * to continue without exiting, it should call longjmp() from inside the handler.
126  */
127 //--------------------------------------------------------------------------------------------------
129 (
130  le_bootReason_DisconnectHandler_t disconnectHandler,
131  void *contextPtr
132 );
133 
134 //--------------------------------------------------------------------------------------------------
135 /**
136  *
137  * Disconnect the current client thread from the service providing this API.
138  *
139  * Normally, this function doesn't need to be called. After this function is called, there's no
140  * longer a connection to the service, and the functions in this API can't be used. For details, see
141  * @ref apiFilesC_client.
142  *
143  * This function is created automatically.
144  */
145 //--------------------------------------------------------------------------------------------------
147 (
148  void
149 );
150 
151 
152 //--------------------------------------------------------------------------------------------------
153 /**
154  * Checks whether boot-reason was timer expiry.
155  *
156  * @return
157  * - TRUE if boot-reason was timer expiry.
158  * - FALSE otherwise.
159  */
160 //--------------------------------------------------------------------------------------------------
162 (
163  void
164 );
165 
166 //--------------------------------------------------------------------------------------------------
167 /**
168  * Checks whether boot-reason was specific gpio change. GPIO number is specified in parameter.
169  *
170  * @return
171  * - TRUE if boot-reason was specified gpio change.
172  * - FALSE otherwise.
173  *
174  * @note The process exits if invalid gpio number is passed. Check corresponding device documents
175  * for valid list of gpio.
176  */
177 //--------------------------------------------------------------------------------------------------
179 (
180  uint32_t gpioNum
181  ///< [IN] GPIO number.
182 );
183 
184 //--------------------------------------------------------------------------------------------------
185 /**
186  * Checks whether boot reason was due to the specified ADC having a reading above or below the
187  * configured limits.
188  *
189  * @return
190  * true if boot reason was due to the given ADC or false otherwise.
191  *
192  * @note
193  * The process exits if an invalid ADC number is passed. Check corresponding device documents
194  * for valid list of ADC numbers.
195  */
196 //--------------------------------------------------------------------------------------------------
198 (
199  uint32_t adcNum
200  ///< [IN] ADC number
201 );
202 
203 //--------------------------------------------------------------------------------------------------
204 /**
205  * Get the number of GPIOs that are specified in the system.
206  *
207  * @return
208  * LE_OK if we successfully get all the GPIOs and place them in the array.
209  * LE_FAULT otherwise.
210  */
211 //--------------------------------------------------------------------------------------------------
213 (
214  uint8_t* gpioArrayPtr,
215  ///< [OUT]
216  size_t* gpioArraySizePtr
217  ///< [INOUT]
218 );
219 
220 //--------------------------------------------------------------------------------------------------
221 /**
222  * Get the information for a specific GPIO and place all the information into the buffer.
223  *
224  * @return
225  * LE_OK if we successfully get all the information.
226  * LE_FAULT otherwise.
227  */
228 //--------------------------------------------------------------------------------------------------
230 (
231  char* buf,
232  ///< [OUT]
233  size_t bufSize,
234  ///< [IN]
235  const char* LE_NONNULL gpio
236  ///< [IN]
237 );
238 
239 //--------------------------------------------------------------------------------------------------
240 /**
241  * Get the number of ADCs that are specified in the system.
242  *
243  * @return
244  * LE_OK if we successfully get all the ADCs and place them in the array.
245  * LE_FAULT otherwise.
246  */
247 //--------------------------------------------------------------------------------------------------
249 (
250  uint8_t* adcArrayPtr,
251  ///< [OUT]
252  size_t* adcArraySizePtr
253  ///< [INOUT]
254 );
255 
256 //--------------------------------------------------------------------------------------------------
257 /**
258  * Get the information for a specific ADC and place all the information into the buffer.
259  *
260  * @return
261  * LE_OK if we successfully get all the information.
262  * LE_FAULT otherwise.
263  */
264 //--------------------------------------------------------------------------------------------------
266 (
267  char* buf,
268  ///< [OUT]
269  size_t bufSize,
270  ///< [IN]
271  const char* LE_NONNULL adc
272  ///< [IN]
273 );
274 
275 //--------------------------------------------------------------------------------------------------
276 /**
277  * Get the information about ADC interval and place all the information into the buffer.
278  *
279  * @return
280  * LE_OK if we successfully get all the information.
281  * LE_FAULT otherwise.
282  */
283 //--------------------------------------------------------------------------------------------------
285 (
286  char* buf,
287  ///< [OUT]
288  size_t bufSize
289  ///< [IN]
290 );
291 
292 //--------------------------------------------------------------------------------------------------
293 /**
294  * Get the information about timer and place all the information into the buffer.
295  *
296  * @return
297  * LE_OK if we successfully get all the information.
298  * LE_FAULT otherwise.
299  */
300 //--------------------------------------------------------------------------------------------------
302 (
303  char* buf,
304  ///< [OUT]
305  size_t bufSize
306  ///< [IN]
307 );
308 
309 //--------------------------------------------------------------------------------------------------
310 /**
311  * Get the information about shutdown strategy and place all the information into the buffer.
312  *
313  * @return
314  * LE_OK if we successfully get all the information.
315  * LE_FAULT otherwise.
316  */
317 //--------------------------------------------------------------------------------------------------
319 (
320  char* buf,
321  ///< [OUT]
322  size_t bufSize
323  ///< [IN]
324 );
325 
326 /** @} **/
327 
328 #endif // LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
le_result_t le_bootReason_GetGpioCount(uint8_t *gpioArrayPtr, size_t *gpioArraySizePtr)
le_result_t le_bootReason_GetShutdownStrategy(char *buf, size_t bufSize)
bool le_bootReason_WasGpio(uint32_t gpioNum)
le_result_t
Definition: le_basics.h:46
le_result_t le_bootReason_TryConnectService(void)
void le_bootReason_DisconnectService(void)
bool le_bootReason_WasAdc(uint32_t adcNum)
void le_bootReason_ConnectService(void)
le_result_t le_bootReason_GetTimerInfo(char *buf, size_t bufSize)
void(* le_bootReason_DisconnectHandler_t)(void *)
Definition: le_bootReason_interface.h:75
#define LE_FULL_API
Definition: le_apiFeatures.h:40
le_result_t le_bootReason_GetAdcCount(uint8_t *adcArrayPtr, size_t *adcArraySizePtr)
le_result_t le_bootReason_GetGpioInfo(char *buf, size_t bufSize, const char *LE_NONNULL gpio)
le_result_t le_bootReason_GetAdcInfo(char *buf, size_t bufSize, const char *LE_NONNULL adc)
le_result_t le_bootReason_GetAdcInterval(char *buf, size_t bufSize)
bool le_bootReason_WasTimer(void)
LE_FULL_API void le_bootReason_SetServerDisconnectHandler(le_bootReason_DisconnectHandler_t disconnectHandler, void *contextPtr)