FreeRTOS: FreeRTOS Cellular Library v1.2.0
FreeRTOS Cellular Library
cellular_api.h
Go to the documentation of this file.
1/*
2 * FreeRTOS-Cellular-Interface v1.2.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
24 */
25
30#ifndef __CELLULAR_API_H__
31#define __CELLULAR_API_H__
32
33/* *INDENT-OFF* */
34#ifdef __cplusplus
35 extern "C" {
36#endif
37/* *INDENT-ON* */
38
39/* IoT Cellular data types. */
40#include "cellular_types.h"
41
42/* Hardware interface. */
44
58 const CellularCommInterface_t * pCommInterface );
59
73
87 const CellularRat_t * pRatPriorities,
88 uint8_t ratPrioritiesLength );
89
103 CellularRat_t * pRatPriorities,
104 uint8_t ratPrioritiesLength,
105 uint8_t * pOutputRatPrioritiesLength );
106
116
126
137 CellularSimCardStatus_t * pSimCardStatus );
138
149 CellularSimCardInfo_t * pSimCardInfo );
150
161 CellularModemInfo_t * pModemInfo );
162
173 CellularPlmnInfo_t * pNetworkInfo );
174
185 CellularTime_t * pNetworkTime );
186
197 CellularSignalInfo_t * pSignalInfo );
198
209 CellularServiceStatus_t * pServiceStatus );
210
224 uint8_t contextId,
225 const CellularPdnConfig_t * pPdnConfig );
226
241 CellularPdnStatus_t * pPdnStatusBuffers,
242 uint8_t numStatusBuffers,
243 uint8_t * pNumStatus );
244
256 uint8_t contextId );
257
268 uint8_t contextId );
269
283 uint8_t contextId,
284 char * pBuffer,
285 uint32_t bufferLength );
286
299 uint8_t contextId,
300 const char * pDnsServerAddress );
301
314 CellularUrcNetworkRegistrationCallback_t networkRegistrationCallback,
315 void * pCallbackContext );
316
329 CellularUrcPdnEventCallback_t pdnEventCallback,
330 void * pCallbackContext );
331
344 CellularUrcSignalStrengthChangedCallback_t signalStrengthChangedCallback,
345 void * pCallbackContext );
346
359 CellularModemEventCallback_t modemEventCallback,
360 void * pCallbackContext );
361
375 CellularUrcGenericCallback_t genericCallback,
376 void * pCallbackContext );
377
388 CellularPsmSettings_t * pPsmSettings );
389
402 const CellularPsmSettings_t * pPsmSettings );
403
414 CellularEidrxSettingsList_t * pEidrxSettingsList );
415
429 const CellularEidrxSettings_t * pEidrxSettings );
430
449 const char * pATCommandPrefix,
450 const char * pATCommandPayload,
451 CellularATCommandType_t atCommandType,
452 CellularATCommandResponseReceivedCallback_t responseReceivedCallback,
453 void * pData,
454 uint16_t dataLen );
455
471 uint8_t pdnContextId,
472 CellularSocketDomain_t socketDomain,
473 CellularSocketType_t socketType,
474 CellularSocketProtocol_t socketProtocol,
475 CellularSocketHandle_t * pSocketHandle );
476
489 CellularSocketHandle_t socketHandle,
490 CellularSocketAccessMode_t dataAccessMode,
491 const CellularSocketAddress_t * pRemoteSocketAddress );
492
508 CellularSocketHandle_t socketHandle,
509 const uint8_t * pData,
510 uint32_t dataLength,
511 uint32_t * pSentDataLength );
512
528 CellularSocketHandle_t socketHandle,
529 uint8_t * pBuffer,
530 uint32_t bufferLength,
531 uint32_t * pReceivedDataLength );
532
543 CellularSocketHandle_t socketHandle );
544
561 uint8_t contextId,
562 const char * pcHostName,
563 char * pResolvedAddress );
564
579 CellularSocketHandle_t socketHandle,
580 CellularSocketOptionLevel_t optionLevel,
582 const uint8_t * pOptionValue,
583 uint32_t optionValueLength );
584
599 CellularSocketHandle_t socketHandle,
600 CellularSocketOpenCallback_t socketOpenCallback,
601 void * pCallbackContext );
602
617 CellularSocketHandle_t socketHandle,
618 CellularSocketDataReadyCallback_t dataReadyCallback,
619 void * pCallbackContext );
620
636 CellularSocketHandle_t socketHandle,
637 CellularSocketClosedCallback_t closedCallback,
638 void * pCallbackContext );
639
640/* *INDENT-OFF* */
641#ifdef __cplusplus
642 }
643#endif
644/* *INDENT-ON* */
645
646#endif /* __CELLULAR_API_H__ */
CellularError_t Cellular_RegisterUrcPdnEventCallback(CellularHandle_t cellularHandle, CellularUrcPdnEventCallback_t pdnEventCallback, void *pCallbackContext)
Register/Remove callback for PDN related URC events.
CellularError_t Cellular_GetSimCardInfo(CellularHandle_t cellularHandle, CellularSimCardInfo_t *pSimCardInfo)
Get SIM card information (IMSI, SIM Card number etc.).
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.
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.
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.
CellularError_t Cellular_DeactivatePdn(CellularHandle_t cellularHandle, uint8_t contextId)
Deactivate a PDN context.
CellularError_t Cellular_RegisterUrcNetworkRegistrationEventCallback(CellularHandle_t cellularHandle, CellularUrcNetworkRegistrationCallback_t networkRegistrationCallback, void *pCallbackContext)
Register/Remove callback for Network Registration URC events.
CellularError_t Cellular_SocketConnect(CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketAccessMode_t dataAccessMode, const CellularSocketAddress_t *pRemoteSocketAddress)
Connect to a remote socket.
CellularError_t Cellular_Cleanup(CellularHandle_t cellularHandle)
One time deinitialization function.
CellularError_t Cellular_RegisterUrcSignalStrengthChangedCallback(CellularHandle_t cellularHandle, CellularUrcSignalStrengthChangedCallback_t signalStrengthChangedCallback, void *pCallbackContext)
Register callback for Signal Strength changed URC events.
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.
CellularError_t Cellular_GetPsmSettings(CellularHandle_t cellularHandle, CellularPsmSettings_t *pPsmSettings)
Get current PSM settings.
CellularError_t Cellular_RfOn(CellularHandle_t cellularHandle)
Turn on RF i.e. turn-off airplane mode.
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.
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.
CellularError_t Cellular_Init(CellularHandle_t *pCellularHandle, const CellularCommInterface_t *pCommInterface)
One time initialization function.
CellularError_t Cellular_ActivatePdn(CellularHandle_t cellularHandle, uint8_t contextId)
Activate a PDN context.
CellularError_t Cellular_GetIPAddress(CellularHandle_t cellularHandle, uint8_t contextId, char *pBuffer, uint32_t bufferLength)
Get the IP Address assigned to the module.
CellularError_t Cellular_GetPdnStatus(CellularHandle_t cellularHandle, CellularPdnStatus_t *pPdnStatusBuffers, uint8_t numStatusBuffers, uint8_t *pNumStatus)
Get status reports for all PDN contexts.
CellularError_t Cellular_GetNetworkTime(CellularHandle_t cellularHandle, CellularTime_t *pNetworkTime)
Get the network time.
CellularError_t Cellular_SetDns(CellularHandle_t cellularHandle, uint8_t contextId, const char *pDnsServerAddress)
Set the DNS server to use.
CellularError_t Cellular_GetEidrxSettings(CellularHandle_t cellularHandle, CellularEidrxSettingsList_t *pEidrxSettingsList)
Get current e-I-DRX settings.
CellularError_t Cellular_RegisterModemEventCallback(CellularHandle_t cellularHandle, CellularModemEventCallback_t modemEventCallback, void *pCallbackContext)
Register callback for all modem related events.
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.
CellularError_t Cellular_GetHostByName(CellularHandle_t cellularHandle, uint8_t contextId, const char *pcHostName, char *pResolvedAddress)
Resolve a host name using Domain Name Service.
CellularError_t Cellular_SetEidrxSettings(CellularHandle_t cellularHandle, const CellularEidrxSettings_t *pEidrxSettings)
Set e-I-DRX settings.
CellularError_t Cellular_GetServiceStatus(CellularHandle_t cellularHandle, CellularServiceStatus_t *pServiceStatus)
Get network service status.
CellularError_t Cellular_GetSimCardStatus(CellularHandle_t cellularHandle, CellularSimCardStatus_t *pSimCardStatus)
Get SIM card status (activated/Pin set etc.).
CellularError_t Cellular_GetRegisteredNetwork(CellularHandle_t cellularHandle, CellularPlmnInfo_t *pNetworkInfo)
Get the network on which SIM is currently registered/camped.
CellularError_t Cellular_SocketRegisterSocketOpenCallback(CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketOpenCallback_t socketOpenCallback, void *pCallbackContext)
Register Socket open callback on the socket.
CellularError_t Cellular_RfOff(CellularHandle_t cellularHandle)
Turn off RF i.e. turn-on airplane mode.
CellularError_t Cellular_SocketClose(CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle)
Close the socket.
CellularError_t Cellular_GetSignalInfo(CellularHandle_t cellularHandle, CellularSignalInfo_t *pSignalInfo)
Get signal information.
CellularError_t Cellular_SocketRegisterDataReadyCallback(CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketDataReadyCallback_t dataReadyCallback, void *pCallbackContext)
Register data ready callback on the socket.
CellularError_t Cellular_SetRatPriority(CellularHandle_t cellularHandle, const CellularRat_t *pRatPriorities, uint8_t ratPrioritiesLength)
Configure the priority order in which the networks are searched.
CellularError_t Cellular_GetModemInfo(CellularHandle_t cellularHandle, CellularModemInfo_t *pModemInfo)
Get the information about the modem (HW version, FW version etc.).
CellularError_t Cellular_SetPsmSettings(CellularHandle_t cellularHandle, const CellularPsmSettings_t *pPsmSettings)
Set PSM settings.
CellularError_t Cellular_SocketRegisterClosedCallback(CellularHandle_t cellularHandle, CellularSocketHandle_t socketHandle, CellularSocketClosedCallback_t closedCallback, void *pCallbackContext)
Register closed callback on the socket.
CellularError_t Cellular_SetPdnConfig(CellularHandle_t cellularHandle, uint8_t contextId, const CellularPdnConfig_t *pPdnConfig)
Set PDN config for a PDN context.
CellularATCommandType_t
Represents AT Command type.
Definition: cellular_types.h:357
CellularSocketType_t
Represents socket type.
Definition: cellular_types.h:271
CellularSocketOption_t
Socket option names.
Definition: cellular_types.h:323
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
CellularSocketOptionLevel_t
Represents socket option level.
Definition: cellular_types.h:313
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
void(* CellularModemEventCallback_t)(CellularModemEvent_t modemEvent, void *pCallbackContext)
Callback used to inform about modem events.
Definition: cellular_types.h:784
void(* CellularUrcSignalStrengthChangedCallback_t)(CellularUrcEvent_t urcEvent, const CellularSignalInfo_t *pSignalInfo, void *pCallbackContext)
Callback used to inform about signal strength changed URC event.
Definition: cellular_types.h:761
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:821
void(* CellularUrcPdnEventCallback_t)(CellularUrcEvent_t urcEvent, uint8_t contextId, void *pCallbackContext)
Callback used to inform about PDN URC events.
Definition: cellular_types.h:748
void(* CellularUrcNetworkRegistrationCallback_t)(CellularUrcEvent_t urcEvent, const CellularServiceStatus_t *pServiceStatus, void *pCallbackContext)
Callback used to inform about a Network Registration URC event.
Definition: cellular_types.h:735
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:808
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:796
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:721
void(* CellularUrcGenericCallback_t)(const char *pRawData, void *pCallbackContext)
Generic callback used to inform all other URC events.
Definition: cellular_types.h:773
struct CellularSocketContext * CellularSocketHandle_t
Opaque socket handle.
Definition: cellular_types.h:79
struct CellularContext * CellularHandle_t
Opaque Cellular handle.
Definition: cellular_types.h:71
Represents the functions of a comm interface.
Definition: cellular_comm_interface.h:158
Represents e-I-DRX settings.
Definition: cellular_types.h:567
Cellular Represents e-I-DRX settings Lists.
Definition: cellular_types.h:658
Modem information.
Definition: cellular_types.h:403
Represents a PDN config.
Definition: cellular_types.h:678
Represents status of a PDN context.
Definition: cellular_types.h:691
Public Land Mobile Network (PLMN) information.
Definition: cellular_types.h:382
Represents PSM settings.
Definition: cellular_types.h:488
Represents network service status.
Definition: cellular_types.h:449
Represents signal information.
Definition: cellular_types.h:435
SIM Card information.
Definition: cellular_types.h:392
SIM Card status.
Definition: cellular_types.h:372
Represents socket address.
Definition: cellular_types.h:703
Represents time.
Definition: cellular_types.h:417