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  * @file le_bootReason_interface.h
59  *
60  * Legato @ref c_bootReason include file.
61  *
62  * Copyright (C) Sierra Wireless Inc.
63  */
64 
65 #ifndef LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
66 #define LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
67 
68 
69 #include "legato.h"
70 
71 // Internal includes for this interface
72 #include "le_bootReason_common.h"
73 /** @addtogroup le_bootReason le_bootReason API Reference
74  * @{
75  * @file le_bootReason_common.h
76  * @file le_bootReason_interface.h **/
77 //--------------------------------------------------------------------------------------------------
78 /**
79  * Type for handler called when a server disconnects.
80  */
81 //--------------------------------------------------------------------------------------------------
82 typedef void (*le_bootReason_DisconnectHandler_t)(void *);
83 
84 //--------------------------------------------------------------------------------------------------
85 /**
86  *
87  * Connect the current client thread to the service providing this API. Block until the service is
88  * available.
89  *
90  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
91  * called before any other functions in this API. Normally, ConnectService is automatically called
92  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
93  *
94  * This function is created automatically.
95  */
96 //--------------------------------------------------------------------------------------------------
98 (
99  void
100 );
101 
102 //--------------------------------------------------------------------------------------------------
103 /**
104  *
105  * Try to connect the current client thread to the service providing this API. Return with an error
106  * if the service is not available.
107  *
108  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
109  * called before any other functions in this API. Normally, ConnectService is automatically called
110  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
111  *
112  * This function is created automatically.
113  *
114  * @return
115  * - LE_OK if the client connected successfully to the service.
116  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
117  * bound.
118  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
119  * - LE_COMM_ERROR if the Service Directory cannot be reached.
120  */
121 //--------------------------------------------------------------------------------------------------
123 (
124  void
125 );
126 
127 //--------------------------------------------------------------------------------------------------
128 /**
129  * Set handler called when server disconnection is detected.
130  *
131  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
132  * to continue without exiting, it should call longjmp() from inside the handler.
133  */
134 //--------------------------------------------------------------------------------------------------
136 (
137  le_bootReason_DisconnectHandler_t disconnectHandler,
138  void *contextPtr
139 );
140 
141 //--------------------------------------------------------------------------------------------------
142 /**
143  *
144  * Disconnect the current client thread from the service providing this API.
145  *
146  * Normally, this function doesn't need to be called. After this function is called, there's no
147  * longer a connection to the service, and the functions in this API can't be used. For details, see
148  * @ref apiFilesC_client.
149  *
150  * This function is created automatically.
151  */
152 //--------------------------------------------------------------------------------------------------
154 (
155  void
156 );
157 
158 
159 //--------------------------------------------------------------------------------------------------
160 /**
161  * Checks whether boot-reason was timer expiry.
162  *
163  * @return
164  * - TRUE if boot-reason was timer expiry.
165  * - FALSE otherwise.
166  */
167 //--------------------------------------------------------------------------------------------------
169 (
170  void
171 );
172 
173 //--------------------------------------------------------------------------------------------------
174 /**
175  * Checks whether boot-reason was specific gpio change. GPIO number is specified in parameter.
176  *
177  * @return
178  * - TRUE if boot-reason was specified gpio change.
179  * - FALSE otherwise.
180  *
181  * @note The process exits if invalid gpio number is passed. Check corresponding device documents
182  * for valid list of gpio.
183  */
184 //--------------------------------------------------------------------------------------------------
186 (
187  uint32_t gpioNum
188  ///< [IN] GPIO number.
189 );
190 
191 //--------------------------------------------------------------------------------------------------
192 /**
193  * Checks whether boot reason was due to the specified ADC having a reading above or below the
194  * configured limits.
195  *
196  * @return
197  * true if boot reason was due to the given ADC or false otherwise.
198  *
199  * @note
200  * The process exits if an invalid ADC number is passed. Check corresponding device documents
201  * for valid list of ADC numbers.
202  */
203 //--------------------------------------------------------------------------------------------------
205 (
206  uint32_t adcNum
207  ///< [IN] ADC number
208 );
209 
210 /** @} **/
211 
212 #endif // LE_BOOTREASON_INTERFACE_H_INCLUDE_GUARD
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)
void(* le_bootReason_DisconnectHandler_t)(void *)
Definition: le_bootReason_interface.h:82
#define LE_FULL_API
Definition: le_apiFeatures.h:40
bool le_bootReason_WasTimer(void)
LE_FULL_API void le_bootReason_SetServerDisconnectHandler(le_bootReason_DisconnectHandler_t disconnectHandler, void *contextPtr)