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