30#ifndef __CELLULAR_COMMON_H__
31#define __CELLULAR_COMMON_H__
43#ifndef CELLULAR_DO_NOT_USE_CUSTOM_CONFIG
45 #include "cellular_config.h"
48#include "cellular_platform.h"
59typedef struct CellularAtReq
73typedef struct CellularAtDataReq
98typedef struct CellularAtParseTokenMap
108typedef enum CellularSocketState
120typedef struct CellularSocketContext
155typedef struct CellularTokenTable
194 uint32_t * pDataLength );
209 uint32_t * pBytesRead );
222 const char * pLine );
301 const char * pRawData );
389 uint32_t sockIndex );
400 uint32_t sockIndex );
423 int16_t * pRssiValue );
436 int16_t * pBerValue );
448 void ** ppModuleContext );
499 uint32_t timeoutMS );
520 uint32_t atTimeoutMS,
521 const char ** pCellularSrcTokenSuccessTable,
522 uint32_t cellularSrcTokenSuccessTableSize );
540 void * pCallbackContext );
557 uint32_t atTimeoutMS,
558 uint32_t dataTimeoutMS );
579 void * pCallbackContext,
580 uint32_t atTimeoutMS,
581 uint32_t dataTimeoutMS,
582 uint32_t interDelayMS );
601 uint32_t atTimeoutMS,
602 uint32_t dataTimeoutMS,
603 const char ** pCellularSrcTokenSuccessTable,
604 uint32_t cellularSrcTokenSuccessTableSize );
622 void * pCallbackContext );
CellularATError_t
Represents error codes returned from AT Core APIs.
Definition: cellular_at_core.h:69
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...
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...
CellularError_t _Cellular_RegisterUndefinedRespCallback(CellularContext_t *pContext, CellularUndefinedRespCallback_t undefinedRespCallback, void *pCallbackContext)
Register undefined response callback.
CellularError_t _Cellular_TranslatePktStatus(CellularPktStatus_t status)
Translate error code packet status to cellular Status.
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.
CellularError_t _Cellular_IsValidPdn(uint8_t contextId)
Check PDN context index validity.
void _Cellular_GenericCallback(const CellularContext_t *pContext, const char *pRawData)
Call the network registration callback if the callback is previously set by Cellular_RegisterUrcGener...
CellularSocketContext_t * _Cellular_GetSocketData(const CellularContext_t *pContext, uint32_t sockIndex)
Get the socket data structure with socket index.
CellularError_t _Cellular_ConvertCsqSignalRssi(int16_t csqRssi, int16_t *pRssiValue)
Convert CSQ command returned RSSI value.
CellularError_t _Cellular_GetCurrentRat(CellularContext_t *pContext, CellularRat_t *pRat)
Return the current RAT if previously received with 3GPP AT command.
CellularError_t _Cellular_LibCleanup(CellularHandle_t cellularHandle)
One time deinitialization function.
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.
CellularError_t _Cellular_CheckLibraryStatus(CellularContext_t *pContext)
Check Library Status.
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.
CellularPktStatus_t _Cellular_TimeoutAtcmdRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq, uint32_t timeoutMS)
Send the AT command to cellular modem.
CellularPktStatus_t _Cellular_AtcmdRequestWithCallback(CellularContext_t *pContext, CellularAtReq_t atReq)
Send the AT command to cellular modem with default timeout.
CellularPktStatus_t _Cellular_TranslateAtCoreStatus(CellularATError_t status)
Translate Error Code AT Core status to Packet Status.
CellularError_t _Cellular_GetModuleContext(const CellularContext_t *pContext, void **ppModuleContext)
Get the socket data structure with socket index.
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.
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.
void _Cellular_ModemEventCallback(const CellularContext_t *pContext, CellularModemEvent_t modemEvent)
Call the network registration callback if the callback is previously set by Cellular_RegisterModemEve...
CellularError_t _Cellular_RemoveSocketData(CellularContext_t *pContext, CellularSocketHandle_t socketHandle)
Remove the socket.
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.
CellularError_t _Cellular_IsValidSocket(const CellularContext_t *pContext, uint32_t sockIndex)
Check socket index validity.
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...
CellularError_t _Cellular_LibInit(CellularHandle_t *pCellularHandle, const CellularCommInterface_t *pCommInterface, const CellularTokenTable_t *pTokenTable)
One time initialization function.
CellularError_t _Cellular_ConvertCsqSignalBer(int16_t csqBer, int16_t *pBerValue)
Convert CSQ command retruned BER value.
CellularError_t _Cellular_ComputeSignalBars(CellularRat_t rat, CellularSignalInfo_t *pSignalInfo)
Convert the signal to bar.
This represents the default values for the configuration macros for the Cellular library.
CellularSocketState_t
enum representing different Socket State.
Definition: cellular_common.h:109
@ SOCKETSTATE_CONNECTING
Definition: cellular_common.h:111
@ SOCKETSTATE_DISCONNECTED
Definition: cellular_common.h:113
@ SOCKETSTATE_CONNECTED
Definition: cellular_common.h:112
@ SOCKETSTATE_ALLOCATED
Definition: cellular_common.h:110
CellularPktStatus_t(* CellularUndefinedRespCallback_t)(void *pCallbackContext, const char *pLine)
Undefined response callback function.
Definition: cellular_common.h:221
void(* CellularAtParseTokenHandler_t)(CellularContext_t *pContext, char *pInputStr)
URC handler function.
Definition: cellular_common.h:91
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:190
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:207
CellularUrcEvent_t
Represents URC events.
Definition: cellular_types.h:210
CellularPktStatus_t
packet Status Names.
Definition: cellular_types.h:336
CellularATCommandType_t
Represents AT Command type.
Definition: cellular_types.h:358
CellularSocketType_t
Represents socket type.
Definition: cellular_types.h:271
CellularSocketAccessMode_t
Represents data access modes.
Definition: cellular_types.h:291
CellularRat_t
Enums representing Radio Access Technologies (RATs). Reference 3GPP TS 27.007 PLMN selection +COPS.
Definition: cellular_types.h:109
CellularError_t
Status code returns from APIs.
Definition: cellular_types.h:86
CellularSocketDomain_t
Represents socket domain.
Definition: cellular_types.h:261
CellularSocketProtocol_t
Represents socket protocol.
Definition: cellular_types.h:281
CellularModemEvent_t
Represents Modem events.
Definition: cellular_types.h:226
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:822
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:809
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:797
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:722
struct CellularSocketContext * CellularSocketHandle_t
Opaque socket handle.
Definition: cellular_types.h:79
struct CellularContext CellularContext_t
Opaque Cellular context structure type.
Definition: cellular_types.h:65
struct CellularContext * CellularHandle_t
Opaque Cellular handle.
Definition: cellular_types.h:71
The data command request structure.
Definition: cellular_common.h:74
uint32_t * pSentDataLength
Definition: cellular_common.h:77
const uint8_t * pData
Definition: cellular_common.h:75
uint32_t dataLen
Definition: cellular_common.h:76
uint32_t endPatternLen
Definition: cellular_common.h:82
const uint8_t * pEndPattern
Definition: cellular_common.h:78
the URC token and URC handler mapping structure used by pkthanlder.
Definition: cellular_common.h:99
const char * pStrValue
Definition: cellular_common.h:100
CellularAtParseTokenHandler_t parserFunc
Definition: cellular_common.h:101
The AT command request structure.
Definition: cellular_common.h:60
CellularATCommandType_t atCmdType
Definition: cellular_common.h:62
CellularATCommandResponseReceivedCallback_t respCallback
Definition: cellular_common.h:64
const char * pAtCmd
Definition: cellular_common.h:61
uint16_t dataLen
Definition: cellular_common.h:66
void * pData
Definition: cellular_common.h:65
const char * pAtRspPrefix
Definition: cellular_common.h:63
Represents the functions of a comm interface.
Definition: cellular_comm_interface.h:158
Represents IP Address.
Definition: cellular_types.h:669
Represents network service status.
Definition: cellular_types.h:450
Represents signal information.
Definition: cellular_types.h:436
Represents socket address.
Definition: cellular_types.h:704
Parameters involved in sending/receiving data through sockets.
Definition: cellular_common.h:121
CellularSocketDataReadyCallback_t dataReadyCallback
Definition: cellular_common.h:140
CellularSocketType_t socketType
Definition: cellular_common.h:125
uint32_t recvTimeoutMs
Definition: cellular_common.h:134
uint32_t socketId
Definition: cellular_common.h:123
CellularSocketOpenCallback_t openCallback
Definition: cellular_common.h:142
uint32_t sendTimeoutMs
Definition: cellular_common.h:133
CellularSocketAccessMode_t dataMode
Definition: cellular_common.h:130
CellularSocketDomain_t socketDomain
Definition: cellular_common.h:126
uint8_t contextId
Definition: cellular_common.h:122
void * pClosedCallbackContext
Definition: cellular_common.h:145
uint16_t localPort
Definition: cellular_common.h:129
CellularSocketClosedCallback_t closedCallback
Definition: cellular_common.h:144
void * pOpenCallbackContext
Definition: cellular_common.h:143
CellularSocketState_t socketState
Definition: cellular_common.h:124
CellularSocketProtocol_t socketProtocol
Definition: cellular_common.h:127
CellularIPAddress_t localIpAddress
Definition: cellular_common.h:128
void * pDataReadyCallbackContext
Definition: cellular_common.h:141
CellularSocketAddress_t remoteSocketAddress
Definition: cellular_common.h:137
void * pModemData
Definition: cellular_common.h:148
Parameters to setup pktio and pkthandler token tables.
Definition: cellular_common.h:156
uint32_t cellularSrcTokenErrorTableSize
Definition: cellular_common.h:163
uint32_t cellularSrcExtraTokenSuccessTableSize
Definition: cellular_common.h:173
const char ** pCellularUrcTokenWoPrefixTable
Definition: cellular_common.h:168
CellularAtParseTokenMap_t * pCellularUrcHandlerTable
Definition: cellular_common.h:158
uint32_t cellularUrcTokenWoPrefixTableSize
Definition: cellular_common.h:169
uint32_t cellularPrefixToParserMapSize
Definition: cellular_common.h:159
const char ** pCellularSrcExtraTokenSuccessTable
Definition: cellular_common.h:172
const char ** pCellularSrcTokenSuccessTable
Definition: cellular_common.h:164
uint32_t cellularSrcTokenSuccessTableSize
Definition: cellular_common.h:165
const char ** pCellularSrcTokenErrorTable
Definition: cellular_common.h:162