[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
@ -0,0 +1,570 @@
|
||||
/*
|
||||
* FreeRTOS-Cellular-Interface v1.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*/
|
||||
|
||||
#include "cellular_config.h"
|
||||
#include "cellular_config_defaults.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cellular_platform.h"
|
||||
#include "cellular_common.h"
|
||||
#include "cellular_common_portable.h"
|
||||
#include "cellular_r4.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define ENBABLE_MODULE_UE_RETRY_COUNT ( 3U )
|
||||
#define ENBABLE_MODULE_UE_RETRY_TIMEOUT ( 5000U )
|
||||
#define ENBABLE_MODULE_UE_REBOOT_POLL_TIME ( 2000U )
|
||||
#define ENBABLE_MODULE_UE_REBOOT_MAX_TIME ( 25000U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularError_t sendAtCommandWithRetryTimeout( CellularContext_t * pContext,
|
||||
const CellularAtReq_t * pAtReq );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static cellularModuleContext_t cellularHl7802Context = { 0 };
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
const char * CellularSrcTokenErrorTable[] =
|
||||
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
uint32_t CellularSrcTokenErrorTableSize = sizeof( CellularSrcTokenErrorTable ) / sizeof( char * );
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
const char * CellularSrcTokenSuccessTable[] =
|
||||
{ "OK", "@" };
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
uint32_t CellularSrcTokenSuccessTableSize = sizeof( CellularSrcTokenSuccessTable ) / sizeof( char * );
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
const char * CellularUrcTokenWoPrefixTable[] =
|
||||
{ "RDY" };
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
uint32_t CellularUrcTokenWoPrefixTableSize = sizeof( CellularUrcTokenWoPrefixTable ) / sizeof( char * );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularError_t sendAtCommandWithRetryTimeout( CellularContext_t * pContext,
|
||||
const CellularAtReq_t * pAtReq )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
uint8_t tryCount = 0;
|
||||
|
||||
if( pAtReq == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; tryCount < ENBABLE_MODULE_UE_RETRY_COUNT; tryCount++ )
|
||||
{
|
||||
pktStatus = _Cellular_TimeoutAtcmdRequestWithCallback( pContext, *pAtReq, ENBABLE_MODULE_UE_RETRY_TIMEOUT );
|
||||
cellularStatus = _Cellular_TranslatePktStatus( pktStatus );
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_ModuleInit( const CellularContext_t * pContext,
|
||||
void ** ppModuleContext )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
uint32_t i = 0;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_INVALID_HANDLE;
|
||||
}
|
||||
else if( ppModuleContext == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize the module context. */
|
||||
( void ) memset( &cellularHl7802Context, 0, sizeof( cellularModuleContext_t ) );
|
||||
|
||||
for( i = 0; i < TCP_SESSION_TABLE_LEGNTH; i++ )
|
||||
{
|
||||
cellularHl7802Context.pSessionMap[ i ] = INVALID_SOCKET_INDEX;
|
||||
}
|
||||
|
||||
*ppModuleContext = ( void * ) &cellularHl7802Context;
|
||||
}
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_ModuleCleanUp( const CellularContext_t * pContext )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Parse AT response for current MNO profile */
|
||||
static CellularPktStatus_t _Cellular_RecvFuncGetCurrentMNOProfile( CellularContext_t * pContext,
|
||||
const CellularATCommandResponse_t * pAtResp,
|
||||
void * pData,
|
||||
uint16_t dataLen )
|
||||
{
|
||||
char * pInputLine = NULL;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
MNOProfileType_t * pCurrentMNOProfile = ( MNOProfileType_t * ) pData;
|
||||
char * pToken = NULL;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
LogError( ( "_Cellular_RecvFuncGetCurrentMNOProfile: Invalid handle" ) );
|
||||
pktStatus = CELLULAR_PKT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
else if( ( pData == NULL ) || ( dataLen != sizeof( MNOProfileType_t ) ) )
|
||||
{
|
||||
LogError( ( "_Cellular_RecvFuncGetCurrentMNOProfile: Invalid param" ) );
|
||||
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
|
||||
}
|
||||
else if( ( pAtResp == NULL ) || ( pAtResp->pItm == NULL ) || ( pAtResp->pItm->pLine == NULL ) )
|
||||
{
|
||||
LogError( ( "_Cellular_RecvFuncGetCurrentMNOProfile: Input Line passed is NULL" ) );
|
||||
pktStatus = CELLULAR_PKT_STATUS_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pInputLine = pAtResp->pItm->pLine;
|
||||
|
||||
/* Remove prefix. */
|
||||
atCoreStatus = Cellular_ATRemovePrefix( &pInputLine );
|
||||
|
||||
/* Remove leading space. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATRemoveLeadingWhiteSpaces( &pInputLine );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pInputLine, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= MNO_PROFILE_SW_DEFAULT ) && ( tempValue <= MNO_PROFILE_STANDARD_EUROPE ) )
|
||||
{
|
||||
*pCurrentMNOProfile = tempValue;
|
||||
LogInfo( ( "_Cellular_RecvFuncGetCurrentMNOProfile: pCurrentMNOProfile [%d]", *pCurrentMNOProfile ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Get modem's current MNO profile */
|
||||
static CellularError_t _Cellular_GetCurrentMNOProfile( CellularContext_t * pContext,
|
||||
MNOProfileType_t * pCurrentMNOProfile )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularAtReq_t atReqGetCurrentMNOProfile =
|
||||
{
|
||||
"AT+UMNOPROF?",
|
||||
CELLULAR_AT_WITH_PREFIX,
|
||||
"+UMNOPROF",
|
||||
_Cellular_RecvFuncGetCurrentMNOProfile,
|
||||
NULL,
|
||||
sizeof( MNOProfileType_t ),
|
||||
};
|
||||
|
||||
atReqGetCurrentMNOProfile.pData = pCurrentMNOProfile;
|
||||
|
||||
/* Internal function. Callee check parameters. */
|
||||
pktStatus = _Cellular_AtcmdRequestWithCallback( pContext, atReqGetCurrentMNOProfile );
|
||||
cellularStatus = _Cellular_TranslatePktStatus( pktStatus );
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Reboot modem and wait for ready state. */
|
||||
|
||||
CellularError_t rebootCellularModem( CellularContext_t * pContext,
|
||||
bool disablePsm,
|
||||
bool disableEidrx )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
uint32_t count = 0;
|
||||
CellularAtReq_t atReqGetWoPrefix =
|
||||
{
|
||||
NULL,
|
||||
CELLULAR_AT_WO_PREFIX,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
CellularAtReq_t atReqGetNoResult =
|
||||
{
|
||||
"AT+CFUN=15",
|
||||
CELLULAR_AT_NO_RESULT,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
LogInfo( ( "rebootCellularModem: Rebooting Modem." ) );
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
Platform_Delay( ENBABLE_MODULE_UE_REBOOT_POLL_TIME );
|
||||
count = count + ENBABLE_MODULE_UE_REBOOT_POLL_TIME;
|
||||
|
||||
/* wait for modem after reboot*/
|
||||
while( count < ENBABLE_MODULE_UE_REBOOT_MAX_TIME )
|
||||
{
|
||||
LogInfo( ( "rebootCellularModem: Use ATE0 command to test modem status." ) );
|
||||
|
||||
atReqGetWoPrefix.pAtCmd = "ATE0";
|
||||
|
||||
pktStatus = _Cellular_TimeoutAtcmdRequestWithCallback( pContext, atReqGetWoPrefix, ENBABLE_MODULE_UE_REBOOT_POLL_TIME );
|
||||
cellularStatus = _Cellular_TranslatePktStatus( pktStatus );
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
LogInfo( ( "rebootCellularModem: Modem is now available." ) );
|
||||
|
||||
Platform_Delay( ENBABLE_MODULE_UE_REBOOT_POLL_TIME * 3 );
|
||||
|
||||
/* Query current PSM settings. */
|
||||
atReqGetNoResult.pAtCmd = "AT+CPSMS?";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
|
||||
if( disablePsm && ( cellularStatus == CELLULAR_SUCCESS ) )
|
||||
{
|
||||
LogInfo( ( "rebootCellularModem: Disable +CPSMS setting." ) );
|
||||
atReqGetNoResult.pAtCmd = "AT+CPSMS=0";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( disableEidrx && ( cellularStatus == CELLULAR_SUCCESS ) )
|
||||
{
|
||||
LogInfo( ( "rebootCellularModem: Disable +CEDRXS setting." ) );
|
||||
atReqGetNoResult.pAtCmd = "AT+CEDRXS=0,4";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogWarn( ( "rebootCellularModem: Modem is not ready. Retry sending ATE0." ) );
|
||||
}
|
||||
|
||||
count = count + ENBABLE_MODULE_UE_REBOOT_POLL_TIME;
|
||||
}
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_ModuleEnableUE( CellularContext_t * pContext )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
CellularAtReq_t atReqGetNoResult =
|
||||
{
|
||||
NULL,
|
||||
CELLULAR_AT_NO_RESULT,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
CellularAtReq_t atReqGetWithResult =
|
||||
{
|
||||
NULL,
|
||||
CELLULAR_AT_WO_PREFIX,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
char pAtCmdBuf[ CELLULAR_AT_CMD_MAX_SIZE ] = { 0 };
|
||||
|
||||
if( pContext != NULL )
|
||||
{
|
||||
/* Disable echo. */
|
||||
atReqGetWithResult.pAtCmd = "ATE0";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetWithResult );
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Disable DTR function. */
|
||||
atReqGetNoResult.pAtCmd = "AT&D0";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
#ifndef CELLULAR_CONFIG_DISABLE_FLOW_CONTROL
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Enable RTS/CTS hardware flow control. */
|
||||
atReqGetNoResult.pAtCmd = "AT+IFC=2,2";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Report verbose mobile termination error. */
|
||||
atReqGetNoResult.pAtCmd = "AT+CMEE=2";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Setup mobile network operator profiles. */
|
||||
/* Setting +UMNOPROF profile will automatically select suitable values for +URAT and +UBANDMASK. */
|
||||
|
||||
/* Check current MNO profile first to avoid unneccessary modem reboot. */
|
||||
MNOProfileType_t currentMNOProfile = MNO_PROFILE_NOT_SET;
|
||||
cellularStatus = _Cellular_GetCurrentMNOProfile( pContext, ¤tMNOProfile );
|
||||
|
||||
LogInfo( ( "Cellular_ModuleEnableUE: currentMNOProfile = [%d], desiredProfile = [%d]", currentMNOProfile, CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE ) );
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Set MNO profile if not set already */
|
||||
if( ( currentMNOProfile != CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE ) && ( CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE != MNO_PROFILE_NOT_SET ) )
|
||||
{
|
||||
atReqGetNoResult.pAtCmd = pAtCmdBuf;
|
||||
( void ) snprintf( ( char * ) atReqGetNoResult.pAtCmd, CELLULAR_AT_CMD_MAX_SIZE, "%s%d", "AT+COPS=2;+UMNOPROF=", CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE );
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
cellularStatus = rebootCellularModem( pContext, true, true );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CELLULAR_CONFIG_SARA_R4_REBOOT_ON_INIT
|
||||
else
|
||||
{
|
||||
cellularStatus = rebootCellularModem( pContext, true, true );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
atReqGetNoResult.pAtCmd = "AT+COPS=0";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
atReqGetNoResult.pAtCmd = "AT+CFUN=1";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
}
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_ModuleEnableUrc( CellularContext_t * pContext )
|
||||
{
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
CellularAtReq_t atReqGetNoResult =
|
||||
{
|
||||
NULL,
|
||||
CELLULAR_AT_NO_RESULT,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
atReqGetNoResult.pAtCmd = "AT+COPS=3,2";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
atReqGetNoResult.pAtCmd = "AT+CREG=2";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
atReqGetNoResult.pAtCmd = "AT+CGREG=2";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
atReqGetNoResult.pAtCmd = "AT+CEREG=2";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
atReqGetNoResult.pAtCmd = "AT+CTZR=1";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
/* TODO: +CGEV URC enable. */
|
||||
/* atReqGetNoResult.pAtCmd = "AT+CGEREP=2,0"; */
|
||||
/* (void)_Cellular_AtcmdRequestWithCallback(pContext, atReqGetNoResult); */
|
||||
|
||||
/* Power saving mode URC enable. */
|
||||
atReqGetNoResult.pAtCmd = "AT+UPSMR=1";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
/* Mobile termination event reporting +CIEV URC enable. */
|
||||
atReqGetNoResult.pAtCmd = "AT+CMER=1,0,0,2,1";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
/* Enable signal level change indication via +CIEV URC. (To enable all indications, set to 4095) */
|
||||
atReqGetNoResult.pAtCmd = "AT+UCIND=2";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
/* Enable greeting message "RDY" on modem bootup. */
|
||||
atReqGetNoResult.pAtCmd = "AT+CSGT=1,\"RDY\"";
|
||||
( void ) _Cellular_AtcmdRequestWithCallback( pContext, atReqGetNoResult );
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
uint32_t _Cellular_GetSocketId( CellularContext_t * pContext,
|
||||
uint8_t sessionId )
|
||||
{
|
||||
cellularModuleContext_t * pModuleContext = NULL;
|
||||
uint32_t socketIndex = INVALID_SOCKET_INDEX;
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
|
||||
if( pContext != NULL )
|
||||
{
|
||||
cellularStatus = _Cellular_GetModuleContext( pContext, ( void ** ) &pModuleContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if( ( cellularStatus == CELLULAR_SUCCESS ) && ( sessionId <= ( ( uint8_t ) MAX_TCP_SESSION_ID ) ) )
|
||||
{
|
||||
socketIndex = pModuleContext->pSessionMap[ sessionId ];
|
||||
}
|
||||
|
||||
return socketIndex;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
uint32_t _Cellular_GetSessionId( CellularContext_t * pContext,
|
||||
uint32_t socketIndex )
|
||||
{
|
||||
cellularModuleContext_t * pModuleContext = NULL;
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
uint32_t sessionId = INVALID_SESSION_ID;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
LogError( ( "_Cellular_GetSessionId invalid cellular context" ) );
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
else if( socketIndex == INVALID_SOCKET_INDEX )
|
||||
{
|
||||
LogError( ( "_Cellular_GetSessionId invalid socketIndex" ) );
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellularStatus = _Cellular_GetModuleContext( pContext, ( void ** ) &pModuleContext );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
for( sessionId = 0; sessionId < TCP_SESSION_TABLE_LEGNTH; sessionId++ )
|
||||
{
|
||||
if( pModuleContext->pSessionMap[ sessionId ] == socketIndex )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mapping is not found in the session mapping table. */
|
||||
if( sessionId == TCP_SESSION_TABLE_LEGNTH )
|
||||
{
|
||||
sessionId = INVALID_SESSION_ID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionId = INVALID_SESSION_ID;
|
||||
}
|
||||
|
||||
return sessionId;
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* FreeRTOS-Cellular-Interface v1.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*/
|
||||
|
||||
#ifndef __CELLULAR_R4_H__
|
||||
#define __CELLULAR_R4_H__
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define MIN_TCP_SESSION_ID ( 0 )
|
||||
#define MAX_TCP_SESSION_ID ( 6 )
|
||||
#define TCP_SESSION_TABLE_LEGNTH ( MAX_TCP_SESSION_ID + 1 )
|
||||
|
||||
#define INVALID_SOCKET_INDEX ( UINT32_MAX )
|
||||
#define INVALID_SESSION_ID ( UINT32_MAX )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
typedef struct cellularModuleContext
|
||||
{
|
||||
uint32_t pSessionMap[ TCP_SESSION_TABLE_LEGNTH ];
|
||||
} cellularModuleContext_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
uint32_t _Cellular_GetSocketId( CellularContext_t * pContext,
|
||||
uint8_t sessionId );
|
||||
|
||||
uint32_t _Cellular_GetSessionId( CellularContext_t * pContext,
|
||||
uint32_t socketIndex );
|
||||
|
||||
CellularError_t rebootCellularModem( CellularContext_t * pContext,
|
||||
bool disablePsm,
|
||||
bool disableEidrx );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Cellular MNO profiles.
|
||||
*/
|
||||
typedef enum MNOProfileType
|
||||
{
|
||||
MNO_PROFILE_SW_DEFAULT = 0,
|
||||
MNO_PROFILE_SIM_ICCID_IMSI_SELECT = 1,
|
||||
MNO_PROFILE_ATT = 2,
|
||||
MNO_PROFILE_VERIZON = 3,
|
||||
MNO_PROFILE_TELSTRA = 4,
|
||||
MNO_PROFILE_TMOBILE = 5,
|
||||
MNO_PROFILE_CHINA_TELECOM = 6,
|
||||
MNO_PROFILE_SPRINT = 8,
|
||||
MNO_PROFILE_VODAFONE = 19,
|
||||
MNO_PROFILE_GLOBAL = 90,
|
||||
MNO_PROFILE_STANDARD_EUROPE = 100,
|
||||
MNO_PROFILE_NOT_SET = 999
|
||||
} MNOProfileType_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Select network MNO profile. Default value is MNO_PROFILE_NOT_SET */
|
||||
#ifndef CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE
|
||||
#define CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE ( MNO_PROFILE_NOT_SET )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* By default socket is closed in normal mode i.e. <async_close> flag is 0.
|
||||
* In normal mode, +USOCL can take time to close socket (Max timeout is 120 sec).
|
||||
* To avoid wait, socket can be closed in async mode via <async_close> flag.
|
||||
* In <async_close> mode, socket close will be notified via +UUSOCL URC.
|
||||
* Drawback of <async_close> mode is that if try to deactivate context (e.g. AT+CGACT=0,1).
|
||||
* prior to socket close URC, AT command will result in ERROR.
|
||||
*/
|
||||
#define CELLULAR_CONFIG_SET_SOCKET_CLOSE_ASYNC_MODE ( 0U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* MAX valid PDP contexts */
|
||||
#define MAX_PDP_CONTEXTS ( 4U )
|
||||
|
||||
#define DEFAULT_BEARER_CONTEXT_ID ( 1U ) /* SARA-R4 default bearer context */
|
||||
|
||||
#define CELULAR_PDN_CONTEXT_TYPE_MAX_SIZE ( 7U ) /* The length of IP type e.g. IPV4V6. */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* +CGDCONT PDN context definition tokens */
|
||||
#define CELLULAR_PDN_STATUS_POS_CONTEXT_ID ( 0U )
|
||||
#define CELLULAR_PDN_STATUS_POS_CONTEXT_TYPE ( 1U )
|
||||
#define CELLULAR_PDN_STATUS_POS_APN_NAME ( 2U )
|
||||
#define CELLULAR_PDN_STATUS_POS_IP_ADDRESS ( 3U )
|
||||
|
||||
/* +CGACT PDN context activation tokens */
|
||||
#define CELLULAR_PDN_ACT_STATUS_POS_CONTEXT_ID ( 0U )
|
||||
#define CELLULAR_PDN_ACT_STATUS_POS_CONTEXT_STATE ( 1U )
|
||||
|
||||
/**
|
||||
* @brief Context info from +CGDCONT (Context IP type, APN name, IP Address)
|
||||
*/
|
||||
typedef struct CellularPdnContextInfo
|
||||
{
|
||||
bool contextsPresent[ MAX_PDP_CONTEXTS ]; /**< Context present in +CGDCONT response or not. */
|
||||
char ipType[ MAX_PDP_CONTEXTS ][ CELULAR_PDN_CONTEXT_TYPE_MAX_SIZE ]; /**< PDN Context type. */
|
||||
char apnName[ MAX_PDP_CONTEXTS ][ CELLULAR_APN_MAX_SIZE ]; /**< APN name. */
|
||||
char ipAddress[ MAX_PDP_CONTEXTS ][ CELLULAR_IP_ADDRESS_MAX_SIZE ]; /**< IP address. */
|
||||
} CellularPdnContextInfo_t;
|
||||
|
||||
/**
|
||||
* @brief Context <Act> state from +CGACT
|
||||
*/
|
||||
typedef struct CellularPdnContextActInfo
|
||||
{
|
||||
bool contextsPresent[ MAX_PDP_CONTEXTS ]; /**< Context present in +CGACT response or not. */
|
||||
bool contextActState[ MAX_PDP_CONTEXTS ]; /**< Context active state from +CGACT response. */
|
||||
} CellularPdnContextActInfo_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
extern CellularAtParseTokenMap_t CellularUrcHandlerTable[];
|
||||
extern uint32_t CellularUrcHandlerTableSize;
|
||||
|
||||
extern const char * CellularSrcTokenErrorTable[];
|
||||
extern uint32_t CellularSrcTokenErrorTableSize;
|
||||
|
||||
extern const char * CellularSrcTokenSuccessTable[];
|
||||
extern uint32_t CellularSrcTokenSuccessTableSize;
|
||||
|
||||
extern const char * CellularUrcTokenWoPrefixTable[];
|
||||
extern uint32_t CellularUrcTokenWoPrefixTableSize;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#endif /* ifndef __CELLULAR_R4_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,656 @@
|
||||
/*
|
||||
* FreeRTOS-Cellular-Interface v1.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*/
|
||||
|
||||
#include "cellular_config.h"
|
||||
#include "cellular_config_defaults.h"
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "cellular_platform.h"
|
||||
#include "cellular_types.h"
|
||||
#include "cellular_common.h"
|
||||
#include "cellular_common_api.h"
|
||||
#include "cellular_common_portable.h"
|
||||
|
||||
/* Cellular module includes. */
|
||||
#include "cellular_r4.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* +UUPSMR URC */
|
||||
#define PSM_MODE_EXIT ( 0U )
|
||||
#define PSM_MODE_ENTER ( 1U )
|
||||
#define PSM_MODE_PREVENT_ENTRY ( 2U )
|
||||
#define PSM_MODE_PREVENT_DEEP_ENTRY ( 3U )
|
||||
|
||||
/* +CIEV URC */
|
||||
#define CIEV_POS_MIN ( 1U )
|
||||
#define CIEV_POS_SIGNAL ( 2U )
|
||||
#define CIEV_POS_SERVICE ( 3U )
|
||||
#define CIEV_POS_CALL ( 6U )
|
||||
#define CIEV_POS_MAX ( 12U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessUusoco( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _cellular_UrcProcessUusord( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _cellular_UrcProcessUusocl( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
|
||||
static void _cellular_UrcProcessUupsmr( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _cellular_UrcProcessCiev( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessModemRdy( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static CellularPktStatus_t _parseUrcIndicationCsq( CellularContext_t * pContext,
|
||||
char * pUrcStr );
|
||||
static void _Cellular_UrcProcessCereg( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_UrcProcessCgreg( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_UrcProcessCreg( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Try to Keep this map in Alphabetical order. */
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
|
||||
{
|
||||
{ "CEREG", _Cellular_UrcProcessCereg },
|
||||
{ "CGREG", _Cellular_UrcProcessCgreg },
|
||||
/*{ "CGEV", _cellular_UrcProcessCgev }, / * TODO: PS event reporting URC. * / */
|
||||
{ "CIEV", _cellular_UrcProcessCiev }, /* PS ACT/DEACT and Signal strength status change indication URC. */
|
||||
{ "CREG", _Cellular_UrcProcessCreg },
|
||||
{ "RDY", _Cellular_ProcessModemRdy }, /* Modem bootup indication. */
|
||||
{ "UUPSMR", _cellular_UrcProcessUupsmr }, /* Power saving mode indication URC. */
|
||||
{ "UUSOCL", _cellular_UrcProcessUusocl }, /* Socket close URC. */
|
||||
{ "UUSOCO", _cellular_UrcProcessUusoco }, /* Socket connect URC. */
|
||||
{ "UUSORD", _cellular_UrcProcessUusord } /* Socket receive URC. */
|
||||
};
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
uint32_t CellularUrcHandlerTableSize = sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Parse PS ACT/DEACT from +CIEV URC indication. */
|
||||
/* This URC does not tell which context ID number is ACT/DEACT. */
|
||||
|
||||
static CellularPktStatus_t _parseUrcIndicationCall( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
int32_t isActivated = 0;
|
||||
/* In SARA-R4, usually context 1 is used for PS. */
|
||||
uint8_t contextId = 1;
|
||||
|
||||
if( ( pContext == NULL ) || ( pUrcStr == NULL ) )
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pUrcStr, 10, &isActivated );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( isActivated >= INT16_MIN ) && ( isActivated <= ( int32_t ) INT16_MAX ) )
|
||||
{
|
||||
LogDebug( ( "_parseUrcIndicationCall: PS status isActivated=[%d]", isActivated ) );
|
||||
|
||||
/* Handle the callback function. */
|
||||
if( isActivated )
|
||||
{
|
||||
LogDebug( ( "_parseUrcIndicationCall: PDN activated. Context Id %d", contextId ) );
|
||||
_Cellular_PdnEventCallback( pContext, CELLULAR_URC_EVENT_PDN_ACTIVATED, contextId );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_parseUrcIndicationCall: PDN deactivated. Context Id %d", contextId ) );
|
||||
_Cellular_PdnEventCallback( pContext, CELLULAR_URC_EVENT_PDN_DEACTIVATED, contextId );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Parse signal level from +CIEV URC indication. */
|
||||
/* This URC only gives bar level and not the exact RSSI value. */
|
||||
|
||||
static CellularPktStatus_t _parseUrcIndicationCsq( CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
int32_t retStrtoi = 0;
|
||||
int16_t csqBarLevel = CELLULAR_INVALID_SIGNAL_BAR_VALUE;
|
||||
CellularSignalInfo_t signalInfo = { 0 };
|
||||
|
||||
if( ( pContext == NULL ) || ( pUrcStr == NULL ) )
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pUrcStr, 10, &retStrtoi );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( retStrtoi >= INT16_MIN ) && ( retStrtoi <= ( int32_t ) INT16_MAX ) )
|
||||
{
|
||||
csqBarLevel = retStrtoi;
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle the callback function. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
LogDebug( ( "_parseUrcIndicationCsq: SIGNAL Strength Bar level [%d]", csqBarLevel ) );
|
||||
signalInfo.rssi = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.rsrp = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.rsrq = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.ber = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.bars = csqBarLevel;
|
||||
_Cellular_SignalStrengthChangedCallback( pContext, CELLULAR_URC_EVENT_SIGNAL_CHANGED, &signalInfo );
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessCiev( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
char * pUrcStr = NULL, * pToken = NULL;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
int32_t tempValue = 0;
|
||||
uint8_t indicatorDescr = 0;
|
||||
|
||||
/* Check context status. */
|
||||
if( pContext == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_FAILURE;
|
||||
}
|
||||
else if( pInputLine == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
pUrcStr = pInputLine;
|
||||
atCoreStatus = Cellular_ATRemoveAllDoubleQuote( pUrcStr );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATRemoveLeadingWhiteSpaces( &pUrcStr );
|
||||
}
|
||||
|
||||
/* Extract indicator <descr> */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pUrcStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= ( ( int32_t ) CIEV_POS_MIN ) ) && ( tempValue <= ( ( int32_t ) CIEV_POS_MAX ) ) )
|
||||
{
|
||||
indicatorDescr = ( uint8_t ) tempValue;
|
||||
|
||||
switch( indicatorDescr )
|
||||
{
|
||||
case CIEV_POS_SIGNAL:
|
||||
LogDebug( ( "_cellular_UrcProcessCiev: CIEV_POS_SIGNAL" ) );
|
||||
/* This URC only gives bar level and not the exact RSSI value. */
|
||||
|
||||
/*
|
||||
* o 0: < -105 dBm
|
||||
* o 1 : < -93 dBm
|
||||
* o 2 : < -81 dBm
|
||||
* o 3 : < -69 dBm
|
||||
* o 4 : < -57 dBm
|
||||
* o 5 : >= -57 dBm
|
||||
*/
|
||||
/* Parse the signal Bar level from string. */
|
||||
pktStatus = _parseUrcIndicationCsq( pContext, pUrcStr );
|
||||
break;
|
||||
|
||||
case CIEV_POS_CALL:
|
||||
LogDebug( ( "_cellular_UrcProcessCiev: CIEV_POS_CALL" ) );
|
||||
/* Parse PS ACT/DEACT from +CIEV URC indication. */
|
||||
/* This URC does not tell which context ID number is ACT/DEACT. */
|
||||
pktStatus = _parseUrcIndicationCall( ( const CellularContext_t * ) pContext, pUrcStr );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "_cellular_UrcProcessCiev: parsing <descr> failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
}
|
||||
|
||||
if( pktStatus != CELLULAR_PKT_STATUS_OK )
|
||||
{
|
||||
LogDebug( ( "_cellular_UrcProcessCiev: Parse failure" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessUupsmr( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
char * pLocalInputLine = pInputLine;
|
||||
char * pToken = NULL;
|
||||
uint8_t psmState = 0;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( ( pContext != NULL ) && ( pInputLine != NULL ) )
|
||||
{
|
||||
/* The inputline is in this format +UUPSMR: <state>[,<param1>] */
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputLine, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= ( ( int32_t ) PSM_MODE_EXIT ) ) && ( tempValue <= ( ( int32_t ) PSM_MODE_PREVENT_DEEP_ENTRY ) ) )
|
||||
{
|
||||
psmState = ( uint8_t ) tempValue;
|
||||
|
||||
switch( psmState )
|
||||
{
|
||||
case PSM_MODE_EXIT:
|
||||
LogInfo( ( "_cellular_UrcProcessUupsmr: PSM_MODE_EXIT" ) );
|
||||
break;
|
||||
|
||||
case PSM_MODE_ENTER:
|
||||
LogInfo( ( "_cellular_UrcProcessUupsmr: PSM_MODE_ENTER event received" ) );
|
||||
/* Call the callback function. Indicate the upper layer about the PSM state change. */
|
||||
_Cellular_ModemEventCallback( pContext, CELLULAR_MODEM_EVENT_PSM_ENTER );
|
||||
break;
|
||||
|
||||
case PSM_MODE_PREVENT_ENTRY:
|
||||
LogInfo( ( "_cellular_UrcProcessUupsmr: PSM_MODE_PREVENT_ENTRY" ) );
|
||||
break;
|
||||
|
||||
case PSM_MODE_PREVENT_DEEP_ENTRY:
|
||||
LogInfo( ( "_cellular_UrcProcessUupsmr: PSM_MODE_PREVENT_DEEP_ENTRY" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "_cellular_UrcProcessUupsmr: parsing <state> failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessUusoco( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
char * pLocalInputLine = pInputLine;
|
||||
char * pToken = NULL;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
uint8_t sessionId = 0;
|
||||
uint8_t socketError = 0;
|
||||
uint32_t socketIndex = 0;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( ( pContext != NULL ) && ( pInputLine != NULL ) )
|
||||
{
|
||||
/* The inputline is in this format +UUSOCO: <socket>,<socket_error>
|
||||
* socket_error = 0 : no error, others : error. */
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputLine, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= MIN_TCP_SESSION_ID ) && ( tempValue <= MAX_TCP_SESSION_ID ) )
|
||||
{
|
||||
sessionId = ( uint8_t ) tempValue;
|
||||
socketIndex = _Cellular_GetSocketId( pContext, sessionId );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "parsing _cellular_UrcProcessKtcpInd session ID failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputLine, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= 0 ) && ( tempValue <= UINT8_MAX ) )
|
||||
{
|
||||
socketError = ( uint8_t ) tempValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "parsing _cellular_UrcProcessUusoco socket error failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Call the callback function of this session. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, socketIndex );
|
||||
|
||||
if( pSocketData == NULL )
|
||||
{
|
||||
LogError( ( "_cellular_UrcProcessUusoco : invalid socket index %u", socketIndex ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( socketError == 0 )
|
||||
{
|
||||
pSocketData->socketState = SOCKETSTATE_CONNECTED;
|
||||
LogDebug( ( "Notify session %d with socket opened\r\n", sessionId ) );
|
||||
|
||||
if( pSocketData->openCallback != NULL )
|
||||
{
|
||||
pSocketData->openCallback( CELLULAR_URC_SOCKET_OPENED,
|
||||
pSocketData, pSocketData->pOpenCallbackContext );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pSocketData->openCallback != NULL )
|
||||
{
|
||||
pSocketData->openCallback( CELLULAR_URC_SOCKET_OPEN_FAILED,
|
||||
pSocketData, pSocketData->pOpenCallbackContext );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessUusord( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
char * pLocalInputLine = pInputLine;
|
||||
char * pToken = NULL;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
uint8_t sessionId = 0;
|
||||
uint32_t socketIndex = 0;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( ( pContext != NULL ) && ( pInputLine != NULL ) )
|
||||
{
|
||||
/* The inputline is in this format +UUSOCO: <socket>,<data_length> */
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputLine, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= MIN_TCP_SESSION_ID ) && ( tempValue <= MAX_TCP_SESSION_ID ) )
|
||||
{
|
||||
sessionId = ( uint8_t ) tempValue;
|
||||
socketIndex = _Cellular_GetSocketId( pContext, sessionId );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "parsing _cellular_UrcProcessUusord session ID failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip data length. */
|
||||
|
||||
/* Call the callback function of this session. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( socketIndex == INVALID_SOCKET_INDEX )
|
||||
{
|
||||
LogWarn( ( "_cellular_UrcProcessUusord : unknown session data received. "
|
||||
"The session %u may not be closed properly in previous execution.", sessionId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, socketIndex );
|
||||
|
||||
if( pSocketData == NULL )
|
||||
{
|
||||
LogError( ( "_cellular_UrcProcessUusord : invalid socket index %d", socketIndex ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Indicate the upper layer about the data reception. */
|
||||
if( pSocketData->dataReadyCallback != NULL )
|
||||
{
|
||||
pSocketData->dataReadyCallback( pSocketData, pSocketData->pDataReadyCallbackContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_cellular_UrcProcessUusord: Data ready callback not set!!" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _cellular_UrcProcessUusocl( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
char * pLocalInputLine = pInputLine;
|
||||
char * pToken = NULL;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
uint8_t sessionId = 0;
|
||||
uint32_t socketIndex = 0;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( ( pContext != NULL ) && ( pInputLine != NULL ) )
|
||||
{
|
||||
/* The inputline is in this format +UUSOCL: <socket> */
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputLine, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= MIN_TCP_SESSION_ID ) && ( tempValue <= MAX_TCP_SESSION_ID ) )
|
||||
{
|
||||
sessionId = ( uint8_t ) tempValue;
|
||||
socketIndex = _Cellular_GetSocketId( pContext, sessionId );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( "parsing _cellular_UrcProcessUusocl session ID failed" ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Call the callback function of this session. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( socketIndex == INVALID_SOCKET_INDEX )
|
||||
{
|
||||
LogWarn( ( "_cellular_UrcProcessUusocl : unknown session closed URC received. "
|
||||
"The session %u may not be closed properly in previous execution.", sessionId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, socketIndex );
|
||||
|
||||
if( pSocketData == NULL )
|
||||
{
|
||||
LogError( ( "_cellular_UrcProcessUusocl : invalid socket index %d", socketIndex ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Change the socket state to disconnected. */
|
||||
pSocketData->socketState = SOCKETSTATE_DISCONNECTED;
|
||||
|
||||
/* Indicate the upper layer about the data reception. */
|
||||
if( pSocketData->closedCallback != NULL )
|
||||
{
|
||||
pSocketData->closedCallback( pSocketData, pSocketData->pClosedCallbackContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_cellular_UrcProcessUusord: Data ready callback not set!!" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Modem bootup indication. */
|
||||
|
||||
static void _Cellular_ProcessModemRdy( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
/* The token is the pInputLine. No need to process the pInputLine. */
|
||||
( void ) pInputLine;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
LogWarn( ( "_Cellular_ProcessModemRdy: Context not set" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_Cellular_ProcessModemRdy: Modem Ready event received" ) );
|
||||
_Cellular_ModemEventCallback( pContext, CELLULAR_MODEM_EVENT_BOOTUP_OR_REBOOT );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _Cellular_UrcProcessCereg( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
( void ) Cellular_CommonUrcProcessCereg( pContext, pInputLine );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _Cellular_UrcProcessCgreg( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
( void ) Cellular_CommonUrcProcessCgreg( pContext, pInputLine );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _Cellular_UrcProcessCreg( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
( void ) Cellular_CommonUrcProcessCreg( pContext, pInputLine );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@ -0,0 +1,263 @@
|
||||
/*
|
||||
* FreeRTOS-Cellular-Interface v1.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*/
|
||||
|
||||
/* The config header is always included first. */
|
||||
#include "cellular_config.h"
|
||||
#include "cellular_config_defaults.h"
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cellular_platform.h"
|
||||
#include "cellular_types.h"
|
||||
#include "cellular_api.h"
|
||||
#include "cellular_common.h"
|
||||
#include "cellular_common_api.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_Cleanup( CellularHandle_t cellularHandle )
|
||||
{
|
||||
return Cellular_CommonCleanup( cellularHandle );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RegisterUrcNetworkRegistrationEventCallback( CellularHandle_t cellularHandle,
|
||||
CellularUrcNetworkRegistrationCallback_t networkRegistrationCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonRegisterUrcNetworkRegistrationEventCallback( cellularHandle, networkRegistrationCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RegisterUrcPdnEventCallback( CellularHandle_t cellularHandle,
|
||||
CellularUrcPdnEventCallback_t pdnEventCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonRegisterUrcPdnEventCallback( cellularHandle, pdnEventCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RegisterUrcGenericCallback( CellularHandle_t cellularHandle,
|
||||
CellularUrcGenericCallback_t genericCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonRegisterUrcGenericCallback( cellularHandle, genericCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RegisterModemEventCallback( CellularHandle_t cellularHandle,
|
||||
CellularModemEventCallback_t modemEventCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonRegisterModemEventCallback( cellularHandle, modemEventCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_ATCommandRaw( CellularHandle_t cellularHandle,
|
||||
const char * pATCommandPrefix,
|
||||
const char * pATCommandPayload,
|
||||
CellularATCommandType_t atCommandType,
|
||||
CellularATCommandResponseReceivedCallback_t responseReceivedCallback,
|
||||
void * pData,
|
||||
uint16_t dataLen )
|
||||
{
|
||||
return Cellular_CommonATCommandRaw( cellularHandle, pATCommandPrefix, pATCommandPayload, atCommandType,
|
||||
responseReceivedCallback, pData, dataLen );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_CreateSocket( CellularHandle_t cellularHandle,
|
||||
uint8_t pdnContextId,
|
||||
CellularSocketDomain_t socketDomain,
|
||||
CellularSocketType_t socketType,
|
||||
CellularSocketProtocol_t socketProtocol,
|
||||
CellularSocketHandle_t * pSocketHandle )
|
||||
{
|
||||
return Cellular_CommonCreateSocket( cellularHandle, pdnContextId, socketDomain, socketType,
|
||||
socketProtocol, pSocketHandle );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_SocketRegisterDataReadyCallback( CellularHandle_t cellularHandle,
|
||||
CellularSocketHandle_t socketHandle,
|
||||
CellularSocketDataReadyCallback_t dataReadyCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonSocketRegisterDataReadyCallback( cellularHandle, socketHandle,
|
||||
dataReadyCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_SocketRegisterSocketOpenCallback( CellularHandle_t cellularHandle,
|
||||
CellularSocketHandle_t socketHandle,
|
||||
CellularSocketOpenCallback_t socketOpenCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonSocketRegisterSocketOpenCallback( cellularHandle, socketHandle,
|
||||
socketOpenCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_SocketRegisterClosedCallback( CellularHandle_t cellularHandle,
|
||||
CellularSocketHandle_t socketHandle,
|
||||
CellularSocketClosedCallback_t closedCallback,
|
||||
void * pCallbackContext )
|
||||
{
|
||||
return Cellular_CommonSocketRegisterClosedCallback( cellularHandle, socketHandle,
|
||||
closedCallback, pCallbackContext );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RfOn( CellularHandle_t cellularHandle )
|
||||
{
|
||||
return Cellular_CommonRfOn( cellularHandle );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_RfOff( CellularHandle_t cellularHandle )
|
||||
{
|
||||
return Cellular_CommonRfOff( cellularHandle );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetIPAddress( CellularHandle_t cellularHandle,
|
||||
uint8_t contextId,
|
||||
char * pBuffer,
|
||||
uint32_t bufferLength )
|
||||
{
|
||||
return Cellular_CommonGetIPAddress( cellularHandle, contextId, pBuffer, bufferLength );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetModemInfo( CellularHandle_t cellularHandle,
|
||||
CellularModemInfo_t * pModemInfo )
|
||||
{
|
||||
return Cellular_CommonGetModemInfo( cellularHandle, pModemInfo );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetRegisteredNetwork( CellularHandle_t cellularHandle,
|
||||
CellularPlmnInfo_t * pNetworkInfo )
|
||||
{
|
||||
return Cellular_CommonGetRegisteredNetwork( cellularHandle, pNetworkInfo );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetNetworkTime( CellularHandle_t cellularHandle,
|
||||
CellularTime_t * pNetworkTime )
|
||||
{
|
||||
return Cellular_CommonGetNetworkTime( cellularHandle, pNetworkTime );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetServiceStatus( CellularHandle_t cellularHandle,
|
||||
CellularServiceStatus_t * pServiceStatus )
|
||||
{
|
||||
return Cellular_CommonGetServiceStatus( cellularHandle, pServiceStatus );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetSimCardInfo( CellularHandle_t cellularHandle,
|
||||
CellularSimCardInfo_t * pSimCardInfo )
|
||||
{
|
||||
return Cellular_CommonGetSimCardInfo( cellularHandle, pSimCardInfo );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetPsmSettings( CellularHandle_t cellularHandle,
|
||||
CellularPsmSettings_t * pPsmSettings )
|
||||
{
|
||||
return Cellular_CommonGetPsmSettings( cellularHandle, pPsmSettings );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_GetEidrxSettings( CellularHandle_t cellularHandle,
|
||||
CellularEidrxSettingsList_t * pEidrxSettingsList )
|
||||
{
|
||||
return Cellular_CommonGetEidrxSettings( cellularHandle, pEidrxSettingsList );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
Reference in New Issue
Block a user