stm32_ota/HARDWARE/LTE/EC20/ec20tcp.h

46 lines
2.5 KiB
C
Raw Normal View History

2023-12-15 06:28:06 +00:00
#ifndef _EC20TCP_H
#define _EC20TCP_H
#include "ec20net.h"
#define TCP_CONTEXTID 1 //1~16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ƹ涨<C6B9><E6B6A8>TCP/IPЭ<50><D0AD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>·1D<31><44><EFBFBD><EFBFBD>contextID=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCP<43><50>·
/*****************************************
*<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
typedef enum //The URC of TCP/IP AT commands will be reported to the host in the format of beginning with <20><>+QIURC:<3A><>
{
CLOSED = 0 , //Socket service connection is closed
RECV = 1 , //receiving data, the module will report a URC to the host
INCOMING_FULL = 2 , //incoming connection reaches the limit
INCOMING_CONT = 3 , //he <service_type> is <20><>TCP LISTENER<45><52>, when a remote client connects to this server
PDPDEACT = 4, //PDP context may be deactivated by the network
UNKNOWM = 5 //δ֪<CEB4><D6AA>URC
} TcpUrcType ; //<2F><>Quectel_EC20_R2.1_AT_Commands_Manual_V1.0<EFBFBD><EFBFBD> P31
typedef struct //contextID:<3A><>·ID connetcID<49><44>ͨ<EFBFBD><CDA8>ID
{
uint8_t connectId ; //TCP<43><50>·ͨ<C2B7><CDA8>ID
uint8_t serverIP[MAX_IP_LEN] ; //TCP<43><50>·ͨ<C2B7><CDA8> <09><>Server IP
uint16_t serverPort ; //TCP<43><50>·ͨ<C2B7><CDA8> <09><>Server PORT
uint16_t localPort ; //TCP<43><50>·ͨ<C2B7><CDA8> <09><>Local PORT
}ChannalP_s ; //<2F><><EFBFBD><EFBFBD>TCPͨ<50><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*****************************************
*<EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
RunResult EC20_SendTcpCmd( uint8_t cmdNum, char *format,... ) ; // EC20ͨ<30><CDA8><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RunResult Open_Socket(uint8_t connectId, uint8_t *serverIp, uint16_t serverPortNum, uint16_t localPortNum ) ; // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>tcpͨ<70><CDA8>
RunResult Close_Socket(uint8_t connectId) ; // <20>ر<EFBFBD>һ<EFBFBD><D2BB>tcpͨ<70><CDA8>
RunResult Query_Socket(uint8_t connectId) ; // <20><>ѯһ<D1AF><D2BB>tcpͨ<70><CDA8>״̬
/*****************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD>õĽӿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ͳһΪChannalP_s *channal
****************************************/
extern RunResult Tcp_PDP_Init( void ) ; //EC20 TCP context<78>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD>μ<EFBFBD><CEBC><EFBFBD>
extern RunResult Tcp_Channal_Init( ChannalP_s *channal ) ; //TCPͨ<50><CDA8><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
extern RunResult Tcp_SendData(ChannalP_s *channal, uint8_t *sendBuf, uint16_t sendLen) ; //ͨ<><CDA8>TCPͨ<50><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern TcpUrcType TcpUrcHandle( char *recvBuf, uint16_t recvLen ) ; //TCP/IPЭ<50><D0AD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>ص<EFBFBD>һдURC<52><43><EFBFBD><EFBFBD><E0B4A6>
#endif