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