32#ifndef __CELLULAR_COMMON_H__
33#define __CELLULAR_COMMON_H__
45#ifndef CELLULAR_DO_NOT_USE_CUSTOM_CONFIG
47 #include "cellular_config.h"
50#include "cellular_platform.h"
61typedef struct CellularAtReq
75typedef struct CellularAtDataReq
100typedef struct CellularAtParseTokenMap
110typedef enum CellularSocketState
122typedef struct CellularSocketContext
157typedef struct CellularTokenTable
196 uint32_t * pDataLength );
211 uint32_t * pBytesRead );
224 const char * pLine );
242 uint32_t bufferLength,
243 uint32_t * pBufferLengthHandled );
322 const char * pRawData );
410 uint32_t sockIndex );
421 uint32_t sockIndex );
444 int16_t * pRssiValue );
457 int16_t * pBerValue );
469 void ** ppModuleContext );
520 uint32_t timeoutMS );
541 uint32_t atTimeoutMS,
542 const char ** pCellularSrcTokenSuccessTable,
543 uint32_t cellularSrcTokenSuccessTableSize );
561 void * pCallbackContext );
578 uint32_t atTimeoutMS,
579 uint32_t dataTimeoutMS );
600 void * pCallbackContext,
601 uint32_t atTimeoutMS,
602 uint32_t dataTimeoutMS,
603 uint32_t interDelayMS );
622 uint32_t atTimeoutMS,
623 uint32_t dataTimeoutMS,
624 const char ** pCellularSrcTokenSuccessTable,
625 uint32_t cellularSrcTokenSuccessTableSize );
643 void * pCallbackContext );
661 void * pInputBufferCallbackContext );
CellularATError_t
Represents error codes returned from AT Core APIs.
Definition: cellular_at_core.h:68
void _Cellular_NetworkRegistrationCallback(const CellularContext_t *pContext, CellularUrcEvent_t urcEvent, const CellularServiceStatus_t *pServiceStatus)
Call the network registration callback if the callback is previously set by Cellular_CommonRegisterUr...
Definition: cellular_common.c:834
CellularPktStatus_t(* CellularUndefinedRespCallback_t)(void *pCallbackContext, const char *pLine)
Undefined response callback function.
Definition: cellular_common.h:223
void _Cellular_SignalStrengthChangedCallback(const CellularContext_t *pContext, CellularUrcEvent_t urcEvent, const CellularSignalInfo_t *pSignalInfo)
Call the network registration callback if the callback is previously set by Cellular_RegisterUrcSigna...
Definition: cellular_common.c:859
CellularError_t _Cellular_RegisterUndefinedRespCallback(CellularContext_t *pContext, CellularUndefinedRespCallback_t undefinedRespCallback, void *pCallbackContext)
Register undefined response callback.
Definition: cellular_common.c:1095
CellularError_t _Cellular_TranslatePktStatus(CellularPktStatus_t status)
Translate error code packet status to cellular Status.
Definition: cellular_common.c:463
CellularPktStatus_t _Cellular_TimeoutAtcmdDataSendRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq, CellularAtDataReq_t dataReq, uint32_t atTimeoutMS, uint32_t dataTimeoutMS)
Send the AT command to cellular modem with send data.
Definition: cellular_pkthandler.c:721
void(* CellularAtParseTokenHandler_t)(CellularContext_t *pContext, char *pInputStr)
URC handler function.
Definition: cellular_common.h:93
CellularError_t _Cellular_IsValidPdn(uint8_t contextId)
Check PDN context index validity.
Definition: cellular_common.c:653
void _Cellular_GenericCallback(const CellularContext_t *pContext, const char *pRawData)
Call the network registration callback if the callback is previously set by Cellular_RegisterUrcGener...
Definition: cellular_common.c:872
CellularSocketContext_t * _Cellular_GetSocketData(const CellularContext_t *pContext, uint32_t sockIndex)
Get the socket data structure with socket index.
Definition: cellular_common.c:894
CellularError_t _Cellular_ConvertCsqSignalRssi(int16_t csqRssi, int16_t *pRssiValue)
Convert CSQ command returned RSSI value.
Definition: cellular_common.c:669
CellularError_t _Cellular_GetCurrentRat(CellularContext_t *pContext, CellularRat_t *pRat)
Return the current RAT if previously received with 3GPP AT command.
Definition: cellular_common.c:807
CellularError_t _Cellular_LibCleanup(CellularHandle_t cellularHandle)
One time deinitialization function.
Definition: cellular_common.c:1052
CellularPktStatus_t _Cellular_AtcmdRequestSuccessToken(CellularContext_t *pContext, CellularAtReq_t atReq, uint32_t atTimeoutMS, const char **pCellularSrcTokenSuccessTable, uint32_t cellularSrcTokenSuccessTableSize)
Send the AT command to cellular modem with extra success token table.
Definition: cellular_pkthandler.c:585
CellularError_t _Cellular_CheckLibraryStatus(CellularContext_t *pContext)
Check Library Status.
Definition: cellular_common.c:425
CellularSocketState_t
enum representing different Socket State.
Definition: cellular_common.h:111
@ SOCKETSTATE_CONNECTING
Definition: cellular_common.h:113
@ SOCKETSTATE_DISCONNECTED
Definition: cellular_common.h:115
@ SOCKETSTATE_CONNECTED
Definition: cellular_common.h:114
@ SOCKETSTATE_ALLOCATED
Definition: cellular_common.h:112
CellularPktStatus_t _Cellular_TimeoutAtcmdDataRecvRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq, uint32_t timeoutMS, CellularATCommandDataPrefixCallback_t pktDataPrefixCallback, void *pCallbackContext)
Send the AT command to cellular modem with data buffer response.
Definition: cellular_pkthandler.c:629
CellularPktStatus_t _Cellular_TimeoutAtcmdRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq, uint32_t timeoutMS)
Send the AT command to cellular modem.
Definition: cellular_common.c:1086
CellularPktStatus_t _Cellular_AtcmdRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq)
Send the AT command to cellular modem with default timeout.
Definition: cellular_common.c:1077
CellularPktStatus_t _Cellular_TranslateAtCoreStatus(CellularATError_t status)
Translate Error Code AT Core status to Packet Status.
Definition: cellular_common.c:492
CellularError_t _Cellular_GetModuleContext(const CellularContext_t *pContext, void **ppModuleContext)
Get the socket data structure with socket index.
Definition: cellular_common.c:755
CellularPktStatus_t _Cellular_AtcmdDataSend(CellularContext_t *pContext, CellularAtReq_t atReq, CellularAtDataReq_t dataReq, CellularATCommandDataSendPrefixCallback_t pktDataSendPrefixCallback, void *pCallbackContext, uint32_t atTimeoutMS, uint32_t dataTimeoutMS, uint32_t interDelayMS)
Send the AT command to cellular modem with send data.
Definition: cellular_pkthandler.c:668
CellularError_t _Cellular_CreateSocketData(CellularContext_t *pContext, uint8_t contextId, CellularSocketDomain_t socketDomain, CellularSocketType_t socketType, CellularSocketProtocol_t socketProtocol, CellularSocketHandle_t *pSocketHandle)
Create a socket.
Definition: cellular_common.c:522
void _Cellular_ModemEventCallback(const CellularContext_t *pContext, CellularModemEvent_t modemEvent)
Call the network registration callback if the callback is previously set by Cellular_RegisterModemEve...
Definition: cellular_common.c:883
CellularError_t _Cellular_RemoveSocketData(CellularContext_t *pContext, CellularSocketHandle_t socketHandle)
Remove the socket.
Definition: cellular_common.c:582
CellularError_t _Cellular_RegisterInputBufferCallback(CellularContext_t *pContext, CellularInputBufferCallback_t inputBufferCallback, void *pInputBufferCallbackContext)
Register input buffer callback.
Definition: cellular_common.c:1129
CellularPktStatus_t _Cellular_TimeoutAtcmdDataSendSuccessToken(CellularContext_t *pContext, CellularAtReq_t atReq, CellularAtDataReq_t dataReq, uint32_t atTimeoutMS, uint32_t dataTimeoutMS, const char **pCellularSrcTokenSuccessTable, uint32_t cellularSrcTokenSuccessTableSize)
Send the AT command to cellular modem with send data and extra success token table.
Definition: cellular_pkthandler.c:732
CellularPktStatus_t(* CellularInputBufferCallback_t)(void *pInputBufferCallbackContext, char *pBuffer, uint32_t bufferLength, uint32_t *pBufferLengthHandled)
Callback used to process input buffer.
Definition: cellular_common.h:240
CellularError_t _Cellular_IsValidSocket(const CellularContext_t *pContext, uint32_t sockIndex)
Check socket index validity.
Definition: cellular_common.c:630
CellularPktStatus_t(* CellularATCommandDataPrefixCallback_t)(void *pCallbackContext, char *pLine, uint32_t lineLength, char **pDataStart, uint32_t *pDataLength)
Callback used to inform pktio the data start and the length of the data.
Definition: cellular_common.h:192
CellularPktStatus_t(* CellularATCommandDataSendPrefixCallback_t)(void *pCallbackContext, char *pLine, uint32_t *pBytesRead)
Callback used to fix the stream before the send data.
Definition: cellular_common.h:209
void _Cellular_PdnEventCallback(const CellularContext_t *pContext, CellularUrcEvent_t urcEvent, uint8_t contextId)
Call the network registration callback if the callback is previously set by Cellular_RegisterUrcPdnEv...
Definition: cellular_common.c:847
CellularError_t _Cellular_LibInit(CellularHandle_t *pCellularHandle, const CellularCommInterface_t *pCommInterface, const CellularTokenTable_t *pTokenTable)
One time initialization function.
Definition: cellular_common.c:920
CellularError_t _Cellular_ConvertCsqSignalBer(int16_t csqBer, int16_t *pBerValue)
Convert CSQ command returned BER value.
Definition: cellular_common.c:706
CellularError_t _Cellular_ComputeSignalBars(CellularRat_t rat, CellularSignalInfo_t *pSignalInfo)
Convert the signal to bar.
Definition: cellular_common.c:774
This represents the default values for the configuration macros for the Cellular library.
CellularUrcEvent_t
Represents URC events.
Definition: cellular_types.h:212
CellularPktStatus_t
packet Status Names.
Definition: cellular_types.h:338
CellularATCommandType_t
Represents AT Command type.
Definition: cellular_types.h:360
CellularSocketType_t
Represents socket type.
Definition: cellular_types.h:273
CellularSocketAccessMode_t
Represents data access modes.
Definition: cellular_types.h:293
CellularRat_t
Enums representing Radio Access Technologies (RATs). Reference 3GPP TS 27.007 PLMN selection +COPS.
Definition: cellular_types.h:111
CellularError_t
Status code returns from APIs.
Definition: cellular_types.h:88
CellularSocketDomain_t
Represents socket domain.
Definition: cellular_types.h:263
CellularSocketProtocol_t
Represents socket protocol.
Definition: cellular_types.h:283
CellularModemEvent_t
Represents Modem events.
Definition: cellular_types.h:228
void(* CellularSocketClosedCallback_t)(CellularSocketHandle_t socketHandle, void *pCallbackContext)
Callback used to inform that remote end closed the connection for a connected socket.
Definition: cellular_types.h:826
void(* CellularSocketDataReadyCallback_t)(CellularSocketHandle_t socketHandle, void *pCallbackContext)
Callback used to inform that data is ready for reading on a socket.
Definition: cellular_types.h:813
void(* CellularSocketOpenCallback_t)(CellularUrcEvent_t urcEvent, CellularSocketHandle_t socketHandle, void *pCallbackContext)
Callback used to inform about the status of socket open.
Definition: cellular_types.h:801
CellularPktStatus_t(* CellularATCommandResponseReceivedCallback_t)(CellularHandle_t cellularHandle, const CellularATCommandResponse_t *pAtResp, void *pData, uint16_t dataLen)
Callback used to inform about the response of an AT command sent using Cellular_ATCommandRaw API.
Definition: cellular_types.h:726
struct CellularSocketContext * CellularSocketHandle_t
Opaque socket handle.
Definition: cellular_types.h:81
The data command request structure.
Definition: cellular_common.h:76
uint32_t * pSentDataLength
Definition: cellular_common.h:79
const uint8_t * pData
Definition: cellular_common.h:77
uint32_t dataLen
Definition: cellular_common.h:78
uint32_t endPatternLen
Definition: cellular_common.h:84
const uint8_t * pEndPattern
Definition: cellular_common.h:80
the URC token and URC handler mapping structure used by pkthandler.
Definition: cellular_common.h:101
const char * pStrValue
Definition: cellular_common.h:102
CellularAtParseTokenHandler_t parserFunc
Definition: cellular_common.h:103
The AT command request structure.
Definition: cellular_common.h:62
CellularATCommandType_t atCmdType
Definition: cellular_common.h:64
CellularATCommandResponseReceivedCallback_t respCallback
Definition: cellular_common.h:66
const char * pAtCmd
Definition: cellular_common.h:63
uint16_t dataLen
Definition: cellular_common.h:68
void * pData
Definition: cellular_common.h:67
const char * pAtRspPrefix
Definition: cellular_common.h:65
Represents the functions of a comm interface.
Definition: cellular_comm_interface.h:160
Represents IP Address.
Definition: cellular_types.h:673
Represents network service status.
Definition: cellular_types.h:454
Represents signal information.
Definition: cellular_types.h:440
Represents socket address.
Definition: cellular_types.h:708
Parameters involved in sending/receiving data through sockets.
Definition: cellular_common.h:123
CellularSocketDataReadyCallback_t dataReadyCallback
Definition: cellular_common.h:142
CellularSocketType_t socketType
Definition: cellular_common.h:127
uint32_t recvTimeoutMs
Definition: cellular_common.h:136
uint32_t socketId
Definition: cellular_common.h:125
CellularSocketOpenCallback_t openCallback
Definition: cellular_common.h:144
uint32_t sendTimeoutMs
Definition: cellular_common.h:135
CellularSocketAccessMode_t dataMode
Definition: cellular_common.h:132
CellularSocketDomain_t socketDomain
Definition: cellular_common.h:128
uint8_t contextId
Definition: cellular_common.h:124
void * pClosedCallbackContext
Definition: cellular_common.h:147
uint16_t localPort
Definition: cellular_common.h:131
CellularSocketClosedCallback_t closedCallback
Definition: cellular_common.h:146
void * pOpenCallbackContext
Definition: cellular_common.h:145
CellularSocketState_t socketState
Definition: cellular_common.h:126
CellularSocketProtocol_t socketProtocol
Definition: cellular_common.h:129
CellularIPAddress_t localIpAddress
Definition: cellular_common.h:130
void * pDataReadyCallbackContext
Definition: cellular_common.h:143
CellularSocketAddress_t remoteSocketAddress
Definition: cellular_common.h:139
void * pModemData
Definition: cellular_common.h:150
Parameters to setup pktio and pkthandler token tables.
Definition: cellular_common.h:158
uint32_t cellularSrcTokenErrorTableSize
Definition: cellular_common.h:165
uint32_t cellularSrcExtraTokenSuccessTableSize
Definition: cellular_common.h:175
const char ** pCellularUrcTokenWoPrefixTable
Definition: cellular_common.h:170
CellularAtParseTokenMap_t * pCellularUrcHandlerTable
Definition: cellular_common.h:160
uint32_t cellularUrcTokenWoPrefixTableSize
Definition: cellular_common.h:171
uint32_t cellularPrefixToParserMapSize
Definition: cellular_common.h:161
const char ** pCellularSrcExtraTokenSuccessTable
Definition: cellular_common.h:174
const char ** pCellularSrcTokenSuccessTable
Definition: cellular_common.h:166
uint32_t cellularSrcTokenSuccessTableSize
Definition: cellular_common.h:167
const char ** pCellularSrcTokenErrorTable
Definition: cellular_common.h:164