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