更新硬件SDK

This commit is contained in:
kerwincui
2023-03-04 03:44:56 +08:00
parent dcdf6e1b7c
commit e39d3d2f03
1900 changed files with 663153 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_adc_api.h
*
* Description: API interface implementation header file for adc service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_ADC_API_H__
#define __EC_ADC_API_H__
#include "cms_util.h"
typedef enum AT_ADC_ERROR
{
ADC_PARAM_ERROR = 1, /**/
ADC_OPERATION_NOT_SUPPORT = 2, /**/
ADC_TASK_NOT_CREATE = 3, /**/
ADC_CONVERSION_TIMEOUT = 4, /**/
}_AtAdcCmdError;
#endif

View File

@@ -0,0 +1,30 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_tcpip_api.h
*
* Description: API interface implementation header file for socket/tcpip service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_CTW_API_H__
#define __EC_CTW_API_H__
typedef enum AT_CTW_ERROR
{
CTW_PARAM_ERROR = 1,
CTW_NOT_SUPPORT = 2,
CTW_HTTP_CONNECT_FAIL = 3,
CTW_REG_FAIL = 4,
CTW_NO_SET_PARAM = 5,
CTW_NO_REGISTER = 6,
CTW_SEND_FAIL = 7,
}_AtCTWError;
#endif

View File

@@ -0,0 +1,28 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_tcpip_api.h
*
* Description: API interface implementation header file for socket/tcpip service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_DM_API_H__
#define __EC_DM_API_H__
#include "cms_util.h"
typedef enum AT_DM_ERROR
{
DM_PARAM_ERROR = 1, /**/
DM_GET_VAL_ERROR = 2, /**/
DM_NOT_SUPPORT = 3, /**/
}_AtDmError;
#endif

View File

@@ -0,0 +1,28 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_tcpip_api.h
*
* Description: API interface implementation header file for socket/tcpip service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_EXAMPLE_API_H__
#define __EC_EXAMPLE_API_H__
#include "cms_util.h"
typedef enum AT_EXAMPLE_ERROR
{
EXAMPLE_PARAM_ERROR = 1, /**/
EXAMPLE_OPERATION_NOT_SUPPORT = 2, /**/
EXAMPLE_TASK_NOT_CREATE = 3, /**/
}_AtExampleCmdError;
#endif

View File

@@ -0,0 +1,103 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_adc_api.h
*
* Description: API interface implementation header file for adc service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_FILE_API_H__
#define __EC_FILE_API_H__
#include "cms_util.h"
typedef enum AT_FILE_ERROR
{
FILE_PARAM_ERROR = 1, /**/
FILE_OPERATION_NOT_SUPPORT = 2, /**/
FILE_OPEN_ERROR = 3, /**/
FILE_READ_ERROR = 4, /**/
FILE_WRITE_ERROR = 5, /**/
FILE_CLOSE_ERROR = 6, /**/
FILE_SEEK_ERROR = 7, /**/
FILE_POSITION_ERROR = 8, /**/
FILE_TUCAT_ERROR = 9, /**/
FILE_ERASE_ERROR = 10, /**/
FILE_DELETE_ERROR = 11, /**/
}_AtFileCmdError;
typedef enum applFilePrimId_Enum
{
APPL_FILE_PRIM_ID_BASE = 0,
APPL_FILE_OPEN_REQ, //
APPL_FILE_OPEN_CNF,
APPL_FILE_OPEN_IND,
APPL_FILE_READ_REQ, //
APPL_FILE_READ_CNF,
APPL_FILE_READ_IND,
APPL_FILE_WRITE_REQ, //
APPL_FILE_WRITE_CNF,
APPL_FILE_WRITE_IND,
APPL_FILE_SEEK_REQ, //
APPL_FILE_SEEK_CNF,
APPL_FILE_SEEK_IND,
APPL_FILE_POSITION_REQ, //
APPL_FILE_POSITION_CNF,
APPL_FILE_POSITION_IND,
APPL_FILE_TUCAT_REQ, //
APPL_FILE_TUCAT_CNF,
APPL_FILE_TUCAT_IND,
APPL_FILE_CLOSE_REQ, //
APPL_FILE_CLOSE_CNF,
APPL_FILE_CLOSE_IND,
APPL_FILE_RENAME_REQ, //
APPL_FILE_RENAME_CNF,
APPL_FILE_RENAME_IND,
APPL_FILE_ERASE_REQ, //
APPL_FILE_ERASE_CNF,
APPL_FILE_ERASE_IND,
APPL_FILE_DELETE_REQ, //
APPL_FILE_DELETE_CNF,
APPL_FILE_DELETE_IND,
APPL_FILE_MSLDS_REQ, //
APPL_FILE_MSLDS_CNF,
APPL_FILE_MSLDS_IND,
APPL_FILE_MSLST_REQ, //
APPL_FILE_MSLST_CNF,
APPL_FILE_MSLST_IND,
APPL_FILE_MSDEL_REQ, //
APPL_FILE_MSDEL_CNF,
APPL_FILE_MSDEL_IND,
APPL_FILE_MSUPL_REQ, //
APPL_FILE_MSUPL_CNF,
APPL_FILE_MSUPL_IND,
APPL_FILE_MSDWL_REQ, //
APPL_FILE_MSDWL_CNF,
APPL_FILE_MSDWL_IND,
APPL_FILE_PRIM_ID_END = 0xFF
}applFilePrimId;
#endif

View File

@@ -0,0 +1,33 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_fwupd_api.h
*
* Description: API interface implementation header file for adc service
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_FWUPD_API_H__
#define __EC_FWUPD_API_H__
typedef enum
{
FWUPD_EC_PARAM_INVALID = 1,
FWUPD_EC_OPER_UNSUPP,
FWUPD_EC_PKGSZ_ERROR,
FWUPD_EC_PKGSN_ERROR,
FWUPD_EC_CRC8_ERROR,
FWUPD_EC_FLERASE_UNDONE,
FWUPD_EC_FLERASE_ERROR,
FWUPD_EC_FLWRITE_ERROR,
FWUPD_EC_FLREAD_ERROR,
FWUPD_EC_UNDEF_ERROR
}AtFwupdErrCode_e;
#endif

View File

@@ -0,0 +1,57 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_misc_api.h
*
* Description:
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_MISC_API_H__
#define __EC_MISC_API_H__
#include "cms_util.h"
#define PRODMODE_ENTER_FLAG (0x1)
#define PRODMODE_EXIT_FLAG (0x2)
/**
\fn void npiSetProdModeEnterFlag(void)
\brief Set prodMode enter flag
\returns void
*/
void npiSetProdModeEnterFlag(void);
/**
\fn void npiSetProdModeExitFlag(void)
\brief Set prodMode exit flag
\returns void
*/
void npiSetProdModeExitFlag(void);
/**
\fn bool npiIsProdModeOngoing(void)
\brief Check if prodMode is ongoing
\returns void
*/
bool npiIsProdModeOngoing(void);
/**
\fn int32_t npiCheckProdMode(uint32_t timeout_ms)
\brief This function will first check if prodMode is enabled, if yes, it'll keep blocking unitl prodMode enter flag is set in given timeout_ms time.
\returns osOK if no error happens, otherwise error code, such as osFlagsErrorTimeout
*/
int32_t npiCheckProdMode(uint32_t timeout_ms);
/**
\fn void npiClearProdMode(void)
\brief Clear prodMode Enable flag
\returns void
*/
void npiClearProdMode(void);
#endif

View File

@@ -0,0 +1,121 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_mqtt_api.h
*
* Description: MQTT interface layer header file
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __EC_MQTT_API_H__
#define __EC_MQTT_API_H__
#include "CommonTypedef.h"
#include "MQTTClient.h"
/******************************************************************************
*****************************************************************************
* MARCO
*****************************************************************************
******************************************************************************/
#define MQTT_TASK_CREATE 1
#define MQTT_TASK_DELETE 2
/******************************************************************************
*****************************************************************************
* ENUM
*****************************************************************************
******************************************************************************/
/*
* APPL SGID: APPL_MQTT, related PRIM ID
*/
typedef enum applMqttPrimId_Enum
{
APPL_MQTT_PRIM_ID_BASE = 0,
APPL_MQTT_OPEN_REQ, //
APPL_MQTT_OPEN_CNF,
APPL_MQTT_OPEN_IND,
APPL_MQTT_CLOSE_REQ, //
APPL_MQTT_CLOSE_CNF,
APPL_MQTT_CLOSE_IND,
APPL_MQTT_CONN_REQ, //
APPL_MQTT_CONN_CNF,
APPL_MQTT_CONN_IND,
APPL_MQTT_DISC_REQ, //
APPL_MQTT_DISC_CNF,
APPL_MQTT_DISC_IND,
APPL_MQTT_SUB_REQ, //
APPL_MQTT_SUB_CNF,
APPL_MQTT_SUB_IND,
APPL_MQTT_UNSUB_REQ, //
APPL_MQTT_UNSUB_CNF,
APPL_MQTT_UNSUB_IND,
APPL_MQTT_PUB_REQ, //
APPL_MQTT_PUB_CNF,
APPL_MQTT_PUB_IND,
APPL_MQTT_STAT_REQ, //
APPL_MQTT_STAT_CNF,
APPL_MQTT_STAT_IND,
APPL_MQTT_RECV_REQ, //
APPL_MQTT_RECV_CNF,
APPL_MQTT_RECV_IND,
APPL_MQTT_PRIM_ID_END = 0xFF
}applMqttPrimId;
/*
* MQTT error code
*/
typedef enum AT_MQTT_ERROR
{
MQTT_PARAM_ERROR = 1, /**/
MQTT_CREATE_CLIENT_ERROR = 2, /**/
MQTT_CREATE_SOCK_ERROR = 3, /**/
MQTT_CONNECT_TCP_FAIL = 4, /**/
MQTT_CONNECT_MQTT_FAIL = 5, /**/
MQTT_SUB_FAIL = 6, /**/
MQTT_UNSUB_FAIL = 7, /**/
MQTT_SEND_FAIL = 8, /**/
MQTT_DELETE_FAIL = 9, /**/
MQTT_FIND_CLIENT_FAIL = 10, /**/
MQTT_NOT_SUPPORT = 11, /**/
MQTT_NOT_CONNECTED = 12, /**/
MQTT_INFO_FAIL = 13, /**/
MQTT_NETWORK_FAIL = 14, /**/
MQTT_PARAM_FAIL = 15, /**/
MQTT_TASK_FAIL = 16, /**/
MQTT_RECV_FAIL = 17,
MQTT_ALI_ENCRYP_FAIL = 18,
}atMqttError;
int mqtt_init(MQTTClient* client, Network* network, unsigned char** sendBuf, int sendBufLen, unsigned char** readBuf, int readBufLen);
int mqtt_create(MQTTClient* client, Network* network, char* clientID, char* username, char* password, char *serverAddr, int port, MQTTPacket_connectData* connData);
int mqtt_close(MQTTClient* client, Network* network);
int mqtt_sub(MQTTClient* client, const char* topic, enum QoS qos, messageHandler messageHandler);
int mqtt_unsub(MQTTClient* client, const char* topic);
int mqtt_pub(MQTTClient* client, const char* topic, MQTTMessage* message);
#endif

View File

@@ -0,0 +1,88 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of AirM2M Ltd.
* File name: ec_sslcmd_api.h
* Description: API interface implementation header file for ChinaNet lwm2m
* History: Rev1.0 2021-04-22
*
****************************************************************************/
#ifndef __EC_SSLCMD_API_H__
#define __EC_SSLCMD_API_H__
#include "cms_util.h"
#define SSL_CERTPATH_MAX_SIZE (48)
#define SSL_URL_MAX_LEN (255)
#define SSL_SESSION_MAX_LEN (800)
typedef enum
{
SSL_ERR_SUCCESS = 0,
SSL_ERR_NOSUCHID,
SSL_ERR_PARAM,
SSL_ERR_PARAM_ODD,
SSL_ERR_OPERATION_NOT_SUPPORT,
SSL_ERR_SSLID_MAX,
SSL_ERR_NO_CONNECT
}sslATError_e;
typedef enum
{
SSL_NO_VERIFY = 0,
SSL_VERIFY_SEV,
SSL_VERIFY_SEV_CLI,
}sslSecLevel_e;
typedef enum
{
SSL_NO_CACHE = 0,
SSL_CACHE,
}sslSessionCache_e;
typedef struct _sslAtTemplate
{
struct _sslAtTemplate *next;
uint8_t id;
} sslAtTemplate_t;
typedef struct _sslAtContext{
struct _sslAtContext *next;
uint8_t sscxtId;
uint8_t sslversion:4;
uint8_t sni:1;
uint8_t ignore:1;
uint8_t reserve:2;
uint8_t seclevel;
uint8_t cache;
int32_t ciphersuite;
char caCertPath[SSL_CERTPATH_MAX_SIZE];
char clientCertPath[SSL_CERTPATH_MAX_SIZE];
char clientKeyPath[SSL_CERTPATH_MAX_SIZE];
} sslAtContext_t;
typedef struct sslSessionContextTag
{
char server[SSL_URL_MAX_LEN+1];
uint16_t port;
size_t session_len;
unsigned char session[SSL_SESSION_MAX_LEN];
}sslSessionContext;
sslAtTemplate_t* sslListFind(sslAtTemplate_t *list, uint8_t id);
void sslListInsert(sslAtTemplate_t **list, sslAtTemplate_t *listNode);
uint8_t sslListSize(sslAtTemplate_t *list);
sslATError_e sslGetSeclevel (sslAtTemplate_t* list, uint8_t sslctxid, uint8_t* authmode);
sslATError_e sslGetSni (sslAtTemplate_t* list, uint8_t sslctxid, uint8_t* sni);
sslATError_e sslGetIgnore (sslAtTemplate_t* list, uint8_t sslctxid, uint8_t* ignore);
sslATError_e sslGetSessioncache (sslAtTemplate_t* list, uint8_t sslctxid, uint8_t* cache);
sslATError_e sslGetCacertpath (sslAtTemplate_t* list, uint8_t sslctxid, char** cacertPath);
sslATError_e sslGetClientcertpath (sslAtTemplate_t* list, uint8_t sslctxid, char** clientcertPath);
sslATError_e sslGetClientkeypath (sslAtTemplate_t* list, uint8_t sslctxid, char** clientkeyPath);
sslATError_e sslGetCiphersuite (sslAtTemplate_t* list, uint8_t sslctxid, int32_t* ciphersuite);
int8_t loadFile2Buff(char* filename, char** buff, int32_t* bufflen);
void sslSaveSession(void);
void sslCheckSession(void);
void sslClearSessionNvm(void);
#endif

View File

@@ -0,0 +1,187 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: ec_tcpip_api.h
*
* Description: API interface implementation header file for socket/tcpip service
*
* History: create by xwang
*
* Notes:
*
******************************************************************************/
#ifndef __EC_TCPIP_API_H__
#define __EC_TCPIP_API_H__
#include "cms_util.h"
#include "commontypedef.h"
/******************************************************************************
*****************************************************************************
* MARCO
*****************************************************************************
******************************************************************************/
#define TCPIP_SDK_API_TIMEOUT 35
/******************************************************************************
*****************************************************************************
* ENUM
*****************************************************************************
******************************************************************************/
typedef enum TcpipConnectionProtocol_Tag
{
TCPIP_CONNECTION_PROTOCOL_UDP = 0,
TCPIP_CONNECTION_PROTOCOL_TCP = 1,
}TcpipConnectionProtocol;
typedef enum TcpipConnectionEvent_Tag
{
TCPIP_CONNECTION_STATUS_EVENT = 0,
TCPIP_CONNECTION_RECEIVE_EVENT = 1,
TCPIP_CONNECTION_UL_STATUS_EVENT = 2,
TCPIP_CONNECTION_UL_TOTAL_LEN_EVENT = 3,
}TcpipConnectionEvent;
typedef enum TcpipConnectionStatus_Tag
{
TCPIP_CONNECTION_STATUS_CLOSED = 0,
TCPIP_CONNECTION_STATUS_CONNECTING = 2,
TCPIP_CONNECTION_STATUS_CONNECTED = 3,
}TcpipConnectionStatus;
typedef enum TcpipConnectionUlStatus_Tag
{
Tcpip_Connection_UL_DATA_FAIL = 0,
Tcpip_Connection_UL_DATA_SUCCESS = 1,
}TcpipConnectionUlStatus;
/******************************************************************************
*****************************************************************************
* STRUCT
*****************************************************************************
******************************************************************************/
typedef struct TcpipConnectionStatusInd_Tag
{
INT32 connectionId;
UINT32 status; //TcpipConnectionStatus
UINT32 cause; //HsSocketErrCause
}TcpipConnectionStatusInd;
typedef struct TcpipConnectionRecvDataInd_Tag
{
INT32 connectionId;
UINT16 length; /*raw data length*/
UINT16 reserved;
/*Notice !!!
this is raw data pointer, customer callback should NOT free it!!!*/
void *data;
}TcpipConnectionRecvDataInd;
typedef struct TcpipConnectionUlDataStatusInd_Tag
{
INT32 connectionId;
UINT16 sequence;
UINT16 status; //TcpipConnectionUlStatus
}TcpipConnectionUlDataStatusInd;
typedef struct TcpipConnectionUlTotalLenInd_Tag
{
INT32 connectionId;
UINT32 totalLen; //TcpipConnectionUlStatus
}TcpipConnectionUlTotalLenInd;
typedef void (*tcpipConnectionCallBack)(UINT8 connectionEventType, void *bodyEvent);
/******************************************************************************
*****************************************************************************
* FUNCTION
*****************************************************************************
******************************************************************************/
/******************************************************************************
* TcpipConnectionCreate
* Description: create a tcpip connection
* input: type(mandatory)
* localIp(option) stringlen <= 63
* localPort(option)
* destIp(mandatory)"183.100.1.123" or"2001::2"
* destPort(mandatory)
* callBack -> the tcpip connection related event(TcpipConnectionEvent) callback handler
* output: >=0 connectionId, <0 fail
* Note !!!!
* 1.callBack() should be implemented by customer
2.this callback() process the raw data & length ,it should not to free any DLFC memory when use it
3.it suggests to implement callback() as synchronize api,as when it exited, all data has been processed.
******************************************************************************/
INT32 tcpipConnectionCreate(TcpipConnectionProtocol protocol, char *localIp, UINT16 localPort, char *destIp, UINT16 destPort, tcpipConnectionCallBack callBack);
/******************************************************************************
* TcpipConnectionSend
* Description: send data by a tcpip connection
* input: connectionId(mandatory)
* data(mandatory) -> the data which need send,
* dataLen(mandatory) -> data length
* raiInfo(option)
* sequence(option) -> the sequence number of the UL data. 1~255: a UL status event will be indicate with the socket event callback 0:no UL status event
* expectFlag
* output:< 0 fail;> 0 send Len
* Comment:
******************************************************************************/
INT32 tcpipConnectionSend(INT32 connectionId, UINT8 *data, UINT16 dataLen, UINT8 raiInfo, UINT8 expectFlag, UINT8 sequence);
/******************************************************************************
* TcpipConnectionClose
* Description: close a tcpip connection
* input: connectionId(mandatory), timeout(mandatory, seconds, suggest > 3 seconds)(if the timeout is 0 ==>disable close timeout feature)
* output:
* Comment:
******************************************************************************/
INT32 tcpipConnectionClose(INT32 connectionId, UINT16 timeout);
/******************************************************************************
* TcpipGetTotalSendLen
* Description: get the total send len by connection id
* input: connectionId(mandatory)
* totalLen
* output:
* Comment: return 0 ->success; -1 -> fail
******************************************************************************/
INT32 TcpipGetTotalSendLen(INT32 connectionId, UINT32 *totalLen);
/******************************************************************************
* TcpipGetTotalAckedLen
* Description: get the total acked len by connection id
* input: connectionId(mandatory)
* totalLen
* output:
* Comment: return 0 ->success; -1 -> fail
******************************************************************************/
INT32 TcpipGetTotalAckedLen(INT32 connectionId, UINT32 *totalLen);
/******************************************************************************
* TcpipGetTcpSendBuffLen
* Description: get tcp socket send buffer len by connection id
* input: connectionId(mandatory)
* sendBuffLen
* output:
* Comment: return 0 ->success; -1 -> fail
******************************************************************************/
INT32 TcpipGetTcpSendBuffLen(INT32 connectionId, UINT32 *sendBuffLen);
#endif

View File

@@ -0,0 +1,152 @@
/******************************************************************************
* (C) Copyright 2018 AirM2M International Ltd.
* All Rights Reserved
*******************************************************************************
* Filename: tcpip_lib_event.h
*
* Description: tcpip related SDK API
*
* History: create by xwang
*
* Notes:
*
******************************************************************************/
#ifndef __TCPIP_LIB_TASK_H__
#define __TCPIP_LIB_TASK_H__
#include "commontypedef.h"
#include "cms_sock_mgr.h"
/******************************************************************************
*****************************************************************************
* ENUM
*****************************************************************************
******************************************************************************/
typedef enum{
TCPIP_API_REQ_CREATE_CONNECTION = 19,
TCPIP_API_REQ_SEND_DATA = 20,
TCPIP_API_REQ_CLOSE_CONNECTION = 21,
TCPIP_API_REQ_SEND_TOTAL_LENGTH = 22,
TCPIP_API_REQ_ACKED_TOTAL_LENGTH = 23,
TCPIP_API_REQ_TCP_SEND_BUFF_LENGTH = 24
}TcpipApiRequestId;
/******************************************************************************
*****************************************************************************
* STRUCT
*****************************************************************************
******************************************************************************/
typedef struct TcpipApiCreateConnectionReq_Tag{
UINT32 type;
UINT16 localPort;
UINT16 remotePort;
ip_addr_t localAddr;
ip_addr_t remoteAddr;
void *eventCallback;
void *tcpipApiConnEventCallback;
}TcpipApiCreateConnectionReq;
typedef struct TcpipApiSendDataReq_Tag{
UINT32 connectionId;
UINT8 raiInfo;
UINT8 expectFlag;
UINT16 dataLen;
UINT8 sequence;
UINT8 rsvd1;
UINT8 rsvd2;
UINT8 data[];
}TcpipApiSendDataReq;
typedef struct TcpipApiCloseConnectionReq_Tag{
UINT32 connectionId;
UINT16 timeout;
UINT16 rsvd;
}TcpipApiCloseConnectionReq;
typedef struct TcpipApiSendTotalLenReq_Tag{
UINT32 connectionId;
}TcpipApiSendTotalLenReq;
typedef struct TcpipApiAckedTotalLenReq_Tag{
UINT32 connectionId;
}TcpipApiAckedTotalLenReq;
typedef struct TcpipApiTcpSendBuffLenReq_Tag{
UINT32 connectionId;
}TcpipApiTcpSendBuffLenReq;
typedef struct TcpipApiPriMgrContext_Tag{
UINT16 createSourcePort;
UINT16 creatTimeout;
UINT32 startCreateTicks;
UINT32 rcvRequestFd;
UINT32 sendToalLen;
UINT32 ackedTotalLen;
/*tcpipApiConnEventCallback (): this is a callback implemented by customer ,and MUST NOT free any input DLFC memory */
void *tcpipApiConnEventCallback;
ip_addr_t createSourceAddr;
UINT32 bitmap[8];
}TcpipApiPriMgrContext;
typedef struct TcpipCreateConnResult_Tag{
INT32 connectionId;
INT32 cause;
}TcpipCreateConnResult;
typedef struct TcpipSendDataResult_Tag{
INT32 sendLen;
INT32 cause;
}TcpipSendDataResult;
typedef struct TcpipCloseResult_Tag{
INT32 result;
INT32 cause;
}TcpipCloseResult;
typedef struct TcpipSendTotalLenResult_Tag{
INT32 result;
UINT32 totalLen;
}TcpipSendTotalLenResult;
typedef struct TcpipAckedTotalLenResult_Tag{
INT32 result;
UINT32 totalLen;
}TcpipAckedTotalLenResult;
typedef struct TcpipTcpSendBuffLenResult_Tag{
INT32 result;
UINT32 sendBuffLen;
}TcpipTcpSendBuffLenResult;
typedef struct TcpipApiConnHibPriContext_Tag{
UINT32 sendTotalLen;
UINT32 ackedTotalLen;
void *tcpipApiConnEventCallback;
}TcpipApiConnHibPriContext;
/******************************************************************************
*****************************************************************************
* FUNCTION/API
*****************************************************************************
******************************************************************************/
void tcpipApiProessReq(CmsSockMgrRequest *atecSktReq, ip_addr_t *sourceAddr, UINT16 sourcePort, INT32 rcvRequestFd);
void tcpipApiEventCallback(CmsSockMgrContext *mgrContext, CmsSockMgrEventType eventType, void *eventArg);
BOOL tcpipCheckHibMode(CmsSockMgrContext *mgrContext);
void tcpipApiStoreConnHibContext(CmsSockMgrContext *sockMgrContext, CmsSockMgrConnHibContext *hibContext);
void tcpipApiRecoverConnContext(CmsSockMgrConnHibContext *hibContext);
#endif

View File

@@ -0,0 +1,127 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of AirM2M Ltd.
* File name: ps_event_callback.h
* Description: API interface implementation header file for event callback service
* History: Rev1.0 2018-10-12
*
****************************************************************************/
#ifndef __PS_EVENT_CALLBACK_H__
#define __PS_EVENT_CALLBACK_H__
#include "cmicomm.h"
#include "cms_api.h"
#include "ostask.h"
/**
\addtogroup psEventCallback_typedef Typedef
\{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/** \brief List of the event IDs for URC */
typedef enum
{
PS_URC_ID_START = 0, /**< URC event ID for command +CREG*/
PS_URC_GROUP_DEV = (CAM_DEV << 12), //0x2000
PS_URC_GROUP_MM = (CAM_MM << 12), //0x3000
PS_URC_ID_MM_SIGQ,
PS_URC_ID_MM_TAU_EXPIRED,
PS_URC_ID_MM_BLOCK_STATE_CHANGED,
PS_URC_ID_MM_CERES_CHANGED,
PS_URC_ID_MM_NITZ_REPORT,
PS_URC_ID_MM_PSM_STATE_CHANGED,
PS_URC_GROUP_PS = (CAM_PS << 12), //0x4000
PS_URC_ID_PS_BEARER_ACTED,
PS_URC_ID_PS_BEARER_DEACTED,
PS_URC_ID_PS_CEREG_CHANGED,
PS_URC_ID_PS_NETINFO,
PS_URC_ID_PS_PKG_DATA_TRANS_STATE_CHANGED,
PS_URC_GROUP_SIM = (CAM_SIM << 12), //0x5000
PS_URC_ID_SIM_READY, /**< SIM card is ready*/
PS_URC_ID_SIM_REMOVED, /**< SIM card is removed*/
PS_URC_ID_END, /**< End of the URC event ID enumeration*/
}PsEventID;
/*
* which PS event group need to monitor
*/
typedef enum
{
PS_GROUP_BASE_MASK = (0X01 << CAM_BASE), //0x00000002
PS_GROUP_DEV_MASK = (0X01 << CAM_DEV), //0x00000004
PS_GROUP_MM_MASK = (0X01 << CAM_MM), //0x00000008
PS_GROUP_PS_MASK = (0X01 << CAM_PS), //0x00000010
PS_GROUP_SIM_MASK = (0X01 << CAM_SIM), //0x00000020
PS_GROUP_SMS_MASK = (0X01 << CAM_SMS), //0x00000040
PS_GROUP_ALL_MASK = 0X7FFFFFFF
}PsEventGpMask;
typedef struct {
UINT32 messageId;
void *param;
}eventCallbackMessage_t;
/**
\fn INT32 (*psEventCallback_t)(PsEventID eventId, void *param, UINT32 paramLen)
\brief A function pointer prototype for the URC event callback.
\param[in] eventId Event ID
\param[in] param Pointer to the data structure with URC parameters.
\param[in] paramLen Indicates the length of the URC parameters.
\Note: this callback API running in CMS task, and can't be delayed too much in this API
*/
typedef INT32 (*psEventCallback_t)(PsEventID eventId, void *param, UINT32 paramLen);
/**
\fn CmsRetId registerPSEventCallback(UINT32 groupMask, psEventCallback_t callback)
\brief Function to register certain PS event callback.
\param[in] groupMask Group mask.
\param[in] callback Callback function to be registered.
*/
CmsRetId registerPSEventCallback(PsEventGpMask groupMask, psEventCallback_t callback);
/**
\fn CmsRetId deregisterPSEventCallback(psEventCallback_t callback)
\brief Function to deregister certain PS event callback.
*/
CmsRetId deregisterPSEventCallback(psEventCallback_t callback);
/**
\fn void PSTriggerEvent(PsEventID eventID, void *param, UINT32 paramLen)
\brief Function to trigger certain PS event.
\param[in] eventID Event ID.
\param[in] param Parameter to be transfered.
\param[in] paramLen Parameter length to be transfered.
*/
void PSTriggerEvent(PsEventID eventID, void *param, UINT32 paramLen);
/**
\fn void psCmiIndToAppEventTrigger(const SignalBuf *indSignalPtr)
\brief Function to transfer indication to event trigger.
*/
void psCmiIndToAppEventTrigger(const SignalBuf *indSignalPtr);
/*
\fn void applIndToAppEventTrigger(CmsApplInd *pAppInd)
*/
void applIndToAppEventTrigger(CmsApplInd *pAppInd);
/*
\fn void psEventCallbackInit(void)
\Called in main task, to init the PS event callback table
*/
void psEventCallbackInit(void);
#endif

View File

@@ -0,0 +1,878 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of AirM2M Ltd.
* File name: ps_lib_api.h
* Description: EC618 opencpu pslibapi header file
* History: Rev1.0 2018-12-10
*
****************************************************************************/
#ifndef __PS_LIB_API_H__
#define __PS_LIB_API_H__
#include "FreeRTOS.h"
#include "task.h"
#include "cmsis_os2.h"
#include "cms_util.h"
#include "networkmgr.h"
#include "cmidev.h"
#include "cmips.h"
#include "cmisim.h"
/******************************************************************************
*****************************************************************************
* MARCO
*****************************************************************************
******************************************************************************/
#define EC_NV_DATA_LEN 96 /* not suitable to put here, -TBD */
#define EC_NV_DATA_IMEI_LEN 32
#define EC_NV_DATA_SN_LEN 32
#define EC_NV_DATA_IMEI_LOCK_LEN 16
#define EC_NV_DATA_SN_LOCK_LEN 16
#define EC_NV_DATA_IMEI_OFFSET 0
#define EC_NV_DATA_SN_OFFSET 32
#define EC_NV_DATA_IMEI_LOCK_OFFSET 64
#define EC_NV_DATA_SN_LOCK_OFFSET 80
#define PS_APN_MAX_SIZE (CMI_PS_MAX_APN_LEN+1)
/******************************************************************************
*****************************************************************************
* ENUM
*****************************************************************************
******************************************************************************/
/******************************************************************************
*****************************************************************************
* STRUCT
*****************************************************************************
******************************************************************************/
/*
* APP request PS service
*/
typedef struct AppPsCmiReqData_Tag
{
/* request input */
UINT8 sgId; //PS service group ID: CacSgIdEnum
UINT8 rsvd0;
UINT16 reqPrimId; //request prim ID.
UINT16 cnfPrimId;
UINT16 reqParamLen;
void *pReqParam;
/* confirm output */
UINT16 cnfRc; //confirm return code: MtErrorResultCode/SmsErrorResultCode
UINT16 cnfBufLen;
void *pCnfBuf; //filled in callback API
}AppPsCmiReqData; //20 bytes
typedef struct CeregGetStateParams_Tag
{
UINT8 state; //CmiCeregStateEnum
BOOL bRegOngoing; //if not registered, whether low layer is trying to search/register to a PLMN
UINT16 rsvd0;
BOOL locPresent;
UINT8 act; //CmiCeregActEnum
UINT16 tac;
UINT32 celId;
BOOL rejCausePresent;
UINT8 causeType; // only support 0 by now
UINT16 rejCause;
BOOL activeTimePresent;
UINT8 activeTime; //T3324, valid when "activeTimePresent" == TRUE
BOOL extTauTimePresent;
UINT8 extPeriodicTau; //extT3412, valid when "extTauTimePresent" == TRUE
/*
* Active Time value in seconds, valid when "extTauTimePresent" == TRUE
*/
UINT32 activeTimeS;
/*
* extended periodic TAU value in seconds, valid when "extTauTimePresent" == TRUE
*/
UINT32 extPeriodicTauS;
/*
* 1> if NW not config the extT3412(extPeriodicTau), should return this T3412 (periodicTauS) value in seconds;
* 2> else (if NW config extT3412), don't need to return this T3412 (periodicTauS)
*/
BOOL tauTimerPresent;
UINT8 rsvd1;
UINT16 rsvd2;
UINT32 periodicTauS;
}CeregGetStateParams;
typedef struct EdrxPtwSetParamsReq_Tag
{
UINT8 edrxMode; //CmiMmEdrxModeEnum
UINT8 actType; //CmiMmEdrxActTypeEnum 0 / 5 only
UINT8 ptwValuePresent;
UINT8 edrxValuePresent;
/*
WB-S1 mode
The field contains the PTW value in seconds for WB-S1 mode.The PTW value is used
as specified in 3GPP TS 23.682 [133a].The PTW value is derived as follows:
bit
8 7 6 5 Paging Time Window length
0 0 0 0 1,28 seconds
0 0 0 1 2,56 seconds
0 0 1 0 3,84 seconds
0 0 1 1 5,12 seconds
0 1 0 0 6,4 seconds
0 1 0 1 7,68 seconds
0 1 1 0 8,96 seconds
0 1 1 1 10,24 seconds
1 0 0 0 11,52 seconds
1 0 0 1 12,8 seconds
1 0 1 0 14,08 seconds
1 0 1 1 15,36 seconds
1 1 0 0 16,64 seconds
1 1 0 1 17,92 seconds
1 1 1 0 19,20 seconds
1 1 1 1 20,48 seconds
*/
/*
* <Requested_eDRX_value>: string type; half a byte in a 4 bit format.
* The eDRX value refers to bit 4 to 1 of octet 3 of the Extended DRX parameters information element
* for S1 mode, available value: 0x01 - 0x0F
* bit
* 4 3 2 1 E-UTRAN eDRX cycle length duration
*
* 0 0 0 0 5,12 seconds
* 0 0 0 1 10,24 seconds
* 0 0 1 0 20,48 seconds
* 0 0 1 1 40,96 seconds
* 0 1 0 0 61,44 seconds
* 0 1 0 1 81,92 seconds
* 0 1 1 0 102,4 seconds
* 0 1 1 1 122,88 seconds
* 1 0 0 0 143,36 seconds
* 1 0 0 1 163,84 seconds
* 1 0 1 0 327,68 seconds
* 1 0 1 1 655,36 seconds
* 1 1 0 0 1310,72 seconds
* 1 1 0 1 2621,44 seconds
* 1 1 1 0 5242,88 seconds
* 1 1 1 1 10485,76 seconds
*/
UINT8 reqPtwValue;
UINT8 reqEdrxValue;
UINT16 reserved1;
}EdrxPtwSetParamsReq;
typedef struct EdrxPtwGetSettingParams_Tag
{
UINT8 edrxCfg; //CmiMmEdrxCfgEnum
UINT8 actType; //CmiMmEdrxActTypeEnum 0 - 5 only
/* if eDRX is disabled, reqEdrxValue should be set to 0x00, and actType should set to 0 */
UINT8 reqPtwValue;
UINT8 reqEdrxValue;
/*
* for easy reading, also return the "Request EDRX value" in milli-second;
*/
UINT32 reqEdrxValueMs;
}EdrxPtwGetSettingParams;
#if 0
typedef struct EcCfgSetParamsReq_Tag
{
/* CCM */
BOOL psSoftResetPresent;
BOOL bEnablePsSoftReset;
BOOL rohcPresent;
BOOL bRohc; //whether ROHC enabled
BOOL ipv6RsForTestSimPresent;
BOOL bIpv6RsForTestSim; //whether enable IPv6 RS procedure for TEST SIM card
BOOL tcpTptOptPresent;
BOOL bTcpTptOpt; //whether enable TCP throughput optimization
BOOL dataCounterPresent;
BOOL bEnableDataCounter; //whether enable data counter
UINT16 rsvd1;
BOOL ipv6GetPrefixTimePresent;
BOOL rsvd2;
UINT16 ipv6GetPrefixTime; //the maximum time of getting IPv6 prefix
/* EMM */
BOOL powerLevelPresent;
UINT8 plmnSearchPowerLevel; /* range [0..3] */
BOOL epcoPresent;
BOOL enableEpco;
/* useless
BOOL dnsIpAddrReadCfgPresent;
UINT8 dnsIpType;
UINT8 enableDnsIpAddrRead;
*/
BOOL barValuePresent;
UINT8 t3324MaxValuePresent;
UINT16 barValueS; /* User defined SIB14 bar timer value in seconds */
UINT32 t3324MaxValueS;
BOOL attachWithImsiCtrlPresent;
UINT8 attachWithImsiCtrl; /* attach with imsi control */
BOOL pwrAttachWoEiaPresent;
BOOL pwrAttachWoEia; /* whether or not attach without integrity protected while power on */
/* ERRC */
BOOL dataInactTimerPresent;
UINT8 dataInactTimerS; /* DataInactivityTimer-r14, used in CERRC; should > 40s; 0 - just means not use DataInactivityTimer feature */
BOOL relaxMonitorPresent;
UINT8 relaxMonitorDeltaP; /* range [0..15], value in dB, 0 means relaxed monitoring(36.304, 5.2.4.12) in is not used, used in CERRC */
BOOL relVersionPresent;
UINT8 relVersion; /* release version, 13-14 */
BOOL ueCategoryPresent;
UINT8 ueCategory; /* Configure the UE category. */
BOOL enableEabPresent;
BOOL enableEab;
BOOL attachCidPresent;
UINT8 attachCid;
}EcCfgSetParamsReq;
typedef struct EcCfgGetParamsReq_Tag
{
/* CCM */
BOOL bEnablePsSoftReset;
BOOL bRohc;
BOOL bIpv6RsForTestSim;
BOOL bTcpTptOpt;
BOOL bEnableDataCounter;
UINT8 rsvd1;
UINT16 ipv6GetPrefixTime;
/* EMM */
UINT8 plmnSearchPowerLevel;
BOOL enableEpco;
UINT16 rsvd3;
//UINT8 dnsIpv4AddrReadCfg; /* Useless remove */
//UINT8 dnsIpv6AddrReadCfg;
UINT32 t3324MaxValue;
UINT16 barValue;
BOOL enableEab;
UINT8 attachEpsCid;
UINT8 attachWithImsiCtrl;
BOOL pwrAttachWoEia;
UINT16 rsvd2;
/* ERRC */
UINT8 ueCfgDataInactTimer; /* ERRC data inactivity timer, in seconds */
UINT8 ueCfgRelaxMonitorDeltaP; /* relaxed monitor parameter, in DB, 0 - 17 */
UINT8 relVersion; /* release version, 13 - 14 */
UINT8 ueCategory;
}EcCfgGetParamsReq;
#endif
/******************************************************************************
* Set ECCFG params struct
******************************************************************************/
typedef CmiDevSetExtCfgReq EcCfgSetParamsReq;
/******************************************************************************
*Get ECCFG params struct
******************************************************************************/
typedef CmiDevGetExtCfgCnf EcCfgGetParamsReq;
#if 0
typedef struct SrvCellBasicInfoTag{
UINT16 mcc;
UINT16 mncWithAddInfo; // if 2-digit MNC type, the 4 MSB bits should set to 'F',
/* Example:
* 46000; mcc = 0x0460, mnc = 0xf000
* 00101; mcc = 0x0001, mnc = 0xf001
* 46012; mcc = 0x0460, mnc = 0xf012
* 460123; mcc = 0x0460, mnc = 0x0123
*/
//DL earfcn (anchor earfcn), range 0 - 262143
UINT32 earfcn;
//the 28 bits Cell-Identity in SIB1, range 0 - 268435455
UINT32 cellId;
//physical cell ID, range 0 - 503
UINT16 phyCellId;
// value in dB, value range: -30 ~ 30
BOOL snrPresent;
INT8 snr;
//value in units of dBm, value range: -156 ~ -44
INT16 rsrp;
//value in units of dB, value range: -34 ~ 25
INT16 rsrq;
}SrvCellBasicInfo;
typedef struct NCellBasicInfoTag{
UINT32 earfcn; //DL earfcn (anchor earfcn), range 0 - 262143
UINT16 phyCellId;
UINT16 revd0;
//value in units of dBm, value range: -156 ~ -44
INT16 rsrp;
//value in units of dB, value range: -34 ~ 25
INT16 rsrq;
}NCellBasicInfo;
#define NCELL_INFO_CELL_NUM 6
typedef struct BasicCellListInfoTag
{
BOOL sCellPresent;
UINT8 nCellNum;
SrvCellBasicInfo sCellInfo;
NCellBasicInfo nCellList[NCELL_INFO_CELL_NUM];
}BasicCellListInfo;
struct ecbcInfoApiMsg
{
BasicCellListInfo *bcInfo;
osSemaphoreId_t *sem;
UINT16 result;
};
#endif
typedef CmiDevGetBasicCellListInfoCnf BasicCellListInfo;
#define SUPPORT_MAX_FREQ_NUM 8 //== CMI_DEV_SUPPORT_MAX_FREQ_NUM
typedef struct CiotSetFreqParams_Tag
{
UINT8 mode; // CmiDevSetFreqModeEnum
UINT8 cellPresent;// indicate whether phyCellId present
UINT16 phyCellId; // phyCell ID, 0 - 503
UINT8 arfcnNum; // 0 is not allowed for mode is CMI_DEV_SET_PREFER_FREQ (1);
// max number is CMI_DEV_SUPPORT_MAX_FREQ_NUM
UINT8 reserved0;
UINT16 reserved1;
UINT32 lockedArfcn;//locked EARFCN
UINT32 arfcnList[SUPPORT_MAX_FREQ_NUM];
}CiotSetFreqParams; // total 44 bytes
typedef struct CiotGetFreqParams_Tag
{
UINT8 mode; // CmiDevGetFreqModeEnum 3:means UE has set preferred EARFCN list and has locked EARFCN
UINT8 cellPresent;// indicate whether phyCellId present
UINT16 phyCellId; // phyCell ID, 0 - 503
UINT8 arfcnNum; // 0 is not allowed for mode is CMI_DEV_SET_PREFER_FREQ (1);
// max number is CMI_DEV_SUPPORT_MAX_FREQ_NUM
UINT8 reserved0;
UINT16 reserved1;
UINT32 lockedArfcn;//locked EARFCN
UINT32 arfcnList[SUPPORT_MAX_FREQ_NUM];
}CiotGetFreqParams; // total 44 bytes
/******************************************************************************
* Get PS extended status info
******************************************************************************/
typedef enum UeExtStatusType_TAG
{
UE_EXT_STATUS_ALL = CMI_DEV_GET_ECSTATUS,
UE_EXT_STATUS_PHY = CMI_DEV_GET_ECSTATUS_PHY,
UE_EXT_STATUS_L2 = CMI_DEV_GET_ECSTATUS_L2,
UE_EXT_STATUS_ERRC = CMI_DEV_GET_ECSTATUS_RRC,
UE_EXT_STATUS_EMM = CMI_DEV_GET_ECSTATUS_EMM,
UE_EXT_STATUS_PLMN = CMI_DEV_GET_ECSTATUS_PLMN,
UE_EXT_STATUS_ESM = CMI_DEV_GET_ECSTATUS_ESM,
UE_EXT_STATUS_CCM = CMI_DEV_GET_ECSTATUS_CCM,
UE_EXT_QENG_SCELL = CMI_DEV_GET_QENG_SCELL,
UE_EXT_QENG_NCELL = CMI_DEV_GET_QENG_NCELL
}UeExtStatusType;
typedef CmiDevGetExtStatusCnf UeExtStatusInfo;
/******************************************************************************
* Set attach bearer parameter
******************************************************************************/
typedef CmiPsSetAttachedBearerCtxReq SetAttachBearerParams;
/******************************************************************************
* Get attach bearer setting parameter
******************************************************************************/
typedef CmiPsGetAttachedBearerCtxCnf GetAttachBearerSetting;
/******************************************************************************
* Set UE extended configuration
******************************************************************************/
typedef CmiDevSetExtCfgReq SetExtCfgParams;
/******************************************************************************
* Get UE extended configuration
******************************************************************************/
typedef CmiDevGetExtCfgCnf GetExtCfgSetting;
/******************************************************************************
* Set Eps Bearer information struct
******************************************************************************/
typedef CmiPsDefineBearerCtxReq SetPsBearerParams;
/******************************************************************************
*Get Eps Bearer information struct
******************************************************************************/
typedef CmiPsGetDefinedBearerCtxCnf GetPsBearerParams;
/******************************************************************************
*Set WifiScan execute params struct
******************************************************************************/
/* WIFISCAN Params Range */
#define WIFISCAN_0_TIME_VAL_MIN 4000
#define WIFISCAN_0_TIME_VAL_MAX 255000
#define WIFISCAN_1_ROUND_VAL_MIN 1
#define WIFISCAN_1_ROUND_VAL_MAX 3
#define WIFISCAN_2_MAXBSSIDNUM_VAL_MIN 4
#define WIFISCAN_2_MAXBSSIDNUM_VAL_MAX 10
#define WIFISCAN_3_SCANTIMEOUT_VAL_MIN 1
#define WIFISCAN_3_SCANTIMEOUT_VAL_MAX 255
#define WIFISCAN_4_PRIORITY_VAL_MIN 0 //data preferred
#define WIFISCAN_4_PRIORITY_VAL_MAX 1 //wifiscan preferred
typedef CmiDevSetWifiSacnReq SetWifiScanParams;
/******************************************************************************
*Get WifiScan result struct
******************************************************************************/
typedef CmiDevSetWifiScanCnf GetWifiScanInfo;
/******************************************************************************
* Set ECSIMCFG params struct
******************************************************************************/
typedef CmiSimSetExtCfgReq EcSimCfgSetParams;
/******************************************************************************
*Get ECSIMCFG params struct
******************************************************************************/
typedef CmiSimGetExtCfgCnf EcSimCfgGetParams;
/******************************************************************************
*Set PIN operation request params struct
******************************************************************************/
#define PIN_STR_SIZE (CMI_SIM_MAX_PIN_CODE_LENGTH +1) /*+ 1 for '\0'*/
typedef struct SetPinOperReqParams_Tag
{
CmiSimPinOper operMode; //only support verify/unblock/change/enable/disable PIN, don't support query
UINT8 rsvd1;
UINT16 rsvd2;
CHAR pinStr[PIN_STR_SIZE];/* string type, e.g. "1234",
* Verify PIN, PIN string, number of digits: 4-8
* Change PIN, old PIN string, number of digits: 4-8
* Unblock PIN, PUK string, number of digits: 8
*/
CHAR newPinStr[PIN_STR_SIZE];/* string type, e.g. "1234"
* Change PIN, new PIN string, number of digits: 4-8
* Unblock PIN, new PIN string, number of digits: 4-8
*/
}
SetPinOperReqParams;
/******************************************************************************
* Get PIN state params
******************************************************************************/
typedef enum GetPinStateType_Tag
{
QUERY_CPIN, //query cpin as "AT+CPIN?"
QUERY_SIM_LOCK_STATUS //query SIM lock status referred to "AT+CLCK="SC",2", that also means query PIN status is enable or not
}
GetPinStateType;
//+CPIN: <code>
typedef enum CpinCode_Tag
{
CPIN_SIM_NOT_READY, /* NOT READY, maybe the SIM is not inserted or failure */
CPIN_READY, /* READY, MT is not pending for any password, SIM is ready */
CPIN_SIM_PIN, /* SIM PIN, MT is waiting for SIM PIN to be given */
CPIN_SIM_PUK, /* SIM PUK, MT is waiting for SIM PUK to be given */
CPIN_SIM_UNKNOWN /* unknown CPIN code */
}
CpinCode;
//+CLCK: <status>
typedef enum FacSimLockStatus_Tag
{
SIM_LOCK_STATUS_NOT_ACTIVE, //SIM lock is not active, that means PIN is disable
SIM_LOCK_STATUS_ACTIVE, //SIM lock is active, that means PIN is enable
SIM_LOCK_STATUS_UNKNOWN
}
FacSimLockStatus;
typedef struct GetPinStateCnfParams_Tag
{
CpinCode cpinCode; //+CPIN: <code>
FacSimLockStatus simLockStatus; //+CLCK: <status>
UINT16 rsvd;
}
GetPinStateCnfParams;
/******************************************************************************
*Manual PLMN Search result struct
******************************************************************************/
#define PLMN_STR_MAX_LENGTH 7
typedef struct PlmnSearchInfo_Tag
{
UINT8 plmn[PLMN_STR_MAX_LENGTH];
UINT8 plmnState; //CmiMmPlmnStateEnum, cops <stat>
UINT8 longPlmn[CMI_MM_STR_PLMN_MAX_LENGTH]; // end with '\0'
UINT8 shortPlmn[CMI_MM_SHORT_STR_PLMN_MAX_LENGTH]; // end with '\0'
UINT8 act; //CmiCregActEnum, cops <act>
}PlmnSearchInfo; //size = (7+1+32+8) = 48
typedef struct ManualPlmnSearchInfo_Tag
{
UINT8 plmnNum;
PlmnSearchInfo plmnList[CMI_MM_PLMN_SEARCH_NUM];
}ManualPlmnSearchInfo;
/******************************************************************************
*Current Operator Info struct
******************************************************************************/
typedef struct GetCurrentOperatorInfo_Tag
{
UINT8 plmn[PLMN_STR_MAX_LENGTH]; // end with '\0'
UINT8 longPlmn[CMI_MM_STR_PLMN_MAX_LENGTH]; // end with '\0'
UINT8 shortPlmn[CMI_MM_SHORT_STR_PLMN_MAX_LENGTH]; // end with '\0'
}GetCurrentOperatorInfo;
typedef CmiPsSetTrafficIdleMonitorReq EcSclkExSetParamsReq;
typedef CmiPsGetTrafficIdleMonitorCnf EcSclkExGetParamsReq;
/******************************************************************************
*****************************************************************************
* API
*****************************************************************************
******************************************************************************/
//void appCheckTcpipReady(void);
//void psSyncProcCmiCnf(const SignalBuf *cnfSignalPtr);
//CmsRetId initPsCmiReqMapList(void);
CmsRetId appGetNetInfoSync(UINT32 cid, NmAtiNetifInfo *result );
CmsRetId appGetImsiNumSync(CHAR *imsi);
CmsRetId appGetIccidNumSync(CHAR *iccid);
CmsRetId appGetImeiNumSync(CHAR *imei);
CmsRetId appGetCeregStateSync(CeregGetStateParams *pCeregGetStateParams);
CmsRetId appSetEdrxPtwSettingSync(EdrxPtwSetParamsReq *pEdrxPtwSetParams);
CmsRetId appGetEdrxPtwSettingSync(EdrxPtwGetSettingParams *pEdrxPtwGetSettingParams);
CmsRetId appSetEcCfgSettingSync(EcCfgSetParamsReq *pEcCfgSetParams);
CmsRetId appGetEcCfgSettingSync(EcCfgGetParamsReq *pEcCfgGetParams);
CmsRetId appGetAPNSettingSync(UINT8 cid, UINT8 *pApn);
CmsRetId appCheckSystemTimeSync(void);
CmsRetId appGetSystemTimeSecsSync(time_t *time);
CmsRetId appGetSystemTimeUtcSync(utc_timer_value_t *time);
CmsRetId appSetSystemTimeUtcSync(UINT32 time1, UINT32 time2, UINT32 time3);
//CmsRetId appGetActedCidSync(UINT8 *cid, UINT8 *num);
/**
\fn appSetSimLogicalChannelOpenSync
\brief Send cmi request to open SIM logical channel
\param[out] *sessionID: Pointer to a new logical channel number returned by SIM
\param[in] *dfName: Pointer to DFname selected on the new logical channel
\returns CMS_RET_SUCC: success
\ CMS_SIM_NOT_INSERT: SIM not inserted
\ CMS_OPER_NOT_SUPPROT: operation not supported
*/
//CmsRetId appSetSimLogicalChannelOpenSync(UINT8 *sessionID, UINT8 *dfName);
/**
\fn appSetSimLogicalChannelCloseSync
\brief Send cmi request to close SIM logical channel
\param[in] sessionID: the logical channel number to be closed
\returns CMS_RET_SUCC---success
\ CMS_SIM_NOT_INSERT: SIM not inserted
\ CMS_INVALID_PARAM: input invalid parameters
*/
//CmsRetId appSetSimLogicalChannelCloseSync(UINT8 sessionID);
/**
\fn appSetSimGenLogicalChannelAccessSync
\brief Send cmi request to get generic SIM logical channel access
\param[in] sessionID: the logical channel number
\param[in] *command: Pointer to command apdu, HEX string
\param[in] cmdLen: the length of command apdu, max value is CMI_SIM_MAX_CMD_APDU_LEN * 2 (522)
\param[out] *response: Pointer to response apdu, HEX string
\param[out] respLen: the length of command apdu, max value is 4KB
\returns CmsRetId
*/
//CmsRetId appSetSimGenLogicalChannelAccessSync(UINT8 sessionID, UINT8 *command, UINT16 cmdLen,
// UINT8 *response, UINT16 *respLen);
/**
\fn appSetRestrictedSimAccessSync
\brief Send cmi request to get generic SIM access
\param[in] *pCmdParam: Pointer to command parameters
\param[out] *pRspParam: Pointer to response parameters
\returns CMS_RET_SUCC---success
\ CMS_SIM_NOT_INSERT: SIM not inserted
\ CMS_INVALID_PARAM: input invalid parameters
*/
//CmsRetId appSetRestrictedSimAccessSync(CrsmCmdParam *pCmdParam, CrsmRspParam *pRspParam);
CmsRetId appSetCFUN(UINT8 fun);
CmsRetId appGetCFUN(UINT8 *pOutCfun);
//CmsRetId appSetBootCFUNMode(UINT8 mode);
//UINT8 appGetBootCFUNMode(void);
//CmsRetId appGetSignalInfoSync(UINT8 *csq, INT8 *snr, INT8 *rsrp);
CHAR* appGetUeVersionInfo(void);
//void drvSetPSToWakeup(void);
BOOL appSetImeiNumSync(CHAR* imei);
BOOL appGetSNNumSync(CHAR* sn);
BOOL appSetSNNumSync(CHAR* sn, UINT8 len);
BOOL appGetImeiLockSync(CHAR* imeiLock);
BOOL appSetImeiLockSync(CHAR* imeiLock);
BOOL appGetSNLockSync(CHAR* snLock);
BOOL appSetSNLockSync(CHAR* snLock);
BOOL appSetEcNVDataLockCleanSync(void);
BOOL appSetSnImeiLockCleanSync(void);
CmsRetId appSetBandModeSync(UINT8 bandNum, UINT8 *orderBand);
CmsRetId appGetBandModeSync(UINT8 *bandNum, UINT8 *orderBand);
CmsRetId appGetSupportedBandModeSync(UINT8 *bandNum, UINT8 *orderBand);
CmsRetId appGetECBCInfoSync(BasicCellListInfo *bcListInfo);
CmsRetId appSetCiotFreqSync(CiotSetFreqParams *pCiotFreqParams);
CmsRetId appGetCiotFreqSync(CiotGetFreqParams *pCiotFreqParams);
CmsRetId appGetPSMModeSync(UINT8 *pMode);
CmsRetId appGetUeExtStatusInfoSync(UeExtStatusType statusType, UeExtStatusInfo *pStatusInfo);
CmsRetId appSetAttachBearerSync(SetAttachBearerParams *pAttachBearerParams);
CmsRetId appGetAttachBearerSettingSync(GetAttachBearerSetting *pAttachBearerSettingParams);
CmsRetId appGetCsconStateSync(UINT8 *pCsconState);
CmsRetId appGetWifiScanInfo(SetWifiScanParams *pWifiScanParams, GetWifiScanInfo *pWifiScanInfo);
/**
\fn CmsRetId appSetSIMHotSwapNotify(BOOL bSimPlugIn)
\brief Send fast signal to CMS task, then trigger cmi request to notify PS the SIM card plugged in or out
\param[in] BOOL bSimPlugIn, indicated whether the SIM card plugged in (TRUE) or out (FALSE)
\returns CmsRetId
\NOTE: this API called by app tasks or ISR (interrrupt service routine)
*/
CmsRetId appSetSIMHotSwapNotify(BOOL bSimPlugIn);
CmsRetId appTriggerTau(UINT8 epsUpdateType);
/**
\fn appSetECSIMCFGSync
\brief Send cmi request to set ECSIMCFG
\param[in] EcSimCfgSetParams *pEcSimCfgSetParams, the pointer to EcSimCfgSetParams
\returns CmsRetId
\NOTE:
*/
CmsRetId appSetECSIMCFGSync(EcSimCfgSetParams *pEcSimCfgSetParams);
/**
\fn CmsRetId appGetECSIMCFGSync
\brief Send cmi request to get ECSIMCFG information
\param[out] EcSimCfgGetParams *pEcSimCfgGetParams, the pointer to the EcSimCfgGetParams
\returns CmsRetId
*/
CmsRetId appGetECSIMCFGSync(EcSimCfgGetParams *pEcSimCfgGetParams);
/**
\fn appSetPinOperationSync
\brief Send cmi request to operate SIM PIN.
\param[in] SetPinOperReqParams *pPinOperReqParams, the pointer to SetPinOperReqParams
\returns CmsRetId
\NOTE: This API implements PIN operation feature:
1 Enable & disable PIN //AT+CLCK=<fac>,<mode>[,<passwd>]
2 Verify & unblock PIN //AT+CPIN=<pin>[,<new pin>]
3 Change PIN //AT+CPWD=<fac>,<oldpwd>,<newpwd>
*/
CmsRetId appSetPinOperationSync(SetPinOperReqParams *pPinOperReqParams);
/**
\fn CmsRetId appGetPINStateSync
\brief Send cmi request to get CPIN state or SIM lock status depend on type input
\param[in] GetPinStateType type, get PIN state type referred to "AT+CPIN?" or "AT+CLCK="SC",2"
\param[out] GetPinStateCnfParams *pGetPinStateCnfParams, the pointer to the GetPinStateCnfParams
\returns CmsRetId
*/
CmsRetId appGetPINStateSync(GetPinStateType type, GetPinStateCnfParams *pGetPinStateCnfParams);
/**
\fn CmsRetId appManualPlmnSearch
\brief Send cmi request to perform manual PLMN search
\param[in] uint32 gardTimer (second)
\param[out] ManualPlmnSearchInfo *pManualPlmnSearchInfo
\returns CmsRetId
*/
CmsRetId appManualPlmnSearch(UINT32 gardTimer, ManualPlmnSearchInfo *pManualPlmnSearchInfo);
/**
\fn CmsRetId appManualPlmnSelect
\brief Send cmi request to set Manual PLMN register
\param[in] UINT8 mode, CHAR *pPlmnStr
\returns CmsRetId
*/
CmsRetId appManualPlmnSelect(UINT8 mode, CHAR *pPlmnStr);
/**
\fn CmsRetId appAutoPlmnSelect
\brief Send cmi request to perform auto PLMN search
\returns CmsRetId
*/
CmsRetId appAutoPlmnSelect();
/**
\fn CmsRetId appGetCurrentOperatorInfo
\brief Send cmi request to get the current operator info
\param[out] GetCurrentOperatorInfo *pOperInfo
\returns CmsRetId
*/
CmsRetId appGetCurrentOperatorInfo(GetCurrentOperatorInfo *pOperInfo);
/**
\fn CmsRetId appSetPSMSetting(UINT8 psmMode, UINT32 tauTime, UINT32 activeTime)
\brief Send cmi request to set PSM setting information
\param[out] psmMode Value to input psm mode--psmmode with the Enum "CmiMmPsmReqModeEnum"
\CMI_MM_DISABLE_PSM(0)/CMI_MM_ENABLE_PSM(1)/CMI_MM_DISCARD_PSM(2)
\param[out] tauTimeS Value to input TAU time(unit: S)---related to T3412
\param[out] activeTimeS Value to input active time(unit: S)---related to T3324
\returns CmsRetId
*/
CmsRetId appSetPSMSetting(UINT8 psmMode, UINT32 tauTimeS, UINT32 activeTimeS);
/**
\fn CmsRetId appGetPSMSetting(UINT8 *psmmode, UINT32 *tauTime, UINT32 *activeTime)
\brief Send cmi request to get PSM setting information
\param[out] *psmmode Pointer to store the result mode--psmmode with the Enum "CmiMmPsmReqModeEnum"
\CMI_MM_DISABLE_PSM(0)/CMI_MM_ENABLE_PSM(1)/CMI_MM_DISCARD_PSM(2)
\param[out] *tauTimeS Pointer to store the result TAU time(unit:S)---related to T3412
\param[out] *activeTimeS Pointer to store the result active time(unit:S)---related to T3324
\returns CmsRetId
*/
CmsRetId appGetPSMSetting(UINT8 *psmMode, UINT32 *tauTimeS, UINT32 *activeTimeS);
/**
\fn CmsRetId appSetECSCLKEXSync(EcSclkExSetParamsReq *pEcSclkExSetParamsInfo)
\brief Send cmi request to set ECSCLKEX setting information
\param[in] EcSclkExSetParamsReq *pEcSclkExSetParamsInfo, the pointer to the EcSclkExSetParamsReq
\returns CmsRetId
*/
CmsRetId appSetECSCLKEXSync(EcSclkExSetParamsReq *pEcSclkExSetParamsInfo);
/**
\fn CmsRetId appGetECSCLKEXSync(TrafficIdleMonitorInfo *pTrafficIdleMonitorInfo)
\brief Request PS to get traffic idle monitor Info of AT+ECSCLKEX?
\param[out] pTrafficIdleMonitorInfo Pointer to store the result of traffic idle monitor info
\returns CmsRetId
*/
CmsRetId appGetECSCLKEXSync(EcSclkExGetParamsReq *pEcSclkExGetParamsInfo);
/**
\fn CmsRetId appGetSignalQualitySync(UINT8 *csq, INT8 *snr, INT8 *rsrp, UINT *rsrq)
\brief Get signal information
\param[out] *csq Pointer to signal info csq
* CSQ mapping with RSSI
*<rssi>: integer type
* 0 -113 dBm or less
* 1 -111 dBm
* 2...30 -109... -53 dBm
* 31 -51 dBm or greater
* 99 not known or not detectable
\param[out] *snr Pointer to signal info snr(value in dB, value range: -20 ~ 40);
\param[out] *rsrp Pointer to signal info rsrp(value range: -17 ~ 97, 127);
* 1> AS extended the RSRP value in: TS 36.133-v14.5.0, Table 9.1.4-1
* -17 rsrp < -156 dBm
* -16 -156 dBm <= rsrp < -155 dBm
* ...
* -3 -143 dBm <= rsrp < -142 dBm
* -2 -142 dBm <= rsrp < -141 dBm
* -1 -141 dBm <= rsrp < -140 dBm
* 0 rsrp < -140 dBm
* 1 -140 dBm <= rsrp < -139 dBm
* 2 -139 dBm <= rsrp < -138 dBm
* ...
* 95 -46 dBm <= rsrp < -45 dBm
* 96 -45 dBm <= rsrp < -44 dBm
* 97 -44 dBm <= rsrp
* 2> If not valid, set to 127
\param[out] *rsrq Pointer to signal info rsrq(value range: -30 ~ 46, 127);
* 1> AS extended the RSRQ value in TS 36.133-v14.5.0, Table 9.1.7-1/Table 9.1.24-1
* -30 rsrq < -34 dB
* -29 -34 dB <= rsrq < -33.5 dB
* ...
* -2 -20.5 dB <= rsrq < -20 dB
* -1 -20 dB <= rsrq < -19.5 dB
* 0 rsrq < -19.5 dB
* 1 -19.5 dB <= rsrq < -19 dB
* 2 -19 dB <= rsrq < -18.5 dB
* ...
* 32 -4 dB <= rsrq < -3.5 dB
* 33 -3.5 dB <= rsrq < -3 dB
* 34 -3 dB <= rsrq
* 35 -3 dB <= rsrq < -2.5 dB
* 36 -2.5 dB <= rsrq < -2
* ...
* 45 2 dB <= rsrq < 2.5 dB
* 46 2.5 dB <= rsrq
* 2> If not valid, set to 127
\returns CmsRetId
*/
CmsRetId appGetSignalQualitySync(UINT8 *csq, INT8 *snr, INT8 *rsrp, INT8 *rsrq);
#endif

View File

@@ -0,0 +1,80 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of AirM2M Ltd.
* File name: ps_sync_cnf.h
* Description: EC618 opencpu pssynccnf header file
* History: Rev1.0 2018-12-10
*
****************************************************************************/
#ifndef __PS_SYNC_CNF_H__
#define __PS_SYNC_CNF_H__
#include "cms_util.h"
#include "osasys.h"
/*
* 1> CMS task OSA timer ID defination:
*
* 16 bits timerID
* 15 12 0
* +-------+---------------------+
* | modId | timerId in modId |
* +-------+---------------------+
* MSB 4 bits: use to distinguish which sub-module in CMS task, so MAX 16 sub-modes
*
* 2> AT timer sub-module ID: CMS_TIMER_APP_PS_BLOCK_REQ_SUB_MOD_ID
*
* 3> AT sub timer ID defination:
* 15 12 8 7 3 0
* +-------+------+-------+-----+
* | 2 | | HID |
* +-------+------+-------+-----+
*
* HID: sub handler ID, 4 bits
*
* 4> ReqHander:
* APP_PS_BLOCK_REQ_START_HANDLER + HID
*/
#define APP_SET_BLOCK_REQ_GUARD_TIMER_ID(hId) \
(UINT16)((((CMS_TIMER_APP_PS_BLOCK_REQ_SUB_MOD_ID)<<12)&0xF000) | ((hId)&0x0F))
#define APP_GET_BLOCK_REQ_GUARD_TIMER_SUB_HDR_ID(timerId) ((timerId)&0x0F)
/******************************************************************************
*****************************************************************************
* API
*****************************************************************************
******************************************************************************/
//CmsRetId addPsCmiReqtoList(UINT16 requestId, void *cmiRequest);
CmsRetId psSyncProcErrCode(UINT16 result);
/*
* Callback API, runing in CMS task
*/
void psBlockCmiReqCallback(void *pArg);
/*
* Proc "SIG_CAM_CMI_CNF", which handler between: APP_PS_BLOCK_REQ_START_HANDLER ~ APP_PS_BLOCK_REQ_END_HANDLER
*/
void psBlockProcCmiCnf(const SignalBuf *pSig);
/*
* Proc "OSA_TIMER_EXPIRY", which timer sub-mod ID is: CMS_TIMER_APP_PS_BLOCK_REQ_SUB_MOD_ID
*/
void psBlockProcTimerExpiry(OsaTimerExpiry *pTimerExpiry);
/*
* Get Net info from netmgr, this API called by: appGetNetInfoSync(), and running in CMS task
*/
CmsRetId psGetNetInfoSynCallback(UINT16 inputSize, void *pInput, UINT16 outputSize, void *pOutput);
#endif