le_atClient_interface.h File Reference

#include "legato.h"

Go to the source code of this file.

Macros

#define LE_ATCLIENT_CMD_MAX_LEN   31
 
#define LE_ATCLIENT_CMD_MAX_BYTES   32
 
#define LE_ATCLIENT_CMD_RSP_MAX_LEN   352
 
#define LE_ATCLIENT_CMD_RSP_MAX_BYTES   353
 
#define LE_ATCLIENT_UNSOLICITED_MAX_LEN   256
 
#define LE_ATCLIENT_UNSOLICITED_MAX_BYTES   257
 
#define LE_ATCLIENT_TEXT_MAX_LEN   256
 
#define LE_ATCLIENT_TEXT_MAX_BYTES   257
 
#define LE_ATCLIENT_PATH_MAX_LEN   30
 
#define LE_ATCLIENT_PATH_MAX_BYTES   31
 
#define LE_ATCLIENT_CMD_DEFAULT_TIMEOUT   30000
 

Typedefs

typedef struct le_atClient_Cmd * le_atClient_CmdRef_t
 
typedef struct le_atClient_Device * le_atClient_DeviceRef_t
 
typedef struct le_atClient_UnsolicitedResponseHandler * le_atClient_UnsolicitedResponseHandlerRef_t
 
typedef void(* le_atClient_UnsolicitedResponseHandlerFunc_t) (const char *unsolicitedRsp, void *contextPtr)
 

Functions

void le_atClient_ConnectService (void)
 
le_result_t le_atClient_TryConnectService (void)
 
void le_atClient_DisconnectService (void)
 
le_atClient_DeviceRef_t le_atClient_Start (const char *devicePath)
 
le_result_t le_atClient_Stop (le_atClient_DeviceRef_t device)
 
le_atClient_CmdRef_t le_atClient_Create (void)
 
le_result_t le_atClient_Delete (le_atClient_CmdRef_t cmdRef)
 
le_result_t le_atClient_SetCommand (le_atClient_CmdRef_t cmdRef, const char *command)
 
le_result_t le_atClient_SetIntermediateResponse (le_atClient_CmdRef_t cmdRef, const char *intermediate)
 
le_result_t le_atClient_SetFinalResponse (le_atClient_CmdRef_t cmdRef, const char *response)
 
le_result_t le_atClient_SetText (le_atClient_CmdRef_t cmdRef, const char *text)
 
le_result_t le_atClient_SetTimeout (le_atClient_CmdRef_t cmdRef, uint32_t timer)
 
le_result_t le_atClient_SetDevice (le_atClient_CmdRef_t cmdRef, le_atClient_DeviceRef_t devRef)
 
le_result_t le_atClient_Send (le_atClient_CmdRef_t cmdRef)
 
le_result_t le_atClient_GetFirstIntermediateResponse (le_atClient_CmdRef_t cmdRef, char *intermediateRsp, size_t intermediateRspNumElements)
 
le_result_t le_atClient_GetNextIntermediateResponse (le_atClient_CmdRef_t cmdRef, char *intermediateRsp, size_t intermediateRspNumElements)
 
le_result_t le_atClient_GetFinalResponse (le_atClient_CmdRef_t cmdRef, char *finalRsp, size_t finalRspNumElements)
 
le_result_t le_atClient_SetCommandAndSend (le_atClient_CmdRef_t *cmdRefPtr, le_atClient_DeviceRef_t devRef, const char *command, const char *interResp, const char *finalResp, uint32_t timeout)
 
le_atClient_UnsolicitedResponseHandlerRef_t le_atClient_AddUnsolicitedResponseHandler (const char *unsolRsp, le_atClient_DeviceRef_t devRef, le_atClient_UnsolicitedResponseHandlerFunc_t handlerPtr, void *contextPtr, uint32_t lineCount)
 
void le_atClient_RemoveUnsolicitedResponseHandler (le_atClient_UnsolicitedResponseHandlerRef_t addHandlerRef)
 

Detailed Description

Legato AT Commands Client include file.

Macro Definition Documentation

#define LE_ATCLIENT_CMD_DEFAULT_TIMEOUT   30000

Command default timeout (in ms)

#define LE_ATCLIENT_CMD_MAX_BYTES   32

Maximum number of bytes in an AT command (including the null-terminator).

#define LE_ATCLIENT_CMD_MAX_LEN   31

Maximum number of bytes in an AT command (not including the null-terminator).

#define LE_ATCLIENT_CMD_RSP_MAX_BYTES   353

Maximum number of bytes in an AT Command response (including the null-terminator).

#define LE_ATCLIENT_CMD_RSP_MAX_LEN   352

Maximum number of bytes in an AT Command response (not including the null-terminator).

#define LE_ATCLIENT_PATH_MAX_BYTES   31

Maximum number of characters permitted for a path (including the null-terminator).

#define LE_ATCLIENT_PATH_MAX_LEN   30

Maximum number of characters permitted for a path.

#define LE_ATCLIENT_TEXT_MAX_BYTES   257

Maximum number of bytes in an text message (including the null-terminator).

#define LE_ATCLIENT_TEXT_MAX_LEN   256

Maximum number of bytes in an text message (not including the null-terminator).

#define LE_ATCLIENT_UNSOLICITED_MAX_BYTES   257

Maximum number of bytes in an unsolicited response (including the null-terminator).

#define LE_ATCLIENT_UNSOLICITED_MAX_LEN   256

Maximum number of bytes in an unsolicited response (not including the null-terminator).

Typedef Documentation

typedef void(* le_atClient_UnsolicitedResponseHandlerFunc_t) (const char *unsolicitedRsp, void *contextPtr)

Handler for unsolicited response reception.

Parameters
unsolicitedRspThe call reference.
contextPtr
typedef struct le_atClient_UnsolicitedResponseHandler* le_atClient_UnsolicitedResponseHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'le_atClient_UnsolicitedResponse'

Function Documentation

le_atClient_UnsolicitedResponseHandlerRef_t le_atClient_AddUnsolicitedResponseHandler ( const char *  unsolRsp,
le_atClient_DeviceRef_t  devRef,
le_atClient_UnsolicitedResponseHandlerFunc_t  handlerPtr,
void *  contextPtr,
uint32_t  lineCount 
)

Add handler function for EVENT 'le_atClient_UnsolicitedResponse'

This event provides information on a subscribed unsolicited response when this unsolicited response is received.

Parameters
[in]unsolRspPattern to match
[in]devRefDevice to listen
[in]handlerPtr
[in]contextPtr
[in]lineCountIndicate the number of line of the unsolicited
void le_atClient_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

le_atClient_CmdRef_t le_atClient_Create ( void  )

This function must be called to create a new AT command.

Returns
pointer to the new AT Command reference
le_result_t le_atClient_Delete ( le_atClient_CmdRef_t  cmdRef)

This function must be called to delete an AT command reference.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
void le_atClient_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

le_result_t le_atClient_GetFinalResponse ( le_atClient_CmdRef_t  cmdRef,
char *  finalRsp,
size_t  finalRspNumElements 
)

This function is used to get the final response

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[out]finalRspGet Final Line
[in]finalRspNumElements
le_result_t le_atClient_GetFirstIntermediateResponse ( le_atClient_CmdRef_t  cmdRef,
char *  intermediateRsp,
size_t  intermediateRspNumElements 
)

This function is used to get the first intermediate result code.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[out]intermediateRspFirst intermediate result code.
[in]intermediateRspNumElements
le_result_t le_atClient_GetNextIntermediateResponse ( le_atClient_CmdRef_t  cmdRef,
char *  intermediateRsp,
size_t  intermediateRspNumElements 
)

This function is used to get the next intermediate result codes.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[out]intermediateRspGet Next intermediate result code.
[in]intermediateRspNumElements
void le_atClient_RemoveUnsolicitedResponseHandler ( le_atClient_UnsolicitedResponseHandlerRef_t  addHandlerRef)

Remove handler function for EVENT 'le_atClient_UnsolicitedResponse'

Parameters
[in]addHandlerRef
le_result_t le_atClient_Send ( le_atClient_CmdRef_t  cmdRef)

This function must be called to send an AT Command and wait for response.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_TIMEOUT when a timeout occur
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
le_result_t le_atClient_SetCommand ( le_atClient_CmdRef_t  cmdRef,
const char *  command 
)

This function must be called to set the AT command string to be sent.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]commandSet Command
le_result_t le_atClient_SetCommandAndSend ( le_atClient_CmdRef_t *  cmdRefPtr,
le_atClient_DeviceRef_t  devRef,
const char *  command,
const char *  interResp,
const char *  finalResp,
uint32_t  timeout 
)

This function must be called to automatically set and send an AT Command.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_TIMEOUT when a timeout occur
  • LE_OK when function succeed
Parameters
[out]cmdRefPtrCommand reference
[in]devRefDevice reference
[in]commandAT Command
[in]interRespExpected intermediate response
[in]finalRespExpected final response
[in]timeoutTimeout
le_result_t le_atClient_SetDevice ( le_atClient_CmdRef_t  cmdRef,
le_atClient_DeviceRef_t  devRef 
)

This function must be called to set the device where the AT command will be sent.

Returns
  • LE_FAULT when function failed
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]devRefDevice where the AT command has to be sent
le_result_t le_atClient_SetFinalResponse ( le_atClient_CmdRef_t  cmdRef,
const char *  response 
)

This function must be called to set the final response(s) of the AT command execution. Several final responses can be specified separated by a '|' character into the string given in parameter.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]responseSet Response
le_result_t le_atClient_SetIntermediateResponse ( le_atClient_CmdRef_t  cmdRef,
const char *  intermediate 
)

This function must be called to set the waiting intermediate responses. Several intermediate responses can be specified separated by a '|' character into the string given in parameter.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]intermediateSet Intermediate
le_result_t le_atClient_SetText ( le_atClient_CmdRef_t  cmdRef,
const char *  text 
)

This function must be called to set the text when the prompt is expected.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]textThe AT Data to send
le_result_t le_atClient_SetTimeout ( le_atClient_CmdRef_t  cmdRef,
uint32_t  timer 
)

This function must be called to set the timeout of the AT command execution.

Returns
  • LE_FAULT when function failed
  • LE_NOT_FOUND when the reference is invalid
  • LE_OK when function succeed
Parameters
[in]cmdRefAT Command
[in]timerSet Timer
le_atClient_DeviceRef_t le_atClient_Start ( const char *  devicePath)

This function must be called to start a ATClient session on a specified device.

Returns
reference on a device context
Parameters
[in]devicePathDevice path
le_result_t le_atClient_Stop ( le_atClient_DeviceRef_t  device)

This function must be called to stop the ATClient session on the specified device.

Parameters
[in]deviceDevice reference
le_result_t le_atClient_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.