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