FreeRTOS: FreeRTOS Cellular Library v1.2.0
FreeRTOS Cellular Library
cellular_api.h File Reference

Go to the source code of this file.

Functions

CellularError_t Cellular_Init (CellularHandle_t *pCellularHandle, const CellularCommInterface_t *pCommInterface)
 One time initialization function. More...
 
CellularError_t Cellular_Cleanup (CellularHandle_t cellularHandle)
 One time deinitialization function. More...
 
CellularError_t Cellular_SetRatPriority (CellularHandle_t cellularHandle, const CellularRat_t *pRatPriorities, uint8_t ratPrioritiesLength)
 Configure the priority order in which the networks are searched. More...
 
CellularError_t Cellular_GetRatPriority (CellularHandle_t cellularHandle, CellularRat_t *pRatPriorities, uint8_t ratPrioritiesLength, uint8_t *pOutputRatPrioritiesLength)
 Get the priority order in which the networks are searched. More...
 
CellularError_t Cellular_RfOn (CellularHandle_t cellularHandle)
 Turn on RF i.e. turn-off airplane mode. More...
 
CellularError_t Cellular_RfOff (CellularHandle_t cellularHandle)
 Turn off RF i.e. turn-on airplane mode. More...
 
CellularError_t Cellular_GetSimCardStatus (CellularHandle_t cellularHandle, CellularSimCardStatus_t *pSimCardStatus)
 Get SIM card status (activated/Pin set etc.). More...
 
CellularError_t Cellular_GetSimCardInfo (CellularHandle_t cellularHandle, CellularSimCardInfo_t *pSimCardInfo)
 Get SIM card information (IMSI, SIM Card number etc.). More...
 
CellularError_t Cellular_GetModemInfo (CellularHandle_t cellularHandle, CellularModemInfo_t *pModemInfo)
 Get the information about the modem (HW version, FW version etc.). More...
 
CellularError_t Cellular_GetRegisteredNetwork (CellularHandle_t cellularHandle, CellularPlmnInfo_t *pNetworkInfo)
 Get the network on which SIM is currently registered/camped. More...
 
CellularError_t Cellular_GetNetworkTime (CellularHandle_t cellularHandle, CellularTime_t *pNetworkTime)
 Get the network time. More...
 
CellularError_t Cellular_GetSignalInfo (CellularHandle_t cellularHandle, CellularSignalInfo_t *pSignalInfo)
 Get signal information. More...
 
CellularError_t Cellular_GetServiceStatus (CellularHandle_t cellularHandle, CellularServiceStatus_t *pServiceStatus)
 Get network service status. More...
 
CellularError_t Cellular_SetPdnConfig (CellularHandle_t cellularHandle, uint8_t contextId, const CellularPdnConfig_t *pPdnConfig)
 Set PDN config for a PDN context. More...
 
CellularError_t Cellular_GetPdnStatus (CellularHandle_t cellularHandle, CellularPdnStatus_t *pPdnStatusBuffers, uint8_t numStatusBuffers, uint8_t *pNumStatus)
 Get status reports for all PDN contexts. More...
 
CellularError_t Cellular_ActivatePdn (CellularHandle_t cellularHandle, uint8_t contextId)
 Activate a PDN context. More...
 
CellularError_t Cellular_DeactivatePdn (CellularHandle_t cellularHandle, uint8_t contextId)
 Deactivate a PDN context. More...
 
CellularError_t Cellular_GetIPAddress (CellularHandle_t cellularHandle, uint8_t contextId, char *pBuffer, uint32_t bufferLength)
 Get the IP Address assigned to the module. More...
 
CellularError_t Cellular_SetDns (CellularHandle_t cellularHandle, uint8_t contextId, const char *pDnsServerAddress)
 Set the DNS server to use. More...
 
CellularError_t Cellular_RegisterUrcNetworkRegistrationEventCallback (CellularHandle_t cellularHandle, CellularUrcNetworkRegistrationCallback_t networkRegistrationCallback, void *pCallbackContext)
 Register/Remove callback for Network Registration URC events. More...
 
CellularError_t Cellular_RegisterUrcPdnEventCallback (CellularHandle_t cellularHandle, CellularUrcPdnEventCallback_t pdnEventCallback, void *pCallbackContext)
 Register/Remove callback for PDN related URC events. More...
 
CellularError_t Cellular_RegisterUrcSignalStrengthChangedCallback (CellularHandle_t cellularHandle, CellularUrcSignalStrengthChangedCallback_t signalStrengthChangedCallback, void *pCallbackContext)
 Register callback for Signal Strength changed URC events. More...
 
CellularError_t Cellular_RegisterModemEventCallback (CellularHandle_t cellularHandle, CellularModemEventCallback_t modemEventCallback, void *pCallbackContext)
 Register callback for all modem related events. More...
 
CellularError_t Cellular_RegisterUrcGenericCallback (CellularHandle_t cellularHandle, CellularUrcGenericCallback_t genericCallback, void *pCallbackContext)
 Register generic callback for all other URC events than covered in above callbacks. More...
 
CellularError_t Cellular_GetPsmSettings (CellularHandle_t cellularHandle, CellularPsmSettings_t *pPsmSettings)
 Get current PSM settings. More...
 
CellularError_t Cellular_SetPsmSettings (CellularHandle_t cellularHandle, const CellularPsmSettings_t *pPsmSettings)
 Set PSM settings. More...
 
CellularError_t Cellular_GetEidrxSettings (CellularHandle_t cellularHandle, CellularEidrxSettingsList_t *pEidrxSettingsList)
 Get current e-I-DRX settings. More...
 
CellularError_t Cellular_SetEidrxSettings (CellularHandle_t cellularHandle, const CellularEidrxSettings_t *pEidrxSettings)
 Set e-I-DRX settings. More...
 
CellularError_t Cellular_ATCommandRaw (CellularHandle_t cellularHandle, const char *pATCommandPrefix, const char *pATCommandPayload, CellularATCommandType_t atCommandType, CellularATCommandResponseReceivedCallback_t responseReceivedCallback, void *pData, uint16_t dataLen)
 Send the raw AT command to the module. More...
 
CellularError_t Cellular_CreateSocket (CellularHandle_t cellularHandle, uint8_t pdnContextId, CellularSocketDomain_t socketDomain, CellularSocketType_t socketType, CellularSocketProtocol_t socketProtocol, CellularSocketHandle_t *pSocketHandle)
 Create a socket. More...
 
CellularError_t Cellular_SocketConnect (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketAccessMode_t dataAccessMode, const CellularSocketAddress_t *pRemoteSocketAddress)
 Connect to a remote socket. More...
 
CellularError_t Cellular_SocketSend (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, const uint8_t *pData, uint32_t dataLength, uint32_t *pSentDataLength)
 Send data to the connected remote socket. More...
 
CellularError_t Cellular_SocketRecv (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, uint8_t *pBuffer, uint32_t bufferLength, uint32_t *pReceivedDataLength)
 Receive data on a connected socket. More...
 
CellularError_t Cellular_SocketClose (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle)
 Close the socket. More...
 
CellularError_t Cellular_GetHostByName (CellularHandle_t cellularHandle, uint8_t contextId, const char *pcHostName, char *pResolvedAddress)
 Resolve a host name using Domain Name Service. More...
 
CellularError_t Cellular_SocketSetSockOpt (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketOptionLevel_t optionLevel, CellularSocketOption_t option, const uint8_t *pOptionValue, uint32_t optionValueLength)
 Set options for a socket. More...
 
CellularError_t Cellular_SocketRegisterSocketOpenCallback (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketOpenCallback_t socketOpenCallback, void *pCallbackContext)
 Register Socket open callback on the socket. More...
 
CellularError_t Cellular_SocketRegisterDataReadyCallback (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketDataReadyCallback_t dataReadyCallback, void *pCallbackContext)
 Register data ready callback on the socket. More...
 
CellularError_t Cellular_SocketRegisterClosedCallback (CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketClosedCallback_t closedCallback, void *pCallbackContext)
 Register closed callback on the socket. More...
 

Function Documentation

◆ Cellular_Init()

CellularError_t Cellular_Init ( CellularHandle_t pCellularHandle,
const CellularCommInterface_t pCommInterface 
)

One time initialization function.

This function initializes and returns the supplied context. It must be called once (and only once) before calling any other function of this library.

Parameters
[in,out]pCellularHandlethe handle pointer to store the cellular handle.
[in]pCommInterfaceComm interface for communicating with the module.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_Cleanup()

CellularError_t Cellular_Cleanup ( CellularHandle_t  cellularHandle)

One time deinitialization function.

This function frees resources taken in Cellular_Init. After this function returns, Cellular_Init must be called again before calling any other function of this library.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SetRatPriority()

CellularError_t Cellular_SetRatPriority ( CellularHandle_t  cellularHandle,
const CellularRat_t pRatPriorities,
uint8_t  ratPrioritiesLength 
)

Configure the priority order in which the networks are searched.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pRatPrioritiesAn array of RATs in priority order. For example, to search NB-IoT first, then Cat-M1 and then LTE, the array should contain: { CELLULAR_RAT_NBIOT, CELLULAR_RAT_CATM1, CELLULAR_RAT_LTE }.
[in]ratPrioritiesLengthLength of the pRatPriorities array.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetRatPriority()

CellularError_t Cellular_GetRatPriority ( CellularHandle_t  cellularHandle,
CellularRat_t pRatPriorities,
uint8_t  ratPrioritiesLength,
uint8_t *  pOutputRatPrioritiesLength 
)

Get the priority order in which the networks are searched.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pRatPrioritiesAn array of current RATs in priority order.
[in]ratPrioritiesLengthLength of the pRatPriorities array.
[out]pOutputRatPrioritiesLengthActual number of items filled into pRatPriorities by this function when it returns.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RfOn()

CellularError_t Cellular_RfOn ( CellularHandle_t  cellularHandle)

Turn on RF i.e. turn-off airplane mode.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RfOff()

CellularError_t Cellular_RfOff ( CellularHandle_t  cellularHandle)

Turn off RF i.e. turn-on airplane mode.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetSimCardStatus()

CellularError_t Cellular_GetSimCardStatus ( CellularHandle_t  cellularHandle,
CellularSimCardStatus_t pSimCardStatus 
)

Get SIM card status (activated/Pin set etc.).

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pSimCardStatusOut parameter to provide the SIM card status.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetSimCardInfo()

CellularError_t Cellular_GetSimCardInfo ( CellularHandle_t  cellularHandle,
CellularSimCardInfo_t pSimCardInfo 
)

Get SIM card information (IMSI, SIM Card number etc.).

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pSimCardInfoOut parameter to provide the SIM card information.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetModemInfo()

CellularError_t Cellular_GetModemInfo ( CellularHandle_t  cellularHandle,
CellularModemInfo_t pModemInfo 
)

Get the information about the modem (HW version, FW version etc.).

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pModemInfoOut parameter to provide the modem information.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetRegisteredNetwork()

CellularError_t Cellular_GetRegisteredNetwork ( CellularHandle_t  cellularHandle,
CellularPlmnInfo_t pNetworkInfo 
)

Get the network on which SIM is currently registered/camped.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pNetworkInfoOut parameter to provide the network information.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetNetworkTime()

CellularError_t Cellular_GetNetworkTime ( CellularHandle_t  cellularHandle,
CellularTime_t pNetworkTime 
)

Get the network time.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pNetworkTimeOut parameter to provide the network time.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetSignalInfo()

CellularError_t Cellular_GetSignalInfo ( CellularHandle_t  cellularHandle,
CellularSignalInfo_t pSignalInfo 
)

Get signal information.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pSignalInfoOut parameter to provide the signal information.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetServiceStatus()

CellularError_t Cellular_GetServiceStatus ( CellularHandle_t  cellularHandle,
CellularServiceStatus_t pServiceStatus 
)

Get network service status.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pServiceStatusOut parameter to provide the service status.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SetPdnConfig()

CellularError_t Cellular_SetPdnConfig ( CellularHandle_t  cellularHandle,
uint8_t  contextId,
const CellularPdnConfig_t pPdnConfig 
)

Set PDN config for a PDN context.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN to set the config for. Context ID value should be in range between CELLULAR_PDN_CONTEXT_ID_MIN and CELLULAR_PDN_CONTEXT_ID_MAX. The context ID with specified PDN config will be used with other CELLULAR APIs.
[in]pPdnConfigPDN config to set.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetPdnStatus()

CellularError_t Cellular_GetPdnStatus ( CellularHandle_t  cellularHandle,
CellularPdnStatus_t pPdnStatusBuffers,
uint8_t  numStatusBuffers,
uint8_t *  pNumStatus 
)

Get status reports for all PDN contexts.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pPdnStatusBuffersOut parameter to provide array of PDN contexts.
[in]numStatusBuffersNumber of CellularPdnStatus_t buffers in the provided array pPdnStatusBuffers.
[out]pNumStatusOut parameter to provide the number of PDN statuses returned.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_ActivatePdn()

CellularError_t Cellular_ActivatePdn ( CellularHandle_t  cellularHandle,
uint8_t  contextId 
)

Activate a PDN context.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN context to activate. The same context ID should be used with Cellular_SetPdnConfig before calling this API.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_DeactivatePdn()

CellularError_t Cellular_DeactivatePdn ( CellularHandle_t  cellularHandle,
uint8_t  contextId 
)

Deactivate a PDN context.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN context to deactivate.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetIPAddress()

CellularError_t Cellular_GetIPAddress ( CellularHandle_t  cellularHandle,
uint8_t  contextId,
char *  pBuffer,
uint32_t  bufferLength 
)

Get the IP Address assigned to the module.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN context for which IP address is requested.
[out]pBufferthe buffer to receive the IP address into. The returned pBuffer is a NULL terminated string.
[in]bufferLengthof the buffer pBuffer.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SetDns()

CellularError_t Cellular_SetDns ( CellularHandle_t  cellularHandle,
uint8_t  contextId,
const char *  pDnsServerAddress 
)

Set the DNS server to use.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN context for which DNS needs to be set.
[in]pDnsServerAddressThe address of the DNS server to set. It should be a NULL terminated string.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RegisterUrcNetworkRegistrationEventCallback()

CellularError_t Cellular_RegisterUrcNetworkRegistrationEventCallback ( CellularHandle_t  cellularHandle,
CellularUrcNetworkRegistrationCallback_t  networkRegistrationCallback,
void *  pCallbackContext 
)

Register/Remove callback for Network Registration URC events.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]networkRegistrationCallbackThe callback to register. Set to NULL to remove the existing callback.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RegisterUrcPdnEventCallback()

CellularError_t Cellular_RegisterUrcPdnEventCallback ( CellularHandle_t  cellularHandle,
CellularUrcPdnEventCallback_t  pdnEventCallback,
void *  pCallbackContext 
)

Register/Remove callback for PDN related URC events.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pdnEventCallbackThe callback to register. Set to NULL remove the existing callback.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RegisterUrcSignalStrengthChangedCallback()

CellularError_t Cellular_RegisterUrcSignalStrengthChangedCallback ( CellularHandle_t  cellularHandle,
CellularUrcSignalStrengthChangedCallback_t  signalStrengthChangedCallback,
void *  pCallbackContext 
)

Register callback for Signal Strength changed URC events.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]signalStrengthChangedCallbackThe callback to register. Set to NULL to remove the existing callback.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RegisterModemEventCallback()

CellularError_t Cellular_RegisterModemEventCallback ( CellularHandle_t  cellularHandle,
CellularModemEventCallback_t  modemEventCallback,
void *  pCallbackContext 
)

Register callback for all modem related events.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]modemEventCallbackThe callback to register. Set to NULL to remove the existing callback.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_RegisterUrcGenericCallback()

CellularError_t Cellular_RegisterUrcGenericCallback ( CellularHandle_t  cellularHandle,
CellularUrcGenericCallback_t  genericCallback,
void *  pCallbackContext 
)

Register generic callback for all other URC events than covered in above callbacks.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]genericCallbackThe callback to register. Set to NULL to remove the existing callback.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetPsmSettings()

CellularError_t Cellular_GetPsmSettings ( CellularHandle_t  cellularHandle,
CellularPsmSettings_t pPsmSettings 
)

Get current PSM settings.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pPsmSettingsOut parameter to provide the PSM settings.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SetPsmSettings()

CellularError_t Cellular_SetPsmSettings ( CellularHandle_t  cellularHandle,
const CellularPsmSettings_t pPsmSettings 
)

Set PSM settings.

Enable/disable PSM by using CellularPsmSettings_t structure.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pPsmSettingsPSM settings to set.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetEidrxSettings()

CellularError_t Cellular_GetEidrxSettings ( CellularHandle_t  cellularHandle,
CellularEidrxSettingsList_t pEidrxSettingsList 
)

Get current e-I-DRX settings.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[out]pEidrxSettingsListOut parameter to provide the e-I-DRX settings.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SetEidrxSettings()

CellularError_t Cellular_SetEidrxSettings ( CellularHandle_t  cellularHandle,
const CellularEidrxSettings_t pEidrxSettings 
)

Set e-I-DRX settings.

This API can be used to enable/disable e-I-DRX by using the mode member of CellularEidrxSettings_t.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pEidrxSettingse-I-DRX settings to set.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_ATCommandRaw()

CellularError_t Cellular_ATCommandRaw ( CellularHandle_t  cellularHandle,
const char *  pATCommandPrefix,
const char *  pATCommandPayload,
CellularATCommandType_t  atCommandType,
CellularATCommandResponseReceivedCallback_t  responseReceivedCallback,
void *  pData,
uint16_t  dataLen 
)

Send the raw AT command to the module.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pATCommandPrefixThe AT command response prefix. NULL if the response has no prefix.
[in]pATCommandPayloadThe AT command to send. It should be a NULL terminated string.
[in]atCommandTypeType of AT command.
[in]responseReceivedCallbackCallback to be invoked when a response for the command is received.
[in]pDataThe pData pointer will be passed in responseReceivedCallback.
[in]dataLenThe dataLen value will be passed in responseReceivedCallback.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_CreateSocket()

CellularError_t Cellular_CreateSocket ( CellularHandle_t  cellularHandle,
uint8_t  pdnContextId,
CellularSocketDomain_t  socketDomain,
CellularSocketType_t  socketType,
CellularSocketProtocol_t  socketProtocol,
CellularSocketHandle_t pSocketHandle 
)

Create a socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]pdnContextIdpdn context id on which this socket needs to be created. The pdn context must be previously activated by Cellular_ActivatePdn function.
[in]socketDomainSocket domain.
[in]socketTypeSocket Type.
[in]socketProtocolSocket Protocol.
[out]pSocketHandleOut parameter to provide the created handle.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketConnect()

CellularError_t Cellular_SocketConnect ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
CellularSocketAccessMode_t  dataAccessMode,
const CellularSocketAddress_t pRemoteSocketAddress 
)

Connect to a remote socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]dataAccessModeData access mode of the socket. Buffer, Direct Push or Transparent.
[in]pRemoteSocketAddressAddress (IP and Port) of the remote socket to connect to.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketSend()

CellularError_t Cellular_SocketSend ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
const uint8_t *  pData,
uint32_t  dataLength,
uint32_t *  pSentDataLength 
)

Send data to the connected remote socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]pDataThe buffer containing that data to be sent.
[in]dataLengthLength of the data in the pData buffer.
[out]pSentDataLengthOut parameter to provide the length of the actual data sent. Note that it may be less than the dataLength in case complete data could not be sent.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketRecv()

CellularError_t Cellular_SocketRecv ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
uint8_t *  pBuffer,
uint32_t  bufferLength,
uint32_t *  pReceivedDataLength 
)

Receive data on a connected socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[out]pBufferThe buffer to receive the data into.
[in]bufferLengthLength of the buffer pBuffer.
[out]pReceivedDataLengthOut parameter to provide the of the actual data received in the buffer pBuffer. Note that it may be less than bufferLength.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketClose()

CellularError_t Cellular_SocketClose ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle 
)

Close the socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_GetHostByName()

CellularError_t Cellular_GetHostByName ( CellularHandle_t  cellularHandle,
uint8_t  contextId,
const char *  pcHostName,
char *  pResolvedAddress 
)

Resolve a host name using Domain Name Service.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]contextIdContext ID of the PDN context for which DNS is set.
[in]pcHostNameThe host name to resolve. It should be a NULL terminated string. The length of the string should not exceed RFC1035 defined.
[out]pResolvedAddressThe output parameter to return the resolved address. The length of this buffer should be at least CELLULAR_IP_ADDRESS_MAX_SIZE. The returned buffer is a NULL terminated string.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketSetSockOpt()

CellularError_t Cellular_SocketSetSockOpt ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
CellularSocketOptionLevel_t  optionLevel,
CellularSocketOption_t  option,
const uint8_t *  pOptionValue,
uint32_t  optionValueLength 
)

Set options for a socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]optionLevelSocket option level (IP or TCP/UDP).
[in]optionSocket option to set.
[in]pOptionValueBuffer containing the socket option value.
[in]optionValueLengthLength of the value pointed to by pOptionValue.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketRegisterSocketOpenCallback()

CellularError_t Cellular_SocketRegisterSocketOpenCallback ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
CellularSocketOpenCallback_t  socketOpenCallback,
void *  pCallbackContext 
)

Register Socket open callback on the socket.

This callback is invoked when modem confirms that a socket is opened.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]socketOpenCallbackThe callback to register.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketRegisterDataReadyCallback()

CellularError_t Cellular_SocketRegisterDataReadyCallback ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
CellularSocketDataReadyCallback_t  dataReadyCallback,
void *  pCallbackContext 
)

Register data ready callback on the socket.

This callback is invoked whenever data is ready to be read from the socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]dataReadyCallbackThe callback to register.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ Cellular_SocketRegisterClosedCallback()

CellularError_t Cellular_SocketRegisterClosedCallback ( CellularHandle_t  cellularHandle,
CellularSocketHandle_t  socketHandle,
CellularSocketClosedCallback_t  closedCallback,
void *  pCallbackContext 
)

Register closed callback on the socket.

This callback is invoked whenever remote end closes the connection on a connected socket.

Parameters
[in]cellularHandleThe opaque cellular context pointer created by Cellular_Init.
[in]socketHandleSocket handle returned from the Cellular_CreateSocket call.
[in]closedCallbackThe callback to register.
[in]pCallbackContextThe context to be passed to callback function.
Returns
CELLULAR_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.