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 //--------------------------------------------------------------------------------------------------
63 /**
64  * Type for handler called when a server disconnects.
65  */
66 //--------------------------------------------------------------------------------------------------
67 typedef void (*le_wdog_DisconnectHandler_t)(void *);
68 
69 //--------------------------------------------------------------------------------------------------
70 /**
71  *
72  * Connect the current client thread to the service providing this API. Block until the service is
73  * available.
74  *
75  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
76  * called before any other functions in this API. Normally, ConnectService is automatically called
77  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
78  *
79  * This function is created automatically.
80  */
81 //--------------------------------------------------------------------------------------------------
83 (
84  void
85 );
86 
87 //--------------------------------------------------------------------------------------------------
88 /**
89  *
90  * Try to connect the current client thread to the service providing this API. Return with an error
91  * if the service is not available.
92  *
93  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
94  * called before any other functions in this API. Normally, ConnectService is automatically called
95  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
96  *
97  * This function is created automatically.
98  *
99  * @return
100  * - LE_OK if the client connected successfully to the service.
101  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
102  * bound.
103  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
104  * - LE_COMM_ERROR if the Service Directory cannot be reached.
105  */
106 //--------------------------------------------------------------------------------------------------
108 (
109  void
110 );
111 
112 //--------------------------------------------------------------------------------------------------
113 /**
114  * Set handler called when server disconnection is detected.
115  *
116  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
117  * to continue without exiting, it should call longjmp() from inside the handler.
118  */
119 //--------------------------------------------------------------------------------------------------
121 (
122  le_wdog_DisconnectHandler_t disconnectHandler,
123  void *contextPtr
124 );
125 
126 //--------------------------------------------------------------------------------------------------
127 /**
128  *
129  * Disconnect the current client thread from the service providing this API.
130  *
131  * Normally, this function doesn't need to be called. After this function is called, there's no
132  * longer a connection to the service, and the functions in this API can't be used. For details, see
133  * @ref apiFilesC_client.
134  *
135  * This function is created automatically.
136  */
137 //--------------------------------------------------------------------------------------------------
139 (
140  void
141 );
142 
143 
144 //--------------------------------------------------------------------------------------------------
145 /**
146  * External watchdog kick handler
147  */
148 //--------------------------------------------------------------------------------------------------
149 
150 
151 //--------------------------------------------------------------------------------------------------
152 /**
153  * Kicks the watchdog timer.
154  *
155  * Once the watchdog has been kicked it must be kicked again before the expiration of the current
156  * effective timeout else the configured WatchdogAction will be executed.
157  */
158 //--------------------------------------------------------------------------------------------------
159 void le_wdog_Kick
160 (
161  void
162 );
163 
164 //--------------------------------------------------------------------------------------------------
165 /**
166  * Set a time out.
167  *
168  * The watchdog is kicked and a new effective timeout value is set. The new timeout will be
169  * effective until the next kick at which point it will revert to the original value.
170  */
171 //--------------------------------------------------------------------------------------------------
172 void le_wdog_Timeout
173 (
174  int32_t milliseconds
175  ///< [IN] The number of milliseconds until this timer expires
176 );
177 
178 //--------------------------------------------------------------------------------------------------
179 /**
180  * Get the watchdog timeout configured for this process
181  *
182  * @return
183  * - LE_OK The watchdog timeout is configured and returned
184  * - LE_NOT_FOUND The watchdog timeout is not set
185  */
186 //--------------------------------------------------------------------------------------------------
188 (
189  uint64_t* millisecondsPtr
190  ///< [OUT] The watchdog timeout set for this process
191 );
192 
193 //--------------------------------------------------------------------------------------------------
194 /**
195  * Get the max watchdog timeout configured for this process
196  *
197  * @return
198  * - LE_OK The max watchdog timeout is configured and returned
199  * - LE_NOT_FOUND The max watchdog timeout is not set
200  */
201 //--------------------------------------------------------------------------------------------------
203 (
204  uint64_t* millisecondsPtr
205  ///< [OUT] The max watchdog timeout set for this process
206 );
207 
208 #endif // LE_WDOG_INTERFACE_H_INCLUDE_GUARD
le_result_t le_wdog_GetWatchdogTimeout(uint64_t *millisecondsPtr)
le_result_t
Definition: le_basics.h:35
void(* le_wdog_DisconnectHandler_t)(void *)
Definition: le_wdog_interface.h:67
LE_FULL_API void le_wdog_SetServerDisconnectHandler(le_wdog_DisconnectHandler_t disconnectHandler, void *contextPtr)
void le_wdog_Kick(void)
le_result_t le_wdog_TryConnectService(void)
le_result_t le_wdog_GetMaxWatchdogTimeout(uint64_t *millisecondsPtr)
void le_wdog_Timeout(int32_t milliseconds)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
void le_wdog_DisconnectService(void)
void le_wdog_ConnectService(void)