le_atServer_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_atServer AT Commands Server
14  *
15  * @ref le_atServer_interface.h "API Reference"
16  *
17  * The AT commands Server handles AT commands' subscriptions on a requested serial device. The
18  * server is compliant with 3GPP 27.007, paragraphs 4.0, 4.1 and 4.2, and V25 ter, paragraphs 5.3,
19  * 5.4.
20  *
21  * @section le_atServer_binding IPC interfaces binding
22  *
23  * All the functions of this API are provided by the @b atService.
24  *
25  * Here's a code sample binding to the AT commands server:
26  * @verbatim
27  bindings:
28  {
29  atServerTest.atServerTestComp.le_atServer -> atService.le_atServer
30  }
31  @endverbatim
32  *
33  * @section atServer_syntax AT command syntax
34  *
35  * @subsection atServer_Syntax Syntax rules
36  *
37  * To be interpreted, the command line sent to the AT commands server must start by the pattern
38  * "AT" (mean ATtention command).<br>
39  * Lowercase characters are changed to their uppercase equivalents. Only characters between quotes
40  * are not replaced.
41  *
42  * The supported command formats are:
43  * - Basic syntax command:
44  * - using the format AT<command>[<number>]<br>
45  * The command name is composed of one or several of those characters: A to Z, & and \\.
46  * - the syntax of S command is also supported, like:
47  * - ATS<parameter_number>?
48  * - ATS<parameter_number>=<value>
49  * - D command is supported. The characters which don't belong to the following list are
50  * ignore:
51  * - V.250 dialing digits: 0 1 2 3 4 5 6 7 8 9 * # + A B C D
52  * - V.250 modifier characters: , T P ! W @
53  * - V.250 semicolon character: ;
54  * - GSM/UMTS modifier characters:
55  * - I or i for CLIR supplementary service subscription
56  * (I=invocation, i=suppression)
57  * - G or g for CUG supplementary service subscription (G=invocation,
58  * g=suppression)
59  * - Direct dialing from phonebook: > (if follow by a string, it has to be put
60  * between quote)
61  * .
62  * @if 0 doxygen comment: The dot above ends the sub item, and must be kept @endif
63  * All characters after the "D" are considered part of The D command parameter up to a semicolon or
64  * the end of command line.
65  * <br>
66  * - Extended command format, with the following format:
67  * - action command with no parameters: AT+<name>
68  * - parameter command: AT+<name>=<value1>[,<value2>[,<value3>[...]]]<br>
69  * Values must be separated by a coma. Some values may be optional: in that case, optional
70  * value can be omitted in the AT command (e.g. AT+ABCD=,1).<br>
71  * A value is a string composed of one or several of the following characters: 0 to 9,
72  * A to F, H, z*, #, +, -. To set a value with other characters, the value has to be set
73  * between quote.
74  * - test command (determine the supported values): AT+<name>=?
75  * - read command (determine the current values, or stored values): AT+<name>?
76  *
77  * @note '+' AT command starting character shall be replaced by other symbol, not included into
78  * a to z, A to Z, & and \\.
79  *
80  * @subsection atServer_concate Concatenating commands
81  *
82  * Basic syntax command can be concatenated without a separator:<br>
83  * ATE1V1S95=47S0=0
84  *
85  * Additional commands (extended syntax command or basic syntax command) can be added after an
86  * extended syntax command with the insertion of a semicolon at the end of the command:<br>
87  * AT+CMDA=<param1>,<param2>;+CMDB?;+CMDC=?<br>
88  * AT+CMDA=<param1>,<param2>;E1V1
89  *
90  * Extended syntax command can be concatenated after basic syntax commands without a separator:<br>
91  * ATE1V1+CMD=<param1>
92  *
93  * @section atServer_binding Device Binding
94  *
95  * le_atServer_Open() must be called to bind the file descriptor of the device with the AT commands
96  * server. Note that a socket can also be bound.
97  * Multiple devices can be bound.
98  * A file descriptor can be unbound using le_atServer_Close().
99  *
100  * The server can be suspended using le_atServer_Suspend() in order to use the
101  * opened fd for other purposes like starting a PPP service on the opened fd.
102  * For that a fd dup needs to be done before opening a server session.
103  * When needed, the server can be resumed using le_atServer_Resume(). Make sure
104  * to close the fd when the application exists or you may get too many open files error.
105  *
106  * used before opening a server session
107  * @section atServer_subscription Subscription
108  *
109  * A new AT command can be added into the parser using le_atServer_Create(), and it can be deleted
110  * using le_atServer_Delete().
111  * le_atServer_EnableEcho() allows the user to enable echo on a selected device.
112  * le_atServer_DisableEcho() allows the user to disable echo on a selected device.
113  *
114  * @section atServer_handler Handler
115  *
116  * To handle the AT command, the application has to subscribe a handler using
117  * le_atServer_AddCommandHandler(). It can be removed with le_atServer_RemoveCommandHandler().
118  *
119  * The called handler (le_atServer_CommandHandlerRef_t prototype) can use
120  * le_atServer_GetCommandName() to retrieve the received AT command string.
121  *
122  * The device used to execute the AT command can be retrieve thanks to le_atServer_GetDevice().
123  *
124  * It can also call le_atServer_GetParameter() to retrieve parameters of the AT command. This
125  * function gets the string sending through the AT command. If the parameter was sent between
126  * quotes, the quotes are removed. This API can be used for both formats:
127  * - In case of a basic format command, if exists, the parameter can be retrieved at the index 0.
128  *
129  * For S command specific format (ATS<parameter_number>=<value>), the <parameter_number> is
130  * retrieved at the index 0, the <value> parameter at the index 1.
131  *
132  * - In case of an extended format command, parameters are retrieved thanks to their indexes,
133  * starting from 0. If the parameter is missed (e.g. "AT+CMD=,1"), the getting value is an empty
134  * string (i.e. '\0' with null length).
135  *
136  * The handler receives in argument the type of the AT command (of le_atServer_Type_t type).
137  * Even if these types are specific to the extended format commands according to the standards, they
138  * are also applicable here to basic format commands to detect commands with parameters, or read
139  * values (e.g. ATS<parameter_number>?).
140  *
141  * @section atServer_responses Responses
142  *
143  * @subsection intermediateRsp Intermediate response
144  *
145  * The application has can send intermediate responses through
146  * le_atServer_SendIntermediateResponse().
147  *
148  * @subsection finalResultCode Final result code
149  *
150  * The application must return a final result code using le_atServer_SendFinalResultCode().
151  * The corresponding device will be locked until the final response is sent.
152  *
153  * If no answer is sent, the device will not accept any new AT commands (an error will be
154  * returned).
155  *
156  * le_atServer_SendFinalResultCode() takes as arguments the AT command reference, a pattern (which
157  * is the prefix of the final response), a final response type as defined in
158  * @ref le_atServer_FinalRsp_t and an error code identifier.
159  *
160  * The final response type permits to the AT command Server to continue or stop the parsing of
161  * concatenated commands: if one command is failed, next commands are not executed, the final result
162  * of the concatenated AT command is the last error.
163  *
164  * @subsection finalRsp Final response
165  *
166  * @deprecated le_atServer_SendFinalResponse() should not be used anymore and will be removed soon.
167  * It has been replaced by le_atServer_SendFinalResultCode().
168  *
169  * In all cases, the application must send a final response using
170  * le_atServer_SendFinalResponse(). The corresponding device will be locked until the final response
171  * is sent.
172  *
173  * If no answer is sent, the device will not accept any new AT commands (an error will be
174  * returned).
175  *
176  * le_atServer_SendFinalResponse() has to inform of the result thanks to the argument of
177  * le_atServer_FinalRsp_t type. This argument permits to the AT command Server to:
178  * - create the result string if no custom string is provided
179  * - continue or stop the parsing of concatenated commands: if one command is failed, next commands
180  * are not executed, the final result of the concatenated AT command is the last error.
181  *
182  * @subsection unsolicitedRsp Unsolicited response
183  *
184  * The application can also send unsolicited responses to warn a host
185  * application using le_atServer_SendUnsolicitedResponse().
186  *
187  * This response is sent when no AT command is being processing on the device (i.e. unsolicited
188  * response is sent between the latest final response and the next reception of an AT command).
189  *
190  * If an unsolicited response is sent when an AT command is in progress, the unsolicited response
191  * is buffered and sent as soon as the device becomes available (i.e., the processing AT command
192  * sends its final response).
193  *
194  * @section atServer_errors Error codes
195  *
196  * le_atServer_EnableExtendedErrorCodes() allows the user to use extended error codes on a selected
197  * device. When this mode is enabled, numerical codes are displayed when an error occurs.
198  * le_atServer_EnableVerboseErrorCodes() allows the user to enable verbose error codes on a selected
199  * device. Thus, instead of numerical codes, error are actually displayed as verbose messages.
200  * le_atServer_DisableExtendedErrorCodes() allows the user to disable the current error mode namely
201  * extended error codes or verbose error codes on a selected device.
202  *
203  * User can create custom error codes using le_atServer_CreateErrorCode() by providing an error
204  * code identifier and a specific pattern. The pattern is a prefix of the final response string.
205  * Standard error codes use the patterns "+CME ERROR: " and "+CMS ERROR: " for instance. These
206  * standard patterns are defined in the following macros: CME_ERROR and CMS_ERROR.
207  * The code identifier should be equal or higher than 512 as the range [0, 511] is reserved for
208  * standard error codes defined in 3GPP 27.007 9.2 and TS 127.005 3.2.5.
209  *
210  * le_atServer_CreateErrorCode() returns a reference which can be used to attach a custom verbose
211  * message to the error codes by calling le_atServer_SetVerboseErrorCode().
212  * le_atServer_DeleteErrorCode() allows the user to drop an already registered error code.
213  *
214  * @section Text
215  *
216  * le_atServer_GetTextAsync() allows the user to register a le_atServer_GetTextCallback_t callback
217  * to retrieve text and sends a prompt <CR><LF><greater_than><SPACE> on the current command's
218  * device.
219  *
220  * It will receive at max LE_ATDEFS_TEXT_MAX_LEN bytes.
221  * If Esc Key is hit then the command is canceled and an empty buffer is returned with result
222  * set to LE_OK.
223  * If Ctrl+z is hit then the received buffer is returned and the result is set to LE_OK.
224  * In case of a read error, an empty buffer is returned with result set to LE_IO_ERROR;
225  *
226  * Example:
227  *
228  * AT+CMGS="+85291234567"
229  * > <ESC>
230  *
231  * OK
232  *
233  * AT+CMGS="+85291234567"
234  * > It is easy to send text messages. <CTRL-Z>
235  * +CMGS: 5
236  *
237  * OK
238  *
239  * @section atServer_bridge Bridge
240  *
241  * A second file descriptor can be used thanks to le_atServer_OpenBridge() to send
242  * all unknown AT commands to an alternative device (such as the modem). For all devices linked to
243  * that bridge using le_atServer_AddDeviceToBridge(), unknown commands will be sent through that
244  * file descriptor.
245  *
246  * The bridge only works with AT commands that have the following terminal responses:
247  * - "OK"
248  * - "NO CARRIER"
249  * - "NO DIALTONE"
250  * - "BUSY"
251  * - "NO ANSWSER"
252  * - "ERROR"
253  * - "+CME ERROR"
254  * - "+CMS ERROR"
255  *
256  * AT commands executed through the bridge do not support text mode (e.g.; +CMGS) or data mode
257  * (e.g.; ATD*99***1#). Sending these commands through the bridge may lock the Legato AT commands
258  * parser.
259  *
260  * @image html atCommandsParserBridge.png
261  *
262  * @note AT commands server is opened on the file descriptor fd1 using le_atServer_Open() API.
263  * AT commands server is bridged on the file descriptor fd2 using le_atServer_OpenBridge() API.
264  *
265  * A device can be remove from a bridge thanks to le_atServer_RemoveDeviceFromBridge() API.
266  * A bridge can be closed using le_atServer_CloseBridge() API.
267  *
268  * @warning Some modem AT commands may conflict with Legato APIs; using both may cause problems that
269  * can be difficult to diagnose. The modem AT commands should be avoided whenever possible, and
270  * should only be used with great care.
271  *
272  * The application can send an unsolicited on all opened device, or only one on a dedicated device.
273  *
274  *
275  * Copyright (C) Sierra Wireless Inc.
276  */
277 /**
278  * @file le_atServer_interface.h
279  *
280  * Legato @ref c_atServer include file.
281  *
282  * Copyright (C) Sierra Wireless Inc.
283  */
284 
285 #ifndef LE_ATSERVER_INTERFACE_H_INCLUDE_GUARD
286 #define LE_ATSERVER_INTERFACE_H_INCLUDE_GUARD
287 
288 
289 #include "legato.h"
290 
291 // Interface specific includes
292 #include "le_atDefs_interface.h"
293 
294 
295 //--------------------------------------------------------------------------------------------------
296 /**
297  * Type for handler called when a server disconnects.
298  */
299 //--------------------------------------------------------------------------------------------------
300 typedef void (*le_atServer_DisconnectHandler_t)(void *);
301 
302 //--------------------------------------------------------------------------------------------------
303 /**
304  *
305  * Connect the current client thread to the service providing this API. Block until the service is
306  * available.
307  *
308  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
309  * called before any other functions in this API. Normally, ConnectService is automatically called
310  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
311  *
312  * This function is created automatically.
313  */
314 //--------------------------------------------------------------------------------------------------
316 (
317  void
318 );
319 
320 //--------------------------------------------------------------------------------------------------
321 /**
322  *
323  * Try to connect the current client thread to the service providing this API. Return with an error
324  * if the service is not available.
325  *
326  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
327  * called before any other functions in this API. Normally, ConnectService is automatically called
328  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
329  *
330  * This function is created automatically.
331  *
332  * @return
333  * - LE_OK if the client connected successfully to the service.
334  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
335  * bound.
336  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
337  * - LE_COMM_ERROR if the Service Directory cannot be reached.
338  */
339 //--------------------------------------------------------------------------------------------------
341 (
342  void
343 );
344 
345 //--------------------------------------------------------------------------------------------------
346 /**
347  * Set handler called when server disconnection is detected.
348  *
349  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
350  * to continue without exiting, it should call longjmp() from inside the handler.
351  */
352 //--------------------------------------------------------------------------------------------------
354 (
355  le_atServer_DisconnectHandler_t disconnectHandler,
356  void *contextPtr
357 );
358 
359 //--------------------------------------------------------------------------------------------------
360 /**
361  *
362  * Disconnect the current client thread from the service providing this API.
363  *
364  * Normally, this function doesn't need to be called. After this function is called, there's no
365  * longer a connection to the service, and the functions in this API can't be used. For details, see
366  * @ref apiFilesC_client.
367  *
368  * This function is created automatically.
369  */
370 //--------------------------------------------------------------------------------------------------
372 (
373  void
374 );
375 
376 
377 //--------------------------------------------------------------------------------------------------
378 /**
379  * Maximum text length.
380  */
381 //--------------------------------------------------------------------------------------------------
382 #define LE_ATSERVER_TEXT_MAX_LEN 4096
383 
384 //--------------------------------------------------------------------------------------------------
385 /**
386  * CME error pattern
387  */
388 //--------------------------------------------------------------------------------------------------
389 #define LE_ATSERVER_CME_ERROR "+CME ERROR: "
390 
391 //--------------------------------------------------------------------------------------------------
392 /**
393  * CMS error pattern
394  */
395 //--------------------------------------------------------------------------------------------------
396 #define LE_ATSERVER_CMS_ERROR "+CMS ERROR: "
397 
398 //--------------------------------------------------------------------------------------------------
399 /**
400  * Reference type for an AT command.
401  */
402 //--------------------------------------------------------------------------------------------------
403 typedef struct le_atServer_Cmd* le_atServer_CmdRef_t;
404 
405 
406 //--------------------------------------------------------------------------------------------------
407 /**
408  * Reference type for a AT command device.
409  */
410 //--------------------------------------------------------------------------------------------------
411 typedef struct le_atServer_Device* le_atServer_DeviceRef_t;
412 
413 
414 //--------------------------------------------------------------------------------------------------
415 /**
416  * Reference type for a AT commands server / AT commands client bridge.
417  */
418 //--------------------------------------------------------------------------------------------------
419 typedef struct le_atServer_Bridge* le_atServer_BridgeRef_t;
420 
421 
422 //--------------------------------------------------------------------------------------------------
423 /**
424  * Reference type for an error code.
425  */
426 //--------------------------------------------------------------------------------------------------
427 typedef struct le_atServer_ErrorCode* le_atServer_ErrorCodeRef_t;
428 
429 
430 //--------------------------------------------------------------------------------------------------
431 /**
432  * Received AT command type.
433  *
434  */
435 //--------------------------------------------------------------------------------------------------
436 typedef enum
437 {
439  ///< Action AT command (e.g. 'AT+CMD')
441  ///< AT command received with parameters (e.g. 'AT+CMD=x,y')
443  ///< Test AT command (e.g. 'AT+CMD=?')
445  ///< Read AT command (e.g. 'AT+CMD?')
446 }
448 
449 
450 //--------------------------------------------------------------------------------------------------
451 /**
452  * Final response.
453  */
454 //--------------------------------------------------------------------------------------------------
455 typedef enum
456 {
458  ///< AT command successfully treated
460  ///< Connection terminated
462  ///< Error in AT command treatement
464  ///< No dialtone detected
466  ///< Busy signal detected
467 }
469 
470 
471 //--------------------------------------------------------------------------------------------------
472 /**
473  * Device availability.
474  */
475 //--------------------------------------------------------------------------------------------------
476 typedef enum
477 {
479  ///< action will be done on all bound devices
481  ///< action will be done on a specified device
482 }
484 
485 
486 //--------------------------------------------------------------------------------------------------
487 /**
488  * Reference type used by Add/Remove functions for EVENT 'le_atServer_Command'
489  */
490 //--------------------------------------------------------------------------------------------------
491 typedef struct le_atServer_CommandHandler* le_atServer_CommandHandlerRef_t;
492 
493 
494 //--------------------------------------------------------------------------------------------------
495 /**
496  * Handler for the AT command processing.
497  *
498  * @note The argument "parametersNumber" is set only when "type" parameter value is
499  * LE_AT_SERVER_TYPE_PARA
500  */
501 //--------------------------------------------------------------------------------------------------
502 typedef void (*le_atServer_CommandHandlerFunc_t)
503 (
504  le_atServer_CmdRef_t commandRef,
505  ///< Received AT command reference
506  le_atServer_Type_t type,
507  ///< Received AT command type
508  uint32_t parametersNumber,
509  ///< Parameters number
510  void* contextPtr
511  ///<
512 );
513 
514 //--------------------------------------------------------------------------------------------------
515 /**
516  * Get text callback
517  *
518  * @return
519  * - LE_OK: The function succeeded
520  * - LE_IO_ERROR: An io error happened and the function couldn't read from the device
521  * - LE_FORMAT_ERROR: Received an invalid character or an invalid sequence
522  * - LE_FAULT: Failed to remove backspaces
523  */
524 //--------------------------------------------------------------------------------------------------
525 typedef void (*le_atServer_GetTextCallbackFunc_t)
526 (
527  le_atServer_CmdRef_t cmdRef,
528  ///< Received AT command reference
529  le_result_t result,
530  ///< Result
531  const char* LE_NONNULL text,
532  ///< Received text
533  uint32_t len,
534  ///< Text length
535  void* contextPtr
536  ///<
537 );
538 
539 //--------------------------------------------------------------------------------------------------
540 /**
541  * Suspend server / enter data mode
542  *
543  * When this function is called the server stops monitoring the fd for events
544  * hence no more I/O operations are done on the fd by the server.
545  *
546  * @return
547  * - LE_OK Success.
548  * - LE_BAD_PARAMETER Invalid device reference.
549  * - LE_FAULT Device not monitored
550  *
551  */
552 //--------------------------------------------------------------------------------------------------
554 (
556  ///< [IN] device to be suspended
557 );
558 
559 //--------------------------------------------------------------------------------------------------
560 /**
561  * Resume server / enter command mode
562  *
563  * When this function is called the server resumes monitoring the fd for events
564  * and is able to interpret AT commands again.
565  *
566  * @return
567  * - LE_OK Success.
568  * - LE_BAD_PARAMETER Invalid device reference.
569  * - LE_FAULT Device not monitored
570  *
571  */
572 //--------------------------------------------------------------------------------------------------
574 (
576  ///< [IN] device to be resumed
577 );
578 
579 //--------------------------------------------------------------------------------------------------
580 /**
581  * This function opens an AT server session on the requested device.
582  *
583  * @return
584  * - Reference to the requested device.
585  * - NULL if the device is not available or fd is a BAD FILE DESCRIPTOR.
586  *
587  * @note Make sure to duplicate (man dup) your file descriptor before opening
588  * a server session to be able to use the suspend/resume feature
589  *
590  */
591 //--------------------------------------------------------------------------------------------------
593 (
594  int fd
595  ///< [IN] File descriptor.
596 );
597 
598 //--------------------------------------------------------------------------------------------------
599 /**
600  * This function closes the AT server session on the requested device.
601  *
602  * @return
603  * - LE_OK The function succeeded.
604  * - LE_BAD_PARAMETER Invalid device reference.
605  * - LE_BUSY The requested device is busy.
606  * - LE_FAULT Failed to stop the server, check logs
607  * for more information.
608  */
609 //--------------------------------------------------------------------------------------------------
611 (
613  ///< [IN] device to be unbound
614 );
615 
616 //--------------------------------------------------------------------------------------------------
617 /**
618  * This function created an AT command and register it into the AT parser.
619  *
620  * @return
621  * - Reference to the AT command.
622  * - NULL if an error occurs.
623  */
624 //--------------------------------------------------------------------------------------------------
626 (
627  const char* LE_NONNULL name
628  ///< [IN] AT command name string
629 );
630 
631 //--------------------------------------------------------------------------------------------------
632 /**
633  * This function deletes an AT command (i.e. unregister from the AT parser).
634  *
635  * @return
636  * - LE_OK The function succeeded.
637  * - LE_FAULT The function failed to delete the command.
638  * - LE_BUSY Command is in progress.
639  *
640  */
641 //--------------------------------------------------------------------------------------------------
643 (
644  le_atServer_CmdRef_t commandRef
645  ///< [IN] AT command reference
646 );
647 
648 //--------------------------------------------------------------------------------------------------
649 /**
650  * Add handler function for EVENT 'le_atServer_Command'
651  *
652  * This event provides information when the AT command is detected.
653  *
654  */
655 //--------------------------------------------------------------------------------------------------
657 (
658  le_atServer_CmdRef_t commandRef,
659  ///< [IN] AT command reference
661  ///< [IN] Handler to called when the AT command is detected
662  void* contextPtr
663  ///< [IN]
664 );
665 
666 //--------------------------------------------------------------------------------------------------
667 /**
668  * Remove handler function for EVENT 'le_atServer_Command'
669  */
670 //--------------------------------------------------------------------------------------------------
672 (
674  ///< [IN]
675 );
676 
677 //--------------------------------------------------------------------------------------------------
678 /**
679  * This function can be used to get the parameters of a received AT command.
680  *
681  * @return
682  * - LE_OK The function succeeded.
683  * - LE_FAULT The function failed to get the requested parameter.
684  *
685  */
686 //--------------------------------------------------------------------------------------------------
688 (
689  le_atServer_CmdRef_t commandRef,
690  ///< [IN] AT command reference
691  uint32_t index,
692  ///< [IN] agument index
693  char* parameter,
694  ///< [OUT] parameter value
695  size_t parameterSize
696  ///< [IN]
697 );
698 
699 //--------------------------------------------------------------------------------------------------
700 /**
701  * This function can be used to get the AT command string.
702  *
703  * @return
704  * - LE_OK The function succeeded.
705  * - LE_FAULT The function failed to get the AT command string.
706  *
707  */
708 //--------------------------------------------------------------------------------------------------
710 (
711  le_atServer_CmdRef_t commandRef,
712  ///< [IN] AT command reference
713  char* name,
714  ///< [OUT] AT command string
715  size_t nameSize
716  ///< [IN]
717 );
718 
719 //--------------------------------------------------------------------------------------------------
720 /**
721  * This function can be used to get the device reference in use for an AT command specified with
722  * its reference.
723  *
724  * @return
725  * - LE_OK The function succeeded.
726  * - LE_FAULT The function failed to get the AT command string.
727  *
728  */
729 //--------------------------------------------------------------------------------------------------
731 (
732  le_atServer_CmdRef_t commandRef,
733  ///< [IN] AT command reference
734  le_atServer_DeviceRef_t* deviceRefPtr
735  ///< [OUT] Device reference
736 );
737 
738 //--------------------------------------------------------------------------------------------------
739 /**
740  * This function can be used to send an intermediate response.
741  *
742  * @return
743  * - LE_OK The function succeeded.
744  * - LE_FAULT The function failed to send the intermediate response.
745  *
746  */
747 //--------------------------------------------------------------------------------------------------
749 (
750  le_atServer_CmdRef_t commandRef,
751  ///< [IN] AT command reference
752  const char* LE_NONNULL intermediateRsp
753  ///< [IN] Intermediate response to be
754  ///< sent
755 );
756 
757 //--------------------------------------------------------------------------------------------------
758 /**
759  * This function can be used to send the final response.
760  *
761  * @deprecated le_atServer_SendFinalResponse() should not be used anymore and will be removed soon.
762  * It has been replaced by le_atServer_SendFinalResultCode()
763  *
764  * @return
765  * - LE_OK The function succeeded.
766  * - LE_FAULT The function failed to send the final response.
767  *
768  */
769 //--------------------------------------------------------------------------------------------------
771 (
772  le_atServer_CmdRef_t commandRef,
773  ///< [IN] AT command reference
774  le_atServer_FinalRsp_t finalResponse,
775  ///< [IN] Final response to be sent
776  bool customStringAvailable,
777  ///< [IN] Custom final response has to be sent
778  ///< instead of the default one.
779  const char* LE_NONNULL finalRsp
780  ///< [IN] custom final response string
781 );
782 
783 //--------------------------------------------------------------------------------------------------
784 /**
785  * This function can be used to send the final result code.
786  *
787  * @return
788  * - LE_OK The function succeeded.
789  * - LE_FAULT The function failed to send the final result code.
790  *
791  */
792 //--------------------------------------------------------------------------------------------------
794 (
795  le_atServer_CmdRef_t commandRef,
796  ///< [IN] AT command reference
797  le_atServer_FinalRsp_t finalResult,
798  ///< [IN] Final result code to be sent
799  const char* LE_NONNULL pattern,
800  ///< [IN] Prefix of the return message
801  uint32_t errorCode
802  ///< [IN] Numeric error code
803 );
804 
805 //--------------------------------------------------------------------------------------------------
806 /**
807  * This function can be used to send the unsolicited response.
808  *
809  * @return
810  * - LE_OK The function succeeded.
811  * - LE_FAULT The function failed to send the unsolicited response.
812  *
813  */
814 //--------------------------------------------------------------------------------------------------
816 (
817  const char* LE_NONNULL unsolRsp,
818  ///< [IN] Unsolicited response to be
819  ///< sent
820  le_atServer_AvailableDevice_t availableDevice,
821  ///< [IN] device to send the
822  ///< unsolicited response
824  ///< [IN] device reference where the
825  ///< unsolicited response has to
826  ///< be sent
827 );
828 
829 //--------------------------------------------------------------------------------------------------
830 /**
831  * This function enables echo on the selected device.
832  *
833  * @return
834  * - LE_OK The function succeeded.
835  * - LE_BAD_PARAMETER Invalid device reference.
836  */
837 //--------------------------------------------------------------------------------------------------
839 (
841  ///< [IN] device reference
842 );
843 
844 //--------------------------------------------------------------------------------------------------
845 /**
846  * This function disables echo on the selected device.
847  *
848  * @return
849  * - LE_OK The function succeeded.
850  * - LE_BAD_PARAMETER Invalid device reference.
851  */
852 //--------------------------------------------------------------------------------------------------
854 (
856  ///< [IN] device reference
857 );
858 
859 //--------------------------------------------------------------------------------------------------
860 /**
861  * This function opens a AT commands server bridge.
862  * All unknown AT commands will be sent on this alternative file descriptor thanks to the AT client
863  * Service.
864  *
865  * @return
866  * - Reference to the requested bridge.
867  * - NULL if the device can't be bridged
868  */
869 //--------------------------------------------------------------------------------------------------
871 (
872  int fd
873  ///< [IN] File descriptor.
874 );
875 
876 //--------------------------------------------------------------------------------------------------
877 /**
878  * This function closes an opened bridge.
879  *
880  * @return
881  * - LE_OK The function succeeded.
882  * - LE_FAULT The function failed to close the bridge.
883  * - LE_BUSY The bridge is in use (devices references have to be removed first).
884  */
885 //--------------------------------------------------------------------------------------------------
887 (
888  le_atServer_BridgeRef_t bridgeRef
889  ///< [IN] Bridge reference
890 );
891 
892 //--------------------------------------------------------------------------------------------------
893 /**
894  * This function adds a device to an opened bridge.
895  *
896  * @return
897  * - LE_OK The function succeeded.
898  * - LE_BUSY The device is already used by the bridge.
899  * - LE_FAULT The function failed to add the device to the bridge.
900  */
901 //--------------------------------------------------------------------------------------------------
903 (
904  le_atServer_DeviceRef_t deviceRef,
905  ///< [IN] Device reference to add to the bridge
906  le_atServer_BridgeRef_t bridgeRef
907  ///< [IN] Bridge refence
908 );
909 
910 //--------------------------------------------------------------------------------------------------
911 /**
912  * This function removes a device from a bridge
913  *
914  * @return
915  * - LE_OK The function succeeded.
916  * - LE_NOT_FOUND The device is not isued by the specified bridge
917  * - LE_BUSY The device is currently in use
918  * - LE_FAULT The function failed to add the device to the bridge.
919  */
920 //--------------------------------------------------------------------------------------------------
922 (
923  le_atServer_DeviceRef_t deviceRef,
924  ///< [IN] Device reference to add to the bridge
925  le_atServer_BridgeRef_t bridgeRef
926  ///< [IN] Bridge refence
927 );
928 
929 //--------------------------------------------------------------------------------------------------
930 /**
931  * This function enables verbose error codes on the selected device.
932  */
933 //--------------------------------------------------------------------------------------------------
935 (
936  void
937 );
938 
939 //--------------------------------------------------------------------------------------------------
940 /**
941  * This function enables extended error codes on the selected device.
942  */
943 //--------------------------------------------------------------------------------------------------
945 (
946  void
947 );
948 
949 //--------------------------------------------------------------------------------------------------
950 /**
951  * This function disables extended error codes on the selected device.
952  */
953 //--------------------------------------------------------------------------------------------------
955 (
956  void
957 );
958 
959 //--------------------------------------------------------------------------------------------------
960 /**
961  * This function creates a custom error code.
962  * @return
963  * - ErrorCode Reference to the created error code
964  * - NULL Function failed to create the error code
965  *
966  * @note This function fails to create the error code if the combinaison (errorCode, pattern)
967  * already exists or if the errorCode number is lower than 512.
968  *
969  */
970 //--------------------------------------------------------------------------------------------------
972 (
973  uint32_t errorCode,
974  ///< [IN] Numerical error code
975  const char* LE_NONNULL pattern
976  ///< [IN] Prefix of the response message
977 );
978 
979 //--------------------------------------------------------------------------------------------------
980 /**
981  * This function deletes a custom error code.
982  *
983  * @return
984  * - LE_OK The function succeeded
985  * - LE_FAULT The function failed to delete the error code
986  */
987 //--------------------------------------------------------------------------------------------------
989 (
990  le_atServer_ErrorCodeRef_t errorCodeRef
991  ///< [IN] Error code reference
992 );
993 
994 //--------------------------------------------------------------------------------------------------
995 /**
996  * This function adds a verbose message to a specified error code
997  *
998  * @return
999  * - LE_OK The function succeeded
1000  * - LE_FAULT The function failed to set the verbose message
1001  */
1002 //--------------------------------------------------------------------------------------------------
1004 (
1005  le_atServer_ErrorCodeRef_t errorCodeRef,
1006  ///< [IN] Error code reference
1007  const char* LE_NONNULL verboseCode
1008  ///< [IN] Verbose message
1009 );
1010 
1011 //--------------------------------------------------------------------------------------------------
1012 /**
1013  * This function allows the user to register a le_atServer_GetTextCallback_t callback
1014  * to retrieve text and sends a prompt <CR><LF><greater_than><SPACE> on the current command's
1015  * device.
1016  *
1017  * @return
1018  * - LE_OK The function succeeded.
1019  * - LE_BAD_PARAMETER Invalid device or command reference.
1020  */
1021 //--------------------------------------------------------------------------------------------------
1023 (
1024  le_atServer_CmdRef_t cmdRef,
1025  ///< [IN] AT command reference
1027  ///< [IN] Get text callback
1028  void* contextPtr
1029  ///< [IN]
1030 );
1031 
1032 #endif // LE_ATSERVER_INTERFACE_H_INCLUDE_GUARD
void le_atServer_SetServerDisconnectHandler(le_atServer_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_result_t le_atServer_AddDeviceToBridge(le_atServer_DeviceRef_t deviceRef, le_atServer_BridgeRef_t bridgeRef)
AT command successfully treated.
Definition: le_atServer_interface.h:457
le_atServer_ErrorCodeRef_t le_atServer_CreateErrorCode(uint32_t errorCode, const char *LE_NONNULL pattern)
void le_atServer_DisableExtendedErrorCodes(void)
le_result_t
Definition: le_basics.h:35
le_atServer_CmdRef_t le_atServer_Create(const char *LE_NONNULL name)
action will be done on all bound devices
Definition: le_atServer_interface.h:478
Action AT command (e.g. &#39;AT+CMD&#39;)
Definition: le_atServer_interface.h:438
le_atServer_BridgeRef_t le_atServer_OpenBridge(int fd)
le_result_t le_atServer_SendUnsolicitedResponse(const char *LE_NONNULL unsolRsp, le_atServer_AvailableDevice_t availableDevice, le_atServer_DeviceRef_t device)
Connection terminated.
Definition: le_atServer_interface.h:459
void(* le_atServer_GetTextCallbackFunc_t)(le_atServer_CmdRef_t cmdRef, le_result_t result, const char *LE_NONNULL text, uint32_t len, void *contextPtr)
Definition: le_atServer_interface.h:526
le_result_t le_atServer_CloseBridge(le_atServer_BridgeRef_t bridgeRef)
void le_atServer_EnableVerboseErrorCodes(void)
struct le_atServer_Device * le_atServer_DeviceRef_t
Definition: le_atServer_interface.h:411
action will be done on a specified device
Definition: le_atServer_interface.h:480
le_atServer_DeviceRef_t le_atServer_Open(int fd)
le_result_t le_atServer_GetCommandName(le_atServer_CmdRef_t commandRef, char *name, size_t nameSize)
void(* le_atServer_DisconnectHandler_t)(void *)
Definition: le_atServer_interface.h:300
void le_atServer_EnableExtendedErrorCodes(void)
le_result_t le_atServer_Close(le_atServer_DeviceRef_t device)
le_result_t le_atServer_Delete(le_atServer_CmdRef_t commandRef)
le_atServer_FinalRsp_t
Definition: le_atServer_interface.h:455
Busy signal detected.
Definition: le_atServer_interface.h:465
void(* le_atServer_CommandHandlerFunc_t)(le_atServer_CmdRef_t commandRef, le_atServer_Type_t type, uint32_t parametersNumber, void *contextPtr)
Definition: le_atServer_interface.h:503
le_atServer_Type_t
Definition: le_atServer_interface.h:436
le_result_t le_atServer_SendFinalResultCode(le_atServer_CmdRef_t commandRef, le_atServer_FinalRsp_t finalResult, const char *LE_NONNULL pattern, uint32_t errorCode)
le_result_t le_atServer_GetTextAsync(le_atServer_CmdRef_t cmdRef, le_atServer_GetTextCallbackFunc_t callbackPtr, void *contextPtr)
le_atServer_CommandHandlerRef_t le_atServer_AddCommandHandler(le_atServer_CmdRef_t commandRef, le_atServer_CommandHandlerFunc_t handlerPtr, void *contextPtr)
void le_atServer_DisconnectService(void)
le_result_t le_atServer_RemoveDeviceFromBridge(le_atServer_DeviceRef_t deviceRef, le_atServer_BridgeRef_t bridgeRef)
le_result_t le_atServer_DisableEcho(le_atServer_DeviceRef_t device)
AT command received with parameters (e.g. &#39;AT+CMD=x,y&#39;)
Definition: le_atServer_interface.h:440
le_result_t le_atServer_EnableEcho(le_atServer_DeviceRef_t device)
No dialtone detected.
Definition: le_atServer_interface.h:463
void le_atServer_ConnectService(void)
Test AT command (e.g. &#39;AT+CMD=?&#39;)
Definition: le_atServer_interface.h:442
le_atServer_AvailableDevice_t
Definition: le_atServer_interface.h:476
le_result_t le_atServer_SendIntermediateResponse(le_atServer_CmdRef_t commandRef, const char *LE_NONNULL intermediateRsp)
le_result_t le_atServer_SendFinalResponse(le_atServer_CmdRef_t commandRef, le_atServer_FinalRsp_t finalResponse, bool customStringAvailable, const char *LE_NONNULL finalRsp)
le_result_t le_atServer_GetParameter(le_atServer_CmdRef_t commandRef, uint32_t index, char *parameter, size_t parameterSize)
struct le_atServer_CommandHandler * le_atServer_CommandHandlerRef_t
Definition: le_atServer_interface.h:491
Error in AT command treatement.
Definition: le_atServer_interface.h:461
le_result_t le_atServer_TryConnectService(void)
void le_atServer_RemoveCommandHandler(le_atServer_CommandHandlerRef_t handlerRef)
le_result_t le_atServer_GetDevice(le_atServer_CmdRef_t commandRef, le_atServer_DeviceRef_t *deviceRefPtr)
le_result_t le_atServer_Suspend(le_atServer_DeviceRef_t device)
struct le_atServer_Cmd * le_atServer_CmdRef_t
Definition: le_atServer_interface.h:403
le_result_t le_atServer_SetVerboseErrorCode(le_atServer_ErrorCodeRef_t errorCodeRef, const char *LE_NONNULL verboseCode)
le_result_t le_atServer_DeleteErrorCode(le_atServer_ErrorCodeRef_t errorCodeRef)
le_result_t le_atServer_Resume(le_atServer_DeviceRef_t device)
struct le_atServer_Bridge * le_atServer_BridgeRef_t
Definition: le_atServer_interface.h:419
Read AT command (e.g. &#39;AT+CMD?&#39;)
Definition: le_atServer_interface.h:444
struct le_atServer_ErrorCode * le_atServer_ErrorCodeRef_t
Definition: le_atServer_interface.h:427