le_wdog_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_wdog Watchdog Service
14  *
15  * @ref le_wdog_interface.h "Type/Function Reference"
16  *
17  * @section Watchdog Service
18  *
19  * Provides an API for monitoring critical applications and services for deadlocks and other
20  * similar faults. The watchdog for a process is started by calling @c le_wdog_Kick or
21  * @c le_wdog_Timeout. Once started, the watchdog must be kicked periodically by calling
22  * @c le_wdog_Kick. If the watchdog is not kicked (because it is deadlocked, for example),
23  * the watchdog service will attempt to recover the service by killing the process and
24  * executing the action specified in the process' watchdogAction (if specified)
25  * otherwise its faultAction.
26  *
27  * Generally a service which uses the watchdog should set @c watchdogTimeout to give the
28  * default timeout, and @c watchdogAction to give a recovery action.
29  *
30  * Critical services should also set @c maxWatchdogTimeout. In this case the watchdog
31  * will be started on system boot, and cannot be stopped or set
32  * longer than the timeout given in @c maxWatchdogTimeout. This ensures the service is
33  * always running as long as the system is running.
34  *
35  * @note If maxWatchdogTimeout is not set, no more action is taken if performing the process'
36  * @c watchdogAction doesn't recover the process. If @c maxWatchdogTimeout is specified the
37  * system will be rebooted if the process does not recover.
38  *
39  * Copyright (C) Sierra Wireless Inc.
40  */
41 /**
42  * @file le_wdog_interface.h
43  *
44  * Legato @ref c_wdog include file.
45  *
46  * Copyright (C) Sierra Wireless Inc.
47  */
48 /**
49  * Special values that have specific meaning when used as durations in Timeout():
50  * - @ref LE_WDOG_TIMEOUT_NEVER
51  * - @ref LE_WDOG_TIMEOUT_NOW
52  */
53 
54 #ifndef LE_WDOG_INTERFACE_H_INCLUDE_GUARD
55 #define LE_WDOG_INTERFACE_H_INCLUDE_GUARD
56 
57 
58 #include "legato.h"
59 
60 // Internal includes for this interface
61 #include "le_wdog_common.h"
62 /** @addtogroup le_wdog le_wdog API Reference
63  * @{
64  * @file le_wdog_common.h
65  * @file le_wdog_interface.h **/
66 //--------------------------------------------------------------------------------------------------
67 /**
68  * Type for handler called when a server disconnects.
69  */
70 //--------------------------------------------------------------------------------------------------
71 typedef void (*le_wdog_DisconnectHandler_t)(void *);
72 
73 //--------------------------------------------------------------------------------------------------
74 /**
75  *
76  * Connect the current client thread to the service providing this API. Block until the service is
77  * available.
78  *
79  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
80  * called before any other functions in this API. Normally, ConnectService is automatically called
81  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
82  *
83  * This function is created automatically.
84  */
85 //--------------------------------------------------------------------------------------------------
87 (
88  void
89 );
90 
91 //--------------------------------------------------------------------------------------------------
92 /**
93  *
94  * Try to connect the current client thread to the service providing this API. Return with an error
95  * if the service is not available.
96  *
97  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
98  * called before any other functions in this API. Normally, ConnectService is automatically called
99  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
100  *
101  * This function is created automatically.
102  *
103  * @return
104  * - LE_OK if the client connected successfully to the service.
105  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
106  * bound.
107  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
108  * - LE_COMM_ERROR if the Service Directory cannot be reached.
109  */
110 //--------------------------------------------------------------------------------------------------
112 (
113  void
114 );
115 
116 //--------------------------------------------------------------------------------------------------
117 /**
118  * Set handler called when server disconnection is detected.
119  *
120  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
121  * to continue without exiting, it should call longjmp() from inside the handler.
122  */
123 //--------------------------------------------------------------------------------------------------
125 (
126  le_wdog_DisconnectHandler_t disconnectHandler,
127  void *contextPtr
128 );
129 
130 //--------------------------------------------------------------------------------------------------
131 /**
132  *
133  * Disconnect the current client thread from the service providing this API.
134  *
135  * Normally, this function doesn't need to be called. After this function is called, there's no
136  * longer a connection to the service, and the functions in this API can't be used. For details, see
137  * @ref apiFilesC_client.
138  *
139  * This function is created automatically.
140  */
141 //--------------------------------------------------------------------------------------------------
143 (
144  void
145 );
146 
147 
148 //--------------------------------------------------------------------------------------------------
149 /**
150  * External watchdog kick handler
151  */
152 //--------------------------------------------------------------------------------------------------
153 
154 
155 //--------------------------------------------------------------------------------------------------
156 /**
157  * Kicks the watchdog timer.
158  *
159  * Once the watchdog has been kicked it must be kicked again before the expiration of the current
160  * effective timeout else the configured WatchdogAction will be executed.
161  */
162 //--------------------------------------------------------------------------------------------------
163 void le_wdog_Kick
164 (
165  void
166 );
167 
168 //--------------------------------------------------------------------------------------------------
169 /**
170  * Set a time out.
171  *
172  * The watchdog is kicked and a new effective timeout value is set. The new timeout will be
173  * effective until the next kick at which point it will revert to the original value.
174  */
175 //--------------------------------------------------------------------------------------------------
176 void le_wdog_Timeout
177 (
178  int32_t milliseconds
179  ///< [IN] The number of milliseconds until this timer expires
180 );
181 
182 //--------------------------------------------------------------------------------------------------
183 /**
184  * Get the watchdog timeout configured for this process
185  *
186  * @return
187  * - LE_OK The watchdog timeout is configured and returned
188  * - LE_NOT_FOUND The watchdog timeout is not set
189  */
190 //--------------------------------------------------------------------------------------------------
192 (
193  uint64_t* millisecondsPtr
194  ///< [OUT] The watchdog timeout set for this process
195 );
196 
197 //--------------------------------------------------------------------------------------------------
198 /**
199  * Get the max watchdog timeout configured for this process
200  *
201  * @return
202  * - LE_OK The max watchdog timeout is configured and returned
203  * - LE_NOT_FOUND The max watchdog timeout is not set
204  */
205 //--------------------------------------------------------------------------------------------------
207 (
208  uint64_t* millisecondsPtr
209  ///< [OUT] The max watchdog timeout set for this process
210 );
211 
212 /** @} **/
213 
214 #endif // LE_WDOG_INTERFACE_H_INCLUDE_GUARD
void le_wdog_Kick(void)
LE_FULL_API void le_wdog_SetServerDisconnectHandler(le_wdog_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_result_t
Definition: le_basics.h:46
void le_wdog_Timeout(int32_t milliseconds)
le_result_t le_wdog_GetWatchdogTimeout(uint64_t *millisecondsPtr)
void le_wdog_DisconnectService(void)
void(* le_wdog_DisconnectHandler_t)(void *)
Definition: le_wdog_interface.h:71
le_result_t le_wdog_TryConnectService(void)
le_result_t le_wdog_GetMaxWatchdogTimeout(uint64_t *millisecondsPtr)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
void le_wdog_ConnectService(void)