70 lines
3.3 KiB
C
70 lines
3.3 KiB
C
|
#ifndef _USER_TCP_H
|
|||
|
#define _USER_TCP_H
|
|||
|
#include "ec20tcp.h"
|
|||
|
#include "mac.h"
|
|||
|
|
|||
|
/*****************************************
|
|||
|
*<EFBFBD>û<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
****************************************/
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
BOOTTOTCPFRAME = 'B' , //(Ӳ<><D3B2>TX->Tcp server/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>) BOOT<4F><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tcp<63><70><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
|||
|
|
|||
|
TCPHEARTFRAME = 'H' , //(Ӳ<><D3B2>TX->Tcp server)TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
|||
|
TCPLOGFRAME = 'L' , //(Ӳ<><D3B2>TX->Tcp server)Log<6F><67><EFBFBD>ݰ<EFBFBD>
|
|||
|
|
|||
|
TCPSERVERACK = 'A' , //(Tcp server->Ӳ<><D3B2>RX)Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>Log<6F><67><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>Tcp server<65>·<EFBFBD><C2B7><EFBFBD>ACKȷ<4B>ϰ<EFBFBD>
|
|||
|
|
|||
|
TCPCMDFRAME = 'C' , //(Tcp server->Ӳ<><D3B2>RX)<29>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡
|
|||
|
COMCMDFRAME = 'c' , //(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>->Ӳ<><D3B2>RX)<29>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡
|
|||
|
|
|||
|
TCPCMDBACKFRAME = 'R' , //(Ӳ<><D3B2>TX->Tcp server)<29>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>֡֡<D6A1><D6A1>Ӳ<EFBFBD><D3B2><EFBFBD>ظ<EFBFBD>֡
|
|||
|
COMCMDBACKFRAME = 'r' //(Ӳ<><D3B2>TX-><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>)<29>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>֡֡<D6A1><D6A1>Ӳ<EFBFBD><D3B2><EFBFBD>ظ<EFBFBD>֡
|
|||
|
}UPDATATYPE_e ; //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
|
|||
|
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
char head ; //TCP<43><50><EFBFBD><EFBFBD>֡ͷ
|
|||
|
UPDATATYPE_e frameType ; //<2F><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD> UPDATATYPE_eö<65><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char loadLen[3] ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<DDB5><C4B3>ȣ<EFBFBD><C8A3><EFBFBD>loadHead~loadTail<69><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>loadHead<61><64>loadTail<69><6C><EFBFBD>ֽڳ<D6BD><DAB3><EFBFBD>
|
|||
|
uint8_t frameNum ; //<2F><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ţ<EFBFBD><C5A3>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>~<7E><>9<EFBFBD><39>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>
|
|||
|
char macHead[4] ; //mac<61><63>ַ<EFBFBD><D6B7>־ͷ<D6BE>ַ<EFBFBD><D6B7><EFBFBD> <20>̶<EFBFBD><CCB6>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>MAC:<3A><>
|
|||
|
uint8_t macid[MAC_BYTES_LEN] ; //<2F>豸<EFBFBD><E8B1B8>mac<61><63>ַ
|
|||
|
char macTail ; //MAC<41><43>ַ<EFBFBD><D6B7>β<EFBFBD><CEB2>ʶ<EFBFBD><CAB6>
|
|||
|
char cmdCode[2] ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char loadHead ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ '&'
|
|||
|
// char *loadBuf ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
char loadTail ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β <20><>$<24><>
|
|||
|
char reserve ; //Ԥ<><D4A4>1byte <20>̶<EFBFBD>Ϊ<EFBFBD><CEAA>X<EFBFBD><58>
|
|||
|
char tail ; //TCP<43><50><EFBFBD><EFBFBD>֡β
|
|||
|
}TcpFrame_S ; //tcp<63><70><EFBFBD><EFBFBD>֡<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/*****************************************
|
|||
|
*ec20tcp<EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
****************************************/
|
|||
|
#define TCP_LOADBUF_MAXLEN 512 //TCP֡<50><D6A1><EFBFBD>ݸ<EFBFBD><DDB8>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#define TCP_CONNECTID0 0 //TCP0ͨ<30><CDA8> <20><>ID
|
|||
|
#define TCP_CONNECTID0_SERVERIP0 "58.23.31.118" //TCP0ͨ<30><CDA8> <20><>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ip<69><70>ַ
|
|||
|
#define TCP_CONNECTID0_SERVERPORT0 14001 //TCP0ͨ<30><CDA8> <20><>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
|||
|
#define TCP_CONNECTID0_LOCALPORT0 6000 //TCP0ͨ<30><CDA8> <20>ı<EFBFBD><C4B1>ض˿<D8B6>
|
|||
|
|
|||
|
extern ChannalP_s sChannal0 ; //TCPͨ<50><CDA8>0<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/*****************************************
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD>ⲿʹ<EFBFBD>õij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
****************************************/
|
|||
|
extern FrameQueue_s sTcp0Queue ; //<2F><>ҪTCP connect0<74><30><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ˻<DAB4><CBBB>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>OS<4F><53><EFBFBD>и<EFBFBD>TCP<43><50><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һֱ<D2BB>ڷ<EFBFBD><DAB7><EFBFBD>TCP<43><50><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/*****************************************
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
****************************************/
|
|||
|
extern void SetAppTcpIP(ChannalP_s *psChannal, char* ip) ; //<2F><><EFBFBD>õ<EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
|||
|
extern void SetAppTcpPort(ChannalP_s *psChannal, char* port) ; //<2F><><EFBFBD>õ<EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PORT
|
|||
|
extern RunResult AppTcpInit(void) ; //<2F><>ʼ<EFBFBD><CABC>Ӧ<EFBFBD><D3A6>TCP<43><50>·<EFBFBD><C2B7>PDP<44>ʹ<EFBFBD><CDB4><EFBFBD>TCP0<50><30>ͨ<EFBFBD><CDA8>SOCKET<45><54><EFBFBD><EFBFBD>
|
|||
|
extern void TcpDisconnetc(void) ; //<2F>Ͽ<EFBFBD>Socket ȥ<><C8A5><EFBFBD><EFBFBD>TCP<43><50>·<EFBFBD><C2B7>PDP
|
|||
|
extern RunResult TcpUpdata( UPDATATYPE_e updataType, char *format, ...) ; //ͨ<><CDA8>TCP<43><50><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>TCP SERVER
|
|||
|
|
|||
|
|
|||
|
#endif
|