FreeRTOS: FreeRTOS Cellular Library v1.4.0
FreeRTOS Cellular Library
 
Loading...
Searching...
No Matches
cellular_api.h
Go to the documentation of this file.
1/*
2 * FreeRTOS-Cellular-Interface v1.4.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
26 */
27
32#ifndef __CELLULAR_API_H__
33#define __CELLULAR_API_H__
34
35/* *INDENT-OFF* */
36#ifdef __cplusplus
37 extern "C" {
38#endif
39/* *INDENT-ON* */
40
41/* IoT Cellular data types. */
42#include "cellular_types.h"
43
44/* Hardware interface. */
46
59CellularError_t Cellular_Init( CellularHandle_t * pCellularHandle,
60 const CellularCommInterface_t * pCommInterface );
61
74CellularError_t Cellular_Cleanup( CellularHandle_t cellularHandle );
75
88CellularError_t Cellular_SetRatPriority( CellularHandle_t cellularHandle,
89 const CellularRat_t * pRatPriorities,
90 uint8_t ratPrioritiesLength );
91
104CellularError_t Cellular_GetRatPriority( CellularHandle_t cellularHandle,
105 CellularRat_t * pRatPriorities,
106 uint8_t ratPrioritiesLength,
107 uint8_t * pOutputRatPrioritiesLength );
108
117CellularError_t Cellular_RfOn( CellularHandle_t cellularHandle );
118
127CellularError_t Cellular_RfOff( CellularHandle_t cellularHandle );
128
138CellularError_t Cellular_GetSimCardStatus( CellularHandle_t cellularHandle,
139 CellularSimCardStatus_t * pSimCardStatus );
140
150CellularError_t Cellular_GetSimCardInfo( CellularHandle_t cellularHandle,
151 CellularSimCardInfo_t * pSimCardInfo );
152
162CellularError_t Cellular_GetModemInfo( CellularHandle_t cellularHandle,
163 CellularModemInfo_t * pModemInfo );
164
174CellularError_t Cellular_GetRegisteredNetwork( CellularHandle_t cellularHandle,
175 CellularPlmnInfo_t * pNetworkInfo );
176
186CellularError_t Cellular_GetNetworkTime( CellularHandle_t cellularHandle,
187 CellularTime_t * pNetworkTime );
188
198CellularError_t Cellular_GetSignalInfo( CellularHandle_t cellularHandle,
199 CellularSignalInfo_t * pSignalInfo );
200
210CellularError_t Cellular_GetServiceStatus( CellularHandle_t cellularHandle,
211 CellularServiceStatus_t * pServiceStatus );
212
225CellularError_t Cellular_SetPdnConfig( CellularHandle_t cellularHandle,
226 uint8_t contextId,
227 const CellularPdnConfig_t * pPdnConfig );
228
242CellularError_t Cellular_GetPdnStatus( CellularHandle_t cellularHandle,
243 CellularPdnStatus_t * pPdnStatusBuffers,
244 uint8_t numStatusBuffers,
245 uint8_t * pNumStatus );
246
257CellularError_t Cellular_ActivatePdn( CellularHandle_t cellularHandle,
258 uint8_t contextId );
259
269CellularError_t Cellular_DeactivatePdn( CellularHandle_t cellularHandle,
270 uint8_t contextId );
271
284CellularError_t Cellular_GetIPAddress( CellularHandle_t cellularHandle,
285 uint8_t contextId,
286 char * pBuffer,
287 uint32_t bufferLength );
288
300CellularError_t Cellular_SetDns( CellularHandle_t cellularHandle,
301 uint8_t contextId,
302 const char * pDnsServerAddress );
303
316 CellularUrcNetworkRegistrationCallback_t networkRegistrationCallback,
317 void * pCallbackContext );
318
331 CellularUrcPdnEventCallback_t pdnEventCallback,
332 void * pCallbackContext );
333
346 CellularUrcSignalStrengthChangedCallback_t signalStrengthChangedCallback,
347 void * pCallbackContext );
348
361 CellularModemEventCallback_t modemEventCallback,
362 void * pCallbackContext );
363
377 CellularUrcGenericCallback_t genericCallback,
378 void * pCallbackContext );
379
389CellularError_t Cellular_GetPsmSettings( CellularHandle_t cellularHandle,
390 CellularPsmSettings_t * pPsmSettings );
391
403CellularError_t Cellular_SetPsmSettings( CellularHandle_t cellularHandle,
404 const CellularPsmSettings_t * pPsmSettings );
405
415CellularError_t Cellular_GetEidrxSettings( CellularHandle_t cellularHandle,
416 CellularEidrxSettingsList_t * pEidrxSettingsList );
417
430CellularError_t Cellular_SetEidrxSettings( CellularHandle_t cellularHandle,
431 const CellularEidrxSettings_t * pEidrxSettings );
432
450CellularError_t Cellular_ATCommandRaw( CellularHandle_t cellularHandle,
451 const char * pATCommandPrefix,
452 const char * pATCommandPayload,
453 CellularATCommandType_t atCommandType,
454 CellularATCommandResponseReceivedCallback_t responseReceivedCallback,
455 void * pData,
456 uint16_t dataLen );
457
472CellularError_t Cellular_CreateSocket( CellularHandle_t cellularHandle,
473 uint8_t pdnContextId,
474 CellularSocketDomain_t socketDomain,
475 CellularSocketType_t socketType,
476 CellularSocketProtocol_t socketProtocol,
477 CellularSocketHandle_t * pSocketHandle );
478
490CellularError_t Cellular_SocketConnect( CellularHandle_t cellularHandle,
491 CellularSocketHandle_t socketHandle,
492 CellularSocketAccessMode_t dataAccessMode,
493 const CellularSocketAddress_t * pRemoteSocketAddress );
494
509CellularError_t Cellular_SocketSend( CellularHandle_t cellularHandle,
510 CellularSocketHandle_t socketHandle,
511 const uint8_t * pData,
512 uint32_t dataLength,
513 uint32_t * pSentDataLength );
514
529CellularError_t Cellular_SocketRecv( CellularHandle_t cellularHandle,
530 CellularSocketHandle_t socketHandle,
531 uint8_t * pBuffer,
532 uint32_t bufferLength,
533 uint32_t * pReceivedDataLength );
534
544CellularError_t Cellular_SocketClose( CellularHandle_t cellularHandle,
545 CellularSocketHandle_t socketHandle );
546
562CellularError_t Cellular_GetHostByName( CellularHandle_t cellularHandle,
563 uint8_t contextId,
564 const char * pcHostName,
565 char * pResolvedAddress );
566
580CellularError_t Cellular_SocketSetSockOpt( CellularHandle_t cellularHandle,
581 CellularSocketHandle_t socketHandle,
582 CellularSocketOptionLevel_t optionLevel,
584 const uint8_t * pOptionValue,
585 uint32_t optionValueLength );
586
601 CellularSocketHandle_t socketHandle,
602 CellularSocketOpenCallback_t socketOpenCallback,
603 void * pCallbackContext );
604
619 CellularSocketHandle_t socketHandle,
620 CellularSocketDataReadyCallback_t dataReadyCallback,
621 void * pCallbackContext );
622
638 CellularSocketHandle_t socketHandle,
639 CellularSocketClosedCallback_t closedCallback,
640 void * pCallbackContext );
641
642/* *INDENT-OFF* */
643#ifdef __cplusplus
644 }
645#endif
646/* *INDENT-ON* */
647
648#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:360
CellularSocketType_t
Represents socket type.
Definition: cellular_types.h:273
CellularSocketOption_t
Socket option names.
Definition: cellular_types.h:325
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
CellularSocketOptionLevel_t
Represents socket option level.
Definition: cellular_types.h:315
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
void(* CellularModemEventCallback_t)(CellularModemEvent_t modemEvent, void *pCallbackContext)
Callback used to inform about modem events.
Definition: cellular_types.h:789
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:766
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(* CellularUrcPdnEventCallback_t)(CellularUrcEvent_t urcEvent, uint8_t contextId, void *pCallbackContext)
Callback used to inform about PDN URC events.
Definition: cellular_types.h:753
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:740
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
void(* CellularUrcGenericCallback_t)(const char *pRawData, void *pCallbackContext)
Generic callback used to inform all other URC events.
Definition: cellular_types.h:778
struct CellularSocketContext * CellularSocketHandle_t
Opaque socket handle.
Definition: cellular_types.h:81
Represents the functions of a comm interface.
Definition: cellular_comm_interface.h:160
Represents e-I-DRX settings.
Definition: cellular_types.h:572
Cellular Represents e-I-DRX settings Lists.
Definition: cellular_types.h:663
Modem information.
Definition: cellular_types.h:408
Represents a PDN config.
Definition: cellular_types.h:683
Represents status of a PDN context.
Definition: cellular_types.h:696
Public Land Mobile Network (PLMN) information.
Definition: cellular_types.h:387
Represents PSM settings.
Definition: cellular_types.h:493
Represents network service status.
Definition: cellular_types.h:454
Represents signal information.
Definition: cellular_types.h:440
SIM Card information.
Definition: cellular_types.h:397
SIM Card status.
Definition: cellular_types.h:377
Represents socket address.
Definition: cellular_types.h:708
Represents time.
Definition: cellular_types.h:422