le_atClient_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_atClient_common.h
12  *
13  * Type definitions for le_atClient.
14  *
15  */
16 #ifndef LE_ATCLIENT_COMMON_H_INCLUDE_GUARD
17 #define LE_ATCLIENT_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 // Interface specific includes
23 #include "le_atDefs_common.h"
24 
25 #define IFGEN_LE_ATCLIENT_PROTOCOL_ID "30da77bb0af635abed75b3cc3d248fca"
26 #define IFGEN_LE_ATCLIENT_MSG_SIZE 4111
27 /** @addtogroup le_atClient
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  */
34 //--------------------------------------------------------------------------------------------------
35 typedef struct le_atClient_Cmd* le_atClient_CmdRef_t;
36 
37 
38 //--------------------------------------------------------------------------------------------------
39 /**
40  */
41 //--------------------------------------------------------------------------------------------------
42 typedef struct le_atClient_Device* le_atClient_DeviceRef_t;
43 
44 
45 //--------------------------------------------------------------------------------------------------
46 /**
47  * Reference type used by Add/Remove functions for EVENT 'le_atClient_UnsolicitedResponse'
48  */
49 //--------------------------------------------------------------------------------------------------
50 typedef struct le_atClient_UnsolicitedResponseHandler* le_atClient_UnsolicitedResponseHandlerRef_t;
51 
52 
53 //--------------------------------------------------------------------------------------------------
54 /**
55  * Handler for unsolicited response reception.
56  *
57  */
58 //--------------------------------------------------------------------------------------------------
60 (
61  const char* LE_NONNULL unsolicitedRsp,
62  ///< The call reference.
63  void* contextPtr
64  ///<
65 );
66 
67 
68 //--------------------------------------------------------------------------------------------------
69 /**
70  * Get if this client bound locally.
71  */
72 //--------------------------------------------------------------------------------------------------
73 LE_SHARED bool ifgen_le_atClient_HasLocalBinding
74 (
75  void
76 );
77 
78 
79 //--------------------------------------------------------------------------------------------------
80 /**
81  * Init data that is common across all threads
82  */
83 //--------------------------------------------------------------------------------------------------
84 LE_SHARED void ifgen_le_atClient_InitCommonData
85 (
86  void
87 );
88 
89 
90 //--------------------------------------------------------------------------------------------------
91 /**
92  * Perform common initialization and open a session
93  */
94 //--------------------------------------------------------------------------------------------------
95 LE_SHARED le_result_t ifgen_le_atClient_OpenSession
96 (
97  le_msg_SessionRef_t _ifgen_sessionRef,
98  bool isBlocking
99 );
100 
101 //--------------------------------------------------------------------------------------------------
102 /**
103  * This function must be called to start a ATClient session on a specified device.
104  *
105  * @return reference on a device context
106  */
107 //--------------------------------------------------------------------------------------------------
108 LE_SHARED le_atClient_DeviceRef_t ifgen_le_atClient_Start
109 (
110  le_msg_SessionRef_t _ifgen_sessionRef,
111  int fd
112  ///< [IN] File descriptor.
113 );
114 
115 //--------------------------------------------------------------------------------------------------
116 /**
117  * This function must be called to stop the ATClient session on the specified device.
118  *
119  * @return
120  * - LE_FAULT when function failed
121  * - LE_OK when function succeed
122  */
123 //--------------------------------------------------------------------------------------------------
124 LE_SHARED le_result_t ifgen_le_atClient_Stop
125 (
126  le_msg_SessionRef_t _ifgen_sessionRef,
127  le_atClient_DeviceRef_t device
128  ///< [IN] Device reference
129 );
130 
131 //--------------------------------------------------------------------------------------------------
132 /**
133  * This function must be called to create a new AT command.
134  *
135  * @return pointer to the new AT Command reference
136  */
137 //--------------------------------------------------------------------------------------------------
138 LE_SHARED le_atClient_CmdRef_t ifgen_le_atClient_Create
139 (
140  le_msg_SessionRef_t _ifgen_sessionRef
141 );
142 
143 //--------------------------------------------------------------------------------------------------
144 /**
145  * This function must be called to delete an AT command reference.
146  *
147  * @return
148  * - LE_OK when function succeed
149  *
150  * @note If the AT Command reference is invalid, a fatal error occurs,
151  * the function won't return.
152  */
153 //--------------------------------------------------------------------------------------------------
154 LE_SHARED le_result_t ifgen_le_atClient_Delete
155 (
156  le_msg_SessionRef_t _ifgen_sessionRef,
157  le_atClient_CmdRef_t cmdRef
158  ///< [IN] AT Command
159 );
160 
161 //--------------------------------------------------------------------------------------------------
162 /**
163  * This function must be called to set the AT command string to be sent.
164  *
165  * @return
166  * - LE_OK when function succeed
167  *
168  * @note If the AT Command reference is invalid, a fatal error occurs,
169  * the function won't return.
170  */
171 //--------------------------------------------------------------------------------------------------
172 LE_SHARED le_result_t ifgen_le_atClient_SetCommand
173 (
174  le_msg_SessionRef_t _ifgen_sessionRef,
175  le_atClient_CmdRef_t cmdRef,
176  ///< [IN] AT Command
177  const char* LE_NONNULL command
178  ///< [IN] Set Command
179 );
180 
181 //--------------------------------------------------------------------------------------------------
182 /**
183  * This function must be called to set the waiting intermediate responses.
184  * Several intermediate responses can be specified separated by a '|' character into the string
185  * given in parameter.
186  *
187  * @return
188  * - LE_FAULT when function failed
189  * - LE_OK when function succeed
190  *
191  * @note If the AT Command reference or set intermediate response is invalid, a fatal error occurs,
192  * the function won't return.
193  */
194 //--------------------------------------------------------------------------------------------------
195 LE_SHARED le_result_t ifgen_le_atClient_SetIntermediateResponse
196 (
197  le_msg_SessionRef_t _ifgen_sessionRef,
198  le_atClient_CmdRef_t cmdRef,
199  ///< [IN] AT Command
200  const char* LE_NONNULL intermediate
201  ///< [IN] Set Intermediate
202 );
203 
204 //--------------------------------------------------------------------------------------------------
205 /**
206  * This function must be called to set the final response(s) of the AT command execution.
207  * Several final responses can be specified separated by a '|' character into the string given in
208  * parameter.
209  *
210  * @return
211  * - LE_FAULT when function failed
212  * - LE_OK when function succeed
213  *
214  * @note If the AT Command reference or set response is invalid, a fatal error occurs,
215  * the function won't return.
216  */
217 //--------------------------------------------------------------------------------------------------
218 LE_SHARED le_result_t ifgen_le_atClient_SetFinalResponse
219 (
220  le_msg_SessionRef_t _ifgen_sessionRef,
221  le_atClient_CmdRef_t cmdRef,
222  ///< [IN] AT Command
223  const char* LE_NONNULL response
224  ///< [IN] Set Response
225 );
226 
227 //--------------------------------------------------------------------------------------------------
228 /**
229  * This function must be called to set the text when the prompt is expected.
230  *
231  * @return
232  * - LE_FAULT when function failed
233  * - LE_OK when function succeed
234  *
235  * @note If the AT Command reference is invalid, a fatal error occurs,
236  * the function won't return.
237  */
238 //--------------------------------------------------------------------------------------------------
239 LE_SHARED le_result_t ifgen_le_atClient_SetText
240 (
241  le_msg_SessionRef_t _ifgen_sessionRef,
242  le_atClient_CmdRef_t cmdRef,
243  ///< [IN] AT Command
244  const char* LE_NONNULL text
245  ///< [IN] The AT Data to send
246 );
247 
248 //--------------------------------------------------------------------------------------------------
249 /**
250  * This function must be called to set the timeout of the AT command execution.
251  *
252  * @return
253  * - LE_OK when function succeed
254  *
255  * @note If the AT Command reference is invalid, a fatal error occurs,
256  * the function won't return.
257  */
258 //--------------------------------------------------------------------------------------------------
259 LE_SHARED le_result_t ifgen_le_atClient_SetTimeout
260 (
261  le_msg_SessionRef_t _ifgen_sessionRef,
262  le_atClient_CmdRef_t cmdRef,
263  ///< [IN] AT Command
264  uint32_t timer
265  ///< [IN] The timeout value in milliseconds.
266 );
267 
268 //--------------------------------------------------------------------------------------------------
269 /**
270  * This function must be called to set the device where the AT command will be sent.
271  *
272  * @return
273  * - LE_FAULT when function failed
274  * - LE_OK when function succeed
275  *
276  * @note If the AT Command reference is invalid, a fatal error occurs,
277  * the function won't return.
278  */
279 //--------------------------------------------------------------------------------------------------
280 LE_SHARED le_result_t ifgen_le_atClient_SetDevice
281 (
282  le_msg_SessionRef_t _ifgen_sessionRef,
283  le_atClient_CmdRef_t cmdRef,
284  ///< [IN] AT Command
285  le_atClient_DeviceRef_t devRef
286  ///< [IN] Device where the AT command has to be sent
287 );
288 
289 //--------------------------------------------------------------------------------------------------
290 /**
291  * This function must be called to send an AT Command and wait for response.
292  *
293  * @return
294  * - LE_FAULT when function failed
295  * - LE_TIMEOUT when a timeout occur
296  * - LE_OK when function succeed
297  *
298  * @note If the AT Command reference is invalid, a fatal error occurs,
299  * the function won't return.
300  */
301 //--------------------------------------------------------------------------------------------------
302 LE_SHARED le_result_t ifgen_le_atClient_Send
303 (
304  le_msg_SessionRef_t _ifgen_sessionRef,
305  le_atClient_CmdRef_t cmdRef
306  ///< [IN] AT Command
307 );
308 
309 //--------------------------------------------------------------------------------------------------
310 /**
311  * This function is used to get the first intermediate response.
312  *
313  * @return
314  * - LE_FAULT when function failed
315  * - LE_OK when function succeed
316  *
317  * @note If the AT Command reference is invalid, a fatal error occurs,
318  * the function won't return.
319  */
320 //--------------------------------------------------------------------------------------------------
321 LE_SHARED le_result_t ifgen_le_atClient_GetFirstIntermediateResponse
322 (
323  le_msg_SessionRef_t _ifgen_sessionRef,
324  le_atClient_CmdRef_t cmdRef,
325  ///< [IN] AT Command
326  char* intermediateRsp,
327  ///< [OUT] First intermediate result code
328  size_t intermediateRspSize
329  ///< [IN]
330 );
331 
332 //--------------------------------------------------------------------------------------------------
333 /**
334  * This function is used to get the next intermediate response.
335  *
336  * @return
337  * - LE_NOT_FOUND when there are no further results
338  * - LE_OK when function succeed
339  *
340  * @note If the AT Command reference is invalid, a fatal error occurs,
341  * the function won't return.
342  */
343 //--------------------------------------------------------------------------------------------------
344 LE_SHARED le_result_t ifgen_le_atClient_GetNextIntermediateResponse
345 (
346  le_msg_SessionRef_t _ifgen_sessionRef,
347  le_atClient_CmdRef_t cmdRef,
348  ///< [IN] AT Command
349  char* intermediateRsp,
350  ///< [OUT] Get Next intermediate result
351  ///< code.
352  size_t intermediateRspSize
353  ///< [IN]
354 );
355 
356 //--------------------------------------------------------------------------------------------------
357 /**
358  * This function is used to get the final response
359  *
360  * @return
361  * - LE_FAULT when function failed
362  * - LE_OK when function succeed
363  *
364  * @note If the AT Command reference is invalid, a fatal error occurs,
365  * the function won't return.
366  */
367 //--------------------------------------------------------------------------------------------------
368 LE_SHARED le_result_t ifgen_le_atClient_GetFinalResponse
369 (
370  le_msg_SessionRef_t _ifgen_sessionRef,
371  le_atClient_CmdRef_t cmdRef,
372  ///< [IN] AT Command
373  char* finalRsp,
374  ///< [OUT] Get Final Line
375  size_t finalRspSize
376  ///< [IN]
377 );
378 
379 //--------------------------------------------------------------------------------------------------
380 /**
381  * This function must be called to automatically set and send an AT Command.
382  *
383  * @return
384  * - LE_FAULT when function failed
385  * - LE_TIMEOUT when a timeout occur
386  * - LE_OK when function succeed
387  *
388  * @note This command creates a command reference when called
389  *
390  * @note In case of an Error the command reference will be deleted and though
391  * not usable. Make sure to test the return code and not use the reference
392  * in other functions.
393  *
394  * @note If the AT command is invalid, a fatal error occurs,
395  * the function won't return.
396  *
397  */
398 //--------------------------------------------------------------------------------------------------
399 LE_SHARED le_result_t ifgen_le_atClient_SetCommandAndSend
400 (
401  le_msg_SessionRef_t _ifgen_sessionRef,
402  le_atClient_CmdRef_t* cmdRefPtr,
403  ///< [OUT] Cmd reference
404  le_atClient_DeviceRef_t devRef,
405  ///< [IN] Dev reference
406  const char* LE_NONNULL command,
407  ///< [IN] AT Command
408  const char* LE_NONNULL interResp,
409  ///< [IN] Expected intermediate response
410  const char* LE_NONNULL finalResp,
411  ///< [IN] Expected final response
412  uint32_t timeout
413  ///< [IN] Timeout value in milliseconds.
414 );
415 
416 //--------------------------------------------------------------------------------------------------
417 /**
418  * Add handler function for EVENT 'le_atClient_UnsolicitedResponse'
419  *
420  * This event provides information on a subscribed unsolicited response when this unsolicited
421  * response is received.
422  *
423  */
424 //--------------------------------------------------------------------------------------------------
425 LE_SHARED le_atClient_UnsolicitedResponseHandlerRef_t ifgen_le_atClient_AddUnsolicitedResponseHandler
426 (
427  le_msg_SessionRef_t _ifgen_sessionRef,
428  const char* LE_NONNULL unsolRsp,
429  ///< [IN] Pattern to match
430  le_atClient_DeviceRef_t devRef,
431  ///< [IN] Device to listen
433  ///< [IN] unsolicited handler
434  void* contextPtr,
435  ///< [IN]
436  uint32_t lineCount
437  ///< [IN] Indicate the number of line of
438  ///< the unsolicited
439 );
440 
441 //--------------------------------------------------------------------------------------------------
442 /**
443  * Remove handler function for EVENT 'le_atClient_UnsolicitedResponse'
444  */
445 //--------------------------------------------------------------------------------------------------
446 LE_SHARED void ifgen_le_atClient_RemoveUnsolicitedResponseHandler
447 (
448  le_msg_SessionRef_t _ifgen_sessionRef,
450  ///< [IN]
451 );
452 /** @} **/
453 #endif // LE_ATCLIENT_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
void(* le_atClient_UnsolicitedResponseHandlerFunc_t)(const char *LE_NONNULL unsolicitedRsp, void *contextPtr)
Definition: le_atClient_common.h:60
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
struct le_atClient_UnsolicitedResponseHandler * le_atClient_UnsolicitedResponseHandlerRef_t
Definition: le_atClient_common.h:50