[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
## Code of Conduct
|
||||
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
|
||||
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
|
||||
opensource-codeofconduct@amazon.com with any additional questions or comments.
|
||||
@ -0,0 +1,59 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
|
||||
documentation, we greatly value feedback and contributions from our community.
|
||||
|
||||
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
|
||||
information to effectively respond to your bug report or contribution.
|
||||
|
||||
|
||||
## Reporting Bugs/Feature Requests
|
||||
|
||||
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
|
||||
|
||||
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
|
||||
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
|
||||
|
||||
* A reproducible test case or series of steps
|
||||
* The version of our code being used
|
||||
* Any modifications you've made relevant to the bug
|
||||
* Anything unusual about your environment or deployment
|
||||
|
||||
|
||||
## Contributing via Pull Requests
|
||||
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
|
||||
|
||||
1. You are working against the latest source on the *main* branch.
|
||||
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
|
||||
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
|
||||
|
||||
To send us a pull request, please:
|
||||
|
||||
1. Fork the repository.
|
||||
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
|
||||
3. Ensure local tests pass.
|
||||
4. Commit to your fork using clear commit messages.
|
||||
5. Send us a pull request, answering any default questions in the pull request interface.
|
||||
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
|
||||
|
||||
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
|
||||
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
|
||||
|
||||
|
||||
## Finding contributions to work on
|
||||
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
|
||||
|
||||
|
||||
## Code of Conduct
|
||||
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
|
||||
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
|
||||
opensource-codeofconduct@amazon.com with any additional questions or comments.
|
||||
|
||||
|
||||
## Security issue notifications
|
||||
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
|
||||
|
||||
|
||||
## Licensing
|
||||
|
||||
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
|
||||
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Amazon.com, Inc. or its affiliates
|
||||
|
||||
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.
|
||||
@ -0,0 +1,21 @@
|
||||
# FreeRTOS Cellular Interface Reference Quectel BG96
|
||||
|
||||
## Introduction
|
||||
|
||||
This repository provides the reference implementation as cellular module ports for [Quectel BG96](https://www.quectel.com/product/lte-bg96-cat-m1-nb1-egprs/). This repository should be used with [FreeRTOS-Cellular-Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface). See [FreeRTOS-Cellular-Interface README](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/README.md) for more details.
|
||||
|
||||
## Use Case
|
||||
|
||||
There is also an use case at [MQTT_Mutual_Auth_Demo_with_BG96](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96) as a demonstration to run BG96 with FreeRTOS Windows Simulator.
|
||||
|
||||
## How Does Community Members to Contribute a Cellular Module Port
|
||||
|
||||
We provide a repository, [FreeRTOS-Cellular-Interface-Community-Supported-Ports](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Community-Supported-Ports), for community members to contribute their modules. See [How to Contribute a Cellular Module Port](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Community-Supported-Ports#how-to-contribute-a-cellular-module-port) for more details.
|
||||
|
||||
## Security
|
||||
|
||||
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
|
||||
|
||||
## License
|
||||
|
||||
The FreeRTOS Cellular Interface library is distributed under MIT open source license. The code in this repository is licensed under the MIT License. See the [LICENSE](LICENSE) file.
|
||||
@ -0,0 +1,358 @@
|
||||
/*
|
||||
* 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 <stdint.h>
|
||||
#include "cellular_platform.h"
|
||||
#include "cellular_config.h"
|
||||
#include "cellular_config_defaults.h"
|
||||
#include "cellular_common.h"
|
||||
#include "cellular_common_portable.h"
|
||||
#include "cellular_bg96.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define ENBABLE_MODULE_UE_RETRY_COUNT ( 3U )
|
||||
#define ENBABLE_MODULE_UE_RETRY_TIMEOUT ( 5000U )
|
||||
#define BG96_NWSCANSEQ_CMD_MAX_SIZE ( 29U ) /* The length of AT+QCFG="nwscanseq",020301,1\0. */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularError_t sendAtCommandWithRetryTimeout( CellularContext_t * pContext,
|
||||
const CellularAtReq_t * pAtReq );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static cellularModuleContext_t cellularBg96Context = { 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", "CONNECT", "SEND 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[] =
|
||||
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "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;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static bool appendRatList( char * pRatList,
|
||||
CellularRat_t cellularRat )
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
/* Configure RAT Searching Sequence to default radio access technology. */
|
||||
switch( cellularRat )
|
||||
{
|
||||
case CELLULAR_RAT_CATM1:
|
||||
strcat( pRatList, "02" );
|
||||
break;
|
||||
|
||||
case CELLULAR_RAT_NBIOT:
|
||||
strcat( pRatList, "03" );
|
||||
break;
|
||||
|
||||
case CELLULAR_RAT_GSM:
|
||||
strcat( pRatList, "01" );
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Configure RAT Searching Sequence to automatic. */
|
||||
retValue = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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;
|
||||
bool status = false;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_INVALID_HANDLE;
|
||||
}
|
||||
else if( ppModuleContext == NULL )
|
||||
{
|
||||
cellularStatus = CELLULAR_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize the module context. */
|
||||
( void ) memset( &cellularBg96Context, 0, sizeof( cellularModuleContext_t ) );
|
||||
|
||||
/* Create the mutex for DNS. */
|
||||
status = PlatformMutex_Create( &cellularBg96Context.dnsQueryMutex, false );
|
||||
|
||||
if( status == false )
|
||||
{
|
||||
cellularStatus = CELLULAR_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create the queue for DNS. */
|
||||
cellularBg96Context.pktDnsQueue = xQueueCreate( 1, sizeof( cellularDnsQueryResult_t ) );
|
||||
|
||||
if( cellularBg96Context.pktDnsQueue == NULL )
|
||||
{
|
||||
PlatformMutex_Destroy( &cellularBg96Context.dnsQueryMutex );
|
||||
cellularStatus = CELLULAR_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppModuleContext = ( void * ) &cellularBg96Context;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Delete DNS queue. */
|
||||
vQueueDelete( cellularBg96Context.pktDnsQueue );
|
||||
|
||||
/* Delete the mutex for DNS. */
|
||||
PlatformMutex_Destroy( &cellularBg96Context.dnsQueryMutex );
|
||||
}
|
||||
|
||||
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_MULTI_WO_PREFIX,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
char ratSelectCmd[ BG96_NWSCANSEQ_CMD_MAX_SIZE ] = "AT+QCFG=\"nwscanseq\",";
|
||||
bool retAppendRat = true;
|
||||
|
||||
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 )
|
||||
{
|
||||
/* Setting URC output port. */
|
||||
#if defined( CELLULAR_BG96_URC_PORT_USBAT ) || defined( BG96_URC_PORT_USBAT )
|
||||
atReqGetNoResult.pAtCmd = "AT+QURCCFG=\"urcport\",\"usbat\"";
|
||||
#else
|
||||
atReqGetNoResult.pAtCmd = "AT+QURCCFG=\"urcport\",\"uart1\"";
|
||||
#endif
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Configure Band configuration to all bands. */
|
||||
atReqGetNoResult.pAtCmd = "AT+QCFG=\"band\",f,400a0e189f,a0e189f";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Configure RAT(s) to be Searched to Automatic. */
|
||||
atReqGetNoResult.pAtCmd = "AT+QCFG=\"nwscanmode\",0,1";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
/* Configure Network Category to be Searched under LTE RAT to LTE Cat M1 and Cat NB1. */
|
||||
atReqGetNoResult.pAtCmd = "AT+QCFG=\"iotopmode\",2,1";
|
||||
cellularStatus = sendAtCommandWithRetryTimeout( pContext, &atReqGetNoResult );
|
||||
}
|
||||
|
||||
if( cellularStatus == CELLULAR_SUCCESS )
|
||||
{
|
||||
retAppendRat = appendRatList( ratSelectCmd, CELLULAR_CONFIG_DEFAULT_RAT );
|
||||
configASSERT( retAppendRat == true );
|
||||
|
||||
#ifdef CELLULAR_CONFIG_DEFAULT_RAT_2
|
||||
retAppendRat = appendRatList( ratSelectCmd, CELLULAR_CONFIG_DEFAULT_RAT_2 );
|
||||
configASSERT( retAppendRat == true );
|
||||
#endif
|
||||
|
||||
#ifdef CELLULAR_CONFIG_DEFAULT_RAT_3
|
||||
retAppendRat = appendRatList( ratSelectCmd, CELLULAR_CONFIG_DEFAULT_RAT_3 );
|
||||
configASSERT( retAppendRat == true );
|
||||
#endif
|
||||
|
||||
strcat( ratSelectCmd, ",1" ); /* Take effect immediately. */
|
||||
atReqGetNoResult.pAtCmd = ratSelectCmd;
|
||||
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 );
|
||||
|
||||
return cellularStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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_BG96_H__
|
||||
#define __CELLULAR_BG96_H__
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* AT Command timeout for PDN activation */
|
||||
#define PDN_ACTIVATION_PACKET_REQ_TIMEOUT_MS ( 150000UL )
|
||||
|
||||
/* AT Command timeout for PDN deactivation. */
|
||||
#define PDN_DEACTIVATION_PACKET_REQ_TIMEOUT_MS ( 40000UL )
|
||||
|
||||
/* AT Command timeout for Socket connection */
|
||||
#define SOCKET_CONNECT_PACKET_REQ_TIMEOUT_MS ( 150000UL )
|
||||
|
||||
#define PACKET_REQ_TIMEOUT_MS ( 5000UL )
|
||||
|
||||
/* AT Command timeout for Socket disconnection */
|
||||
#define SOCKET_DISCONNECT_PACKET_REQ_TIMEOUT_MS ( 12000UL )
|
||||
|
||||
#define DATA_SEND_TIMEOUT_MS ( 50000UL )
|
||||
#define DATA_READ_TIMEOUT_MS ( 50000UL )
|
||||
|
||||
/**
|
||||
* @brief DNS query result.
|
||||
*/
|
||||
typedef enum cellularDnsQueryResult
|
||||
{
|
||||
CELLULAR_DNS_QUERY_SUCCESS,
|
||||
CELLULAR_DNS_QUERY_FAILED,
|
||||
CELLULAR_DNS_QUERY_MAX,
|
||||
CELLULAR_DNS_QUERY_UNKNOWN
|
||||
} cellularDnsQueryResult_t;
|
||||
|
||||
typedef struct cellularModuleContext cellularModuleContext_t;
|
||||
|
||||
/**
|
||||
* @brief DNS query URC callback fucntion.
|
||||
*/
|
||||
typedef void ( * CellularDnsResultEventCallback_t )( cellularModuleContext_t * pModuleContext,
|
||||
char * pDnsResult,
|
||||
char * pDnsUsrData );
|
||||
|
||||
typedef struct cellularModuleContext
|
||||
{
|
||||
/* DNS related variables. */
|
||||
PlatformMutex_t dnsQueryMutex; /* DNS query mutex to protect the following data. */
|
||||
QueueHandle_t pktDnsQueue; /* DNS queue to receive the DNS query result. */
|
||||
uint8_t dnsResultNumber; /* DNS query result number. */
|
||||
uint8_t dnsIndex; /* DNS query current index. */
|
||||
char * pDnsUsrData; /* DNS user data to store the result. */
|
||||
CellularDnsResultEventCallback_t dnsEventCallback;
|
||||
/* Forward declaration to declar the callback function prototype. */
|
||||
/* coverity[misra_c_2012_rule_1_1_violation]. */
|
||||
} cellularModuleContext_t;
|
||||
|
||||
CellularPktStatus_t _Cellular_ParseSimstat( char * pInputStr,
|
||||
CellularSimCardState_t * pSimState );
|
||||
|
||||
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_BG96_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,807 @@
|
||||
/*
|
||||
* 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"
|
||||
#include "cellular_bg96.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _Cellular_ProcessPowerDown( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessPsmPowerDown( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessModemRdy( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessSocketOpen( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessSocketurc( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessSimstat( CellularContext_t * pContext,
|
||||
char * pInputLine );
|
||||
static void _Cellular_ProcessIndication( 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_CommonUrcProcessCereg },
|
||||
{ "CGREG", Cellular_CommonUrcProcessCgreg },
|
||||
{ "CREG", Cellular_CommonUrcProcessCreg },
|
||||
{ "NORMAL POWER DOWN", _Cellular_ProcessPowerDown },
|
||||
{ "PSM POWER DOWN", _Cellular_ProcessPsmPowerDown },
|
||||
{ "QIND", _Cellular_ProcessIndication },
|
||||
{ "QIOPEN", _Cellular_ProcessSocketOpen },
|
||||
{ "QIURC", _Cellular_ProcessSocketurc },
|
||||
{ "QSIMSTAT", _Cellular_ProcessSimstat },
|
||||
{ "RDY", _Cellular_ProcessModemRdy }
|
||||
};
|
||||
|
||||
/* FreeRTOS Cellular Common Library porting interface. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
uint32_t CellularUrcHandlerTableSize = sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* internal function of _parseSocketOpen to reduce complexity. */
|
||||
static CellularPktStatus_t _parseSocketOpenNextTok( const char * pToken,
|
||||
uint32_t sockIndex,
|
||||
CellularSocketContext_t * pSocketData )
|
||||
{
|
||||
int32_t sockStatus = 0;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &sockStatus );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( sockStatus != 0 )
|
||||
{
|
||||
pSocketData->socketState = SOCKETSTATE_DISCONNECTED;
|
||||
LogError( ( "_parseSocketOpen: Socket open failed, conn %d, status %d", sockIndex, sockStatus ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSocketData->socketState = SOCKETSTATE_CONNECTED;
|
||||
LogDebug( ( "_parseSocketOpen: Socket open success, conn %d", sockIndex ) );
|
||||
}
|
||||
|
||||
/* Indicate the upper layer about the socket open status. */
|
||||
if( pSocketData->openCallback != NULL )
|
||||
{
|
||||
if( sockStatus != 0 )
|
||||
{
|
||||
pSocketData->openCallback( CELLULAR_URC_SOCKET_OPEN_FAILED,
|
||||
pSocketData, pSocketData->pOpenCallbackContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSocketData->openCallback( CELLULAR_URC_SOCKET_OPENED,
|
||||
pSocketData, pSocketData->pOpenCallbackContext );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "_parseSocketOpen: Socket open callback for conn %d is not set!!", sockIndex ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessSocketOpen( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
char * pUrcStr = NULL, * pToken = NULL;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
uint32_t sockIndex = 0;
|
||||
int32_t tempValue = 0;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_FAILURE;
|
||||
}
|
||||
else if( pInputLine == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
pUrcStr = pInputLine;
|
||||
atCoreStatus = Cellular_ATRemoveAllWhiteSpaces( pUrcStr );
|
||||
|
||||
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 >= 0 ) &&
|
||||
( tempValue < ( int32_t ) CELLULAR_NUM_SOCKET_MAX ) )
|
||||
{
|
||||
sockIndex = ( uint32_t ) tempValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "Error processing in Socket index. token %s", pToken ) ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, sockIndex );
|
||||
|
||||
if( pSocketData != NULL )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pUrcStr, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _parseSocketOpenNextTok( pToken, sockIndex, pSocketData );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
}
|
||||
|
||||
if( pktStatus != CELLULAR_PKT_STATUS_OK )
|
||||
{
|
||||
LogDebug( ( "Socket Open URC Parse failure" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularPktStatus_t _parseUrcIndicationCsq( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
char * pToken = NULL;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
int32_t retStrtoi = 0;
|
||||
int16_t csqRssi = CELLULAR_INVALID_SIGNAL_VALUE, csqBer = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
CellularSignalInfo_t signalInfo = { 0 };
|
||||
char * pLocalUrcStr = pUrcStr;
|
||||
|
||||
if( ( pContext == NULL ) || ( pUrcStr == NULL ) )
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Parse the RSSI index from string and convert it. */
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalUrcStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &retStrtoi );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( retStrtoi >= INT16_MIN ) && ( retStrtoi <= ( int32_t ) INT16_MAX ) )
|
||||
{
|
||||
cellularStatus = _Cellular_ConvertCsqSignalRssi( ( int16_t ) retStrtoi, &csqRssi );
|
||||
|
||||
if( cellularStatus != CELLULAR_SUCCESS )
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_BAD_PARAMETER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the BER index from string and convert it. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalUrcStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &retStrtoi );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( retStrtoi >= INT16_MIN ) &&
|
||||
( retStrtoi <= ( int32_t ) INT16_MAX ) )
|
||||
{
|
||||
cellularStatus = _Cellular_ConvertCsqSignalBer( ( int16_t ) retStrtoi, &csqBer );
|
||||
|
||||
if( cellularStatus != CELLULAR_SUCCESS )
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_BAD_PARAMETER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle the callback function. */
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
signalInfo.rssi = csqRssi;
|
||||
signalInfo.rsrp = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.rsrq = CELLULAR_INVALID_SIGNAL_VALUE;
|
||||
signalInfo.ber = csqBer;
|
||||
signalInfo.bars = CELLULAR_INVALID_SIGNAL_BAR_VALUE;
|
||||
_Cellular_SignalStrengthChangedCallback( pContext, CELLULAR_URC_EVENT_SIGNAL_CHANGED, &signalInfo );
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessIndication( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
char * pUrcStr = NULL, * pToken = NULL;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
|
||||
/* 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 );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pUrcStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( strstr( pToken, "csq" ) != NULL )
|
||||
{
|
||||
pktStatus = _parseUrcIndicationCsq( ( const CellularContext_t * ) pContext, pUrcStr );
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
}
|
||||
|
||||
if( pktStatus != CELLULAR_PKT_STATUS_OK )
|
||||
{
|
||||
LogDebug( ( "UrcIndication Parse failure" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void _informDataReadyToUpperLayer( CellularSocketContext_t * pSocketData )
|
||||
{
|
||||
/* Indicate the upper layer about the data reception. */
|
||||
if( ( pSocketData != NULL ) && ( pSocketData->dataReadyCallback != NULL ) )
|
||||
{
|
||||
pSocketData->dataReadyCallback( pSocketData, pSocketData->pDataReadyCallbackContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "_parseSocketUrc: Data ready callback not set!!" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularPktStatus_t _parseSocketUrcRecv( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
char * pToken = NULL;
|
||||
char * pLocalUrcStr = pUrcStr;
|
||||
int32_t tempValue = 0;
|
||||
uint32_t sockIndex = 0;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalUrcStr, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= 0 ) && ( tempValue < ( int32_t ) CELLULAR_NUM_SOCKET_MAX ) )
|
||||
{
|
||||
sockIndex = ( uint32_t ) tempValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "Error in processing SockIndex. Token %s", pToken ) ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, sockIndex );
|
||||
|
||||
if( pSocketData != NULL )
|
||||
{
|
||||
if( pSocketData->dataMode == CELLULAR_ACCESSMODE_BUFFER )
|
||||
{
|
||||
/* Data received indication in buffer mode, need to fetch the data. */
|
||||
LogDebug( ( "Data Received on socket Conn Id %d", sockIndex ) );
|
||||
_informDataReadyToUpperLayer( pSocketData );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularPktStatus_t _parseSocketUrcClosed( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
char * pToken = NULL;
|
||||
char * pLocalUrcStr = pUrcStr;
|
||||
int32_t tempValue = 0;
|
||||
uint32_t sockIndex = 0;
|
||||
CellularSocketContext_t * pSocketData = NULL;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalUrcStr, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( tempValue < ( int32_t ) CELLULAR_NUM_SOCKET_MAX )
|
||||
{
|
||||
sockIndex = ( uint32_t ) tempValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "Error in processing Socket Index. Token %s", pToken ) ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pSocketData = _Cellular_GetSocketData( pContext, sockIndex );
|
||||
|
||||
if( pSocketData != NULL )
|
||||
{
|
||||
pSocketData->socketState = SOCKETSTATE_DISCONNECTED;
|
||||
LogDebug( ( "Socket closed. Conn Id %d", sockIndex ) );
|
||||
|
||||
/* Indicate the upper layer about the socket close. */
|
||||
if( pSocketData->closedCallback != NULL )
|
||||
{
|
||||
pSocketData->closedCallback( pSocketData, pSocketData->pClosedCallbackContext );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo( ( "_parseSocketUrc: Socket close callback not set!!" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularPktStatus_t _parseSocketUrcAct( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
int32_t tempValue = 0;
|
||||
char * pToken = NULL;
|
||||
char * pLocalUrcStr = pUrcStr;
|
||||
uint8_t contextId = 0;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalUrcStr, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( ( tempValue >= ( int32_t ) CELLULAR_PDN_CONTEXT_ID_MIN ) &&
|
||||
( tempValue <= ( int32_t ) CELLULAR_PDN_CONTEXT_ID_MAX ) ) )
|
||||
{
|
||||
contextId = ( uint8_t ) tempValue;
|
||||
|
||||
if( _Cellular_IsValidPdn( contextId ) == CELLULAR_SUCCESS )
|
||||
{
|
||||
LogDebug( ( "PDN deactivated. Context Id %d", contextId ) );
|
||||
/* Indicate the upper layer about the PDN deactivate. */
|
||||
_Cellular_PdnEventCallback( pContext, CELLULAR_URC_EVENT_PDN_DEACTIVATED, contextId );
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
LogError( ( ( "Error in processing Context Id. Token %s", pToken ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CellularPktStatus_t _parseSocketUrcDns( const CellularContext_t * pContext,
|
||||
char * pUrcStr )
|
||||
{
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
cellularModuleContext_t * pModuleContext = NULL;
|
||||
CellularError_t cellularStatus = CELLULAR_SUCCESS;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
else if( pUrcStr == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellularStatus = _Cellular_GetModuleContext( pContext, ( void ** ) &pModuleContext );
|
||||
|
||||
if( cellularStatus != CELLULAR_SUCCESS )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
if( pktStatus == CELLULAR_PKT_STATUS_OK )
|
||||
{
|
||||
if( pModuleContext->dnsEventCallback != NULL )
|
||||
{
|
||||
pModuleContext->dnsEventCallback( pModuleContext, pUrcStr, pModuleContext->pDnsUsrData );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_parseSocketUrcDns: spurious DNS response!!" ) );
|
||||
pktStatus = CELLULAR_PKT_STATUS_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessSocketurc( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
char * pUrcStr = NULL, * pToken = NULL;
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
pktStatus = CELLULAR_PKT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pUrcStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
/* Check if this is a data receive indication. */
|
||||
|
||||
/* this whole if as a function and return pktstatus
|
||||
* take iotat_getnexttok inside
|
||||
* convert atcore status to pktstatus. */
|
||||
if( strstr( pToken, "recv" ) != NULL )
|
||||
{
|
||||
pktStatus = _parseSocketUrcRecv( pContext, pUrcStr );
|
||||
}
|
||||
else if( strcmp( pToken, "closed" ) == 0 )
|
||||
{
|
||||
pktStatus = _parseSocketUrcClosed( pContext, pUrcStr );
|
||||
}
|
||||
else if( strcmp( pToken, "pdpdeact" ) == 0 )
|
||||
{
|
||||
pktStatus = _parseSocketUrcAct( pContext, pUrcStr );
|
||||
}
|
||||
else if( strcmp( pToken, "dnsgip" ) == 0 )
|
||||
{
|
||||
pktStatus = _parseSocketUrcDns( pContext, pUrcStr );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Empty else MISRA 15.7 */
|
||||
}
|
||||
}
|
||||
|
||||
if( atCoreStatus != CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
}
|
||||
|
||||
if( pktStatus != CELLULAR_PKT_STATUS_OK )
|
||||
{
|
||||
LogDebug( ( "Socketurc Parse failure" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessSimstat( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
CellularSimCardState_t simCardState = CELLULAR_SIM_CARD_UNKNOWN;
|
||||
|
||||
if( pContext != NULL )
|
||||
{
|
||||
( void ) _Cellular_ParseSimstat( pInputLine, &simCardState );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessPowerDown( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
/* The token is the pInputLine. No need to process the pInputLine. */
|
||||
( void ) pInputLine;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
LogError( ( ( "_Cellular_ProcessPowerDown: Context not set" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_Cellular_ProcessPowerDown: Modem Power down event received" ) );
|
||||
_Cellular_ModemEventCallback( pContext, CELLULAR_MODEM_EVENT_POWERED_DOWN );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
static void _Cellular_ProcessPsmPowerDown( CellularContext_t * pContext,
|
||||
char * pInputLine )
|
||||
{
|
||||
/* The token is the pInputLine. No need to process the pInputLine. */
|
||||
( void ) pInputLine;
|
||||
|
||||
if( pContext == NULL )
|
||||
{
|
||||
LogError( ( ( "_Cellular_ProcessPowerDown: Context not set" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug( ( "_Cellular_ProcessPsmPowerDown: Modem PSM power down event received" ) );
|
||||
_Cellular_ModemEventCallback( pContext, CELLULAR_MODEM_EVENT_PSM_ENTER );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Cellular common prototype. */
|
||||
/* coverity[misra_c_2012_rule_8_13_violation] */
|
||||
CellularPktStatus_t _Cellular_ParseSimstat( char * pInputStr,
|
||||
CellularSimCardState_t * pSimState )
|
||||
{
|
||||
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
|
||||
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
|
||||
char * pToken = NULL;
|
||||
char * pLocalInputStr = pInputStr;
|
||||
int32_t tempValue = 0;
|
||||
|
||||
if( ( pInputStr == NULL ) || ( strlen( pInputStr ) == 0U ) ||
|
||||
( strlen( pInputStr ) < 2U ) || ( pSimState == NULL ) )
|
||||
{
|
||||
LogError( ( ( "_Cellular_ProcessQsimstat Input data is invalid %s", pInputStr ) ) );
|
||||
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputStr, &pToken );
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
LogDebug( ( "QSIMSTAT URC Enable: %s", pToken ) );
|
||||
atCoreStatus = Cellular_ATGetNextTok( &pLocalInputStr, &pToken );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
LogDebug( ( " Sim insert status: %s", pToken ) );
|
||||
atCoreStatus = Cellular_ATStrtoi( pToken, 10, &tempValue );
|
||||
}
|
||||
|
||||
if( atCoreStatus == CELLULAR_AT_SUCCESS )
|
||||
{
|
||||
if( ( tempValue >= 0 ) &&
|
||||
( tempValue < ( int32_t ) CELLULAR_SIM_CARD_STATUS_MAX ) )
|
||||
{
|
||||
/* Variable "tempValue" is ensured that it is valid and within
|
||||
* a valid range. Hence, assigning the value at the pointer of
|
||||
* type cellular_SimCardState_t with an enum cast. */
|
||||
/* coverity[misra_c_2012_rule_10_5_violation] */
|
||||
*pSimState = ( CellularSimCardState_t ) tempValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError( ( ( "Error in processing SIM state. token %s", pToken ) ) );
|
||||
atCoreStatus = CELLULAR_AT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
|
||||
}
|
||||
|
||||
return pktStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@ -0,0 +1,268 @@
|
||||
/*
|
||||
* 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_SocketSetSockOpt( CellularHandle_t cellularHandle,
|
||||
CellularSocketHandle_t socketHandle,
|
||||
CellularSocketOptionLevel_t optionLevel,
|
||||
CellularSocketOption_t option,
|
||||
const uint8_t * pOptionValue,
|
||||
uint32_t optionValueLength )
|
||||
{
|
||||
return Cellular_CommonSocketSetSockOpt( cellularHandle, socketHandle, optionLevel, option,
|
||||
pOptionValue, optionValueLength );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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_GetEidrxSettings( CellularHandle_t cellularHandle,
|
||||
CellularEidrxSettingsList_t * pEidrxSettingsList )
|
||||
{
|
||||
return Cellular_CommonGetEidrxSettings( cellularHandle, pEidrxSettingsList );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* FreeRTOS Cellular Library API. */
|
||||
/* coverity[misra_c_2012_rule_8_7_violation] */
|
||||
CellularError_t Cellular_SetEidrxSettings( CellularHandle_t cellularHandle,
|
||||
const CellularEidrxSettings_t * pEidrxSettings )
|
||||
{
|
||||
return Cellular_CommonSetEidrxSettings( cellularHandle, pEidrxSettings );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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 );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
Reference in New Issue
Block a user