le_sup_ctrl_interface.h

Go to the documentation of this file.
1 /*
2  * ====================== WARNING ======================
3  *
4  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
5  * DO NOT MODIFY IN ANY WAY.
6  *
7  * ====================== WARNING ======================
8  */
9 
10 /**
11  * @page c_sup_ctrl Supervisor Control API
12  *
13  * @ref le_sup_ctrl_interface.h "API Reference"
14  *
15  * Supervisor API for controlling the framework and applications. This API is only available to
16  * privileged users.
17  *
18  * @section legatoServicesSupervisor_binding Binding
19  *
20  * You can use a definition @c .adef file to bind your client-side app and component to the
21  * server-side Supervisor Control service.
22  *
23  * This code sample shows how to bind an app to this service:
24  * @code
25  * bindings
26  * {
27  * myExe.myComp.le_sup_ctrl -> <root>.le_sup_ctrl
28  * }
29  * @endcode
30  *
31  * See @ref defFilesAdef for details.
32  *
33  * @section legatoServicesSupervisor_start Start App
34  *
35  * Use le_sup_ctrl_StartApp() (const char * appName) to automatically start an app.
36  *
37  * The code sample shows how to use the Supervisor Control service to start an app:
38  *
39  * @code
40  * le_result_t result = le_sup_ctrl_StartApp("myApp");
41  * @endcode
42  *
43  * where @c myApp is the name of the app.
44  *
45  * @section legatoServicesSupervisor_stop Stop App
46  *
47  * Use le_sup_ctrl_StopApp() to automatically stop an app.
48  *
49  * This code sample shows how to use the Supervisor Control service to stop an app, where
50  * appAplication.app is your app's actual name:
51  *
52  * @code
53  * le_result_t result = le_sup_ctrl_StopApp("myApp");
54  * @endcode
55  *
56  * where @c myApp is the name of the app.
57  *
58  * <HR>
59  *
60  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
61  */
62 /**
63  * @file le_sup_ctrl_interface.h
64  *
65  * Legato @ref c_sup_ctrl include file.
66  *
67  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
68  */
69 
70 #ifndef LE_SUP_CTRL_INTERFACE_H_INCLUDE_GUARD
71 #define LE_SUP_CTRL_INTERFACE_H_INCLUDE_GUARD
72 
73 
74 #include "legato.h"
75 
76 // Interface specific includes
77 #include "le_limit_interface.h"
78 
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 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  *
125  * Disconnect the current client thread from the service providing this API.
126  *
127  * Normally, this function doesn't need to be called. After this function is called, there's no
128  * longer a connection to the service, and the functions in this API can't be used. For details, see
129  * @ref apiFilesC_client.
130  *
131  * This function is created automatically.
132  */
133 //--------------------------------------------------------------------------------------------------
135 (
136  void
137 );
138 
139 
140 //--------------------------------------------------------------------------------------------------
141 
142 //--------------------------------------------------------------------------------------------------
143 typedef struct le_sup_ctrl_App* le_sup_ctrl_AppRef_t;
144 
145 //--------------------------------------------------------------------------------------------------
146 /**
147  * Gets a reference to an application.
148  *
149  * @return
150  * Reference to the named app.
151  * NULL if the app is not installed.
152  */
153 //--------------------------------------------------------------------------------------------------
154 le_sup_ctrl_AppRef_t le_sup_ctrl_GetAppRef
155 (
156  const char* appName
157  ///< [IN] Name of the app to get the ref for.
158 );
159 
160 //--------------------------------------------------------------------------------------------------
161 /**
162  * Release the reference to an application.
163  */
164 //--------------------------------------------------------------------------------------------------
166 (
167  le_sup_ctrl_AppRef_t appRef
168  ///< [IN] Ref to the app.
169 );
170 
171 //--------------------------------------------------------------------------------------------------
172 /**
173  * Sets the run flag for a process in an application.
174  *
175  * If there is an error this function will kill the calling client.
176  */
177 //--------------------------------------------------------------------------------------------------
179 (
180  le_sup_ctrl_AppRef_t appRef,
181  ///< [IN] Ref to the app.
182 
183  const char* procName,
184  ///< [IN] Process name to set the run flag for.
185 
186  bool run
187  ///< [IN] Flag to run the process or not.
188 );
189 
190 //--------------------------------------------------------------------------------------------------
191 /**
192  * Starts an app.
193  *
194  * @return
195  * LE_OK if the app is successfully started.
196  * LE_DUPLICATE if the app is already running.
197  * LE_NOT_FOUND if the app isn't installed.
198  * LE_FAULT if there was an error and the app could not be launched.
199  */
200 //--------------------------------------------------------------------------------------------------
202 (
203  const char* appName
204  ///< [IN] Name of the app to start.
205 );
206 
207 //--------------------------------------------------------------------------------------------------
208 /**
209  * Stops an app.
210  *
211  * @return
212  * LE_OK if successful.
213  * LE_NOT_FOUND if the app could not be found.
214  */
215 //--------------------------------------------------------------------------------------------------
217 (
218  const char* appName
219  ///< [IN] Name of the app to stop.
220 );
221 
222 //--------------------------------------------------------------------------------------------------
223 /**
224  * Stops the Legato framework.
225  *
226  * @return
227  * LE_OK if successful.
228  * LE_DUPLICATE if the framework is in the process of shutting down (perhaps someone else has
229  * already requested the framework be stopped or restarted).
230  */
231 //--------------------------------------------------------------------------------------------------
233 (
234  void
235 );
236 
237 //--------------------------------------------------------------------------------------------------
238 /**
239  * Restarts the Legato framework.
240  *
241  * @return
242  * LE_OK if the request was accepted and the restart procedure has begun.
243  * LE_DUPLICATE if the framework is already in the process of shutting down (perhaps someone
244  * else has already requested the framework be stopped or restarted).
245  */
246 //--------------------------------------------------------------------------------------------------
248 (
249  bool manualRestart
250  ///< [IN] Was the restart manually triggered e.g. "legato restart"
251 );
252 
253 
254 #endif // LE_SUP_CTRL_INTERFACE_H_INCLUDE_GUARD
255 
void le_sup_ctrl_ReleaseAppRef(le_sup_ctrl_AppRef_t appRef)
void le_sup_ctrl_SetRun(le_sup_ctrl_AppRef_t appRef, const char *procName, bool run)
le_result_t
Definition: le_basics.h:35
le_result_t le_sup_ctrl_StartApp(const char *appName)
void le_sup_ctrl_DisconnectService(void)
le_result_t le_sup_ctrl_StopLegato(void)
le_result_t le_sup_ctrl_RestartLegato(bool manualRestart)
void le_sup_ctrl_ConnectService(void)
le_sup_ctrl_AppRef_t le_sup_ctrl_GetAppRef(const char *appName)
le_result_t le_sup_ctrl_StopApp(const char *appName)
le_result_t le_sup_ctrl_TryConnectService(void)