📄 def.h
字号:
#ifndef __DATATYPE_H
#define __DATATYPE_H
#define NULL 0
#define STATUS_ERR 1
#define STATUS_OK 0
typedef void (* PrVoid)(void);
typedef PrVoid (*PrPrVoid)(void);
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
typedef signed char S8;
typedef signed short S16;
typedef signed int S32;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int DWORD;
//***********************************************************
extern unsigned char uncorrect_answer_b[5];
extern unsigned char uncorrect_answer_a[5];
extern signed int upload_len;
extern unsigned char strGPRMC[6]; //$GPRMC 1
extern unsigned char strGPGGA[6]; //$GPGGA 2
extern unsigned char strGPGSA[6]; //$GPGSA 3
extern unsigned char strPGRME[6]; //$PGRME 5
extern unsigned char strOK[2]; //OK 5
extern unsigned char strERROR[5]; //ERROR 5
extern unsigned char strCONNECT[7]; //CONNECT 5
extern unsigned char str460[3]; //460 for china find CIMI
//*********GPRS command
/*unsigned char code
strGPRSCOM[17]={0x41,0x54,0x44,
0x31,0x33,0x36,0x38,0x38,0x38,0x36,0x34,0x39,0x32,0x30,
0x3b,0x0d,0x0a}; //"ATD13688864920;CrLf"
*/
extern unsigned char strGPRS_RTS[10]; //"AT+IFC=0" like RTS=1
extern unsigned char strGPRS_ATE0[6]; //ATE0 =no echo ATE1=echo
extern unsigned char sGPRS_CGDCONT[27];
//AT+CGDCONT=1,"IP","CMNET"CrLf
extern unsigned char strGPRS_AT[4]; //"ATCrLf"
extern unsigned char sGPRS_CGREG[11]; //"AT+CGREG?CrLf"
extern unsigned char sGPRS_CIMI[9]; //"AT+CIMICrLf"
extern unsigned char sGPRS_ACTIP[14]; //"AT*E2IPA=1,1
extern unsigned char sGPRS_ACTIPstatus[11]; //"AT*E2IPA?CrLf
extern unsigned char sGPRS_GETIP[12]; //"AT*E2IPI=0
extern unsigned char sGPRS_OPENTCPIP[36]; //CrLf
//"AT*E2IPO=1,"211.095.204.197",09000CrLf" mao //TCP
//"AT*E2IPO=0,"211.095.204.197",09090CrLf" liyunzheng //UDP
extern unsigned char sGPRS_OPENTCPIPstatus[11]; //AT*E2IPO?CrLf
extern unsigned char sGPRS_CLOSETCPIP[10]; //"AT*E2IPCCrLf"
extern unsigned char sGPRS_SETUPIPPARA[15]; //"AT*E2IPS=,,1,CrLf"
extern unsigned char sGPRS_GETIPPARA[11]; //"AT*E2IPS?CrLf
extern unsigned char sGPRS_ATO[5]; //"ATOCrLf" //RETURN TO ONLINE DATA MODE =CONNECT NO CARRIER ERROR
extern unsigned char sGPRS_DATA[14]; //DATA
//***********************************************************
#define DBUFgprslen 0x500
extern U8 Dgprs[DBUFgprslen]; // for gprs
#define DBUFgpslen 0x1000
extern U8 Dgps[DBUFgpslen]; // for gps
extern U8 DBUFA[0x1000]; //temp
extern U8 DBUFB[0x1000]; //temp
extern U8 DBUF0[0x100F]; // for cpu serial (4K+9)*2 byte for one frame of cpu
extern U8 DBUF1[0x100F]; // for cpu serial
extern U8 FrameServerIP[20]; // for a frame of Comm Server IP port #100 or 6
extern U8 FramegpsHistory[40]; // for a frame of gps history data #101
extern U32 ReadFlashHistoryP32; //4B Read flash point for gps history data not sending to server
extern U32 FlashHistoryP32; //4B write flash point for gps history data
extern U8 FrameReqTime[14]; // for a frame of ReqTime #104
extern U8 FramegpsService[40]; // for a frame of Service gps #101
extern U8 Bconstant[256]; //basic constant
extern U8 FrameAnswer[4]; // for a frame of Answer #256+x
extern U16 TerminalID16H; //2B
extern U16 TerminalID16M; //2B
extern U16 TerminalID16L; //2B
extern U8 FrameSMS[256]; // for a frame of Report SMS #1 #2
extern U8 FrameReport[16]; // for a frame of Report GPS SET #3
extern U8 FrameMessage[272]; // for a frame of message #4 or #5
extern U8 FrameReqGps[28]; // for a frame of Require GPS Data #8
extern U8 FrameComm[20]; // for a frame of Comm Terminal IP port #100 or 6
extern U8 HavereceiFlag[7]; // flag of having received
extern U8 Framegpsx[40]; // for a frame of gps #101
extern U8 FrameConf[20]; // for a frame of Confirm #102
extern U8 DBUFc[0x20]; // for chinese dot
extern U16 current_GPS_point;
extern U16 deal_GPS_point;
extern U16 SerialID16; //terminal serial ID 2 Byte
extern U16 SerSerialID16; //server serial ID 2 Byte
typedef struct{
U16 year;
U8 month;
U8 day;
U8 weekday;
U8 hour;
U8 min;
U8 sec;
}TIME_STRUC;
//定义结构
//******************basic constant***********************
typedef struct //basic constant STRU
{
U8 IPaddr[4]; //4B 00 211.095.204.197
U16 IPport; //2B 04 9090
U8 AlarmSum; //1B 06 6
U8 serviceSum; //1B 07 12
U8 MessageSum; //1B 08 10
U8 RunReport; //1B 09 8
U8 stopReport; //1B 10 8
} sConstant;
extern sConstant *pConstantvar,*pConstantvar1;
//******************Answer***********************
typedef struct //Answer STRU
{
U16 OperCode; //2B //14B
U16 ID; //2B
} sAnswer;
extern sAnswer *pAnswervar;
//******************Down***********************
typedef struct //SMS STRU
{
U16 OperCode; //2B value=#1 or #2 //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
U16 Length; //2B //value=2
U16 check; //2B
U8 Message[200]; //200B //200B
} sSMS;
extern sSMS *pSMSvar,*pSMSvarB;
typedef struct //Report GPS STRU
{
U16 OperCode; //2B value=#3 //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
U16 Length; //2B //value=2
U16 check; //2B
U8 RunReport; //1B //2B
U8 stopReport; //1B
} sReport;
extern sReport *pReportvar;
typedef struct //Message STRU
{
U16 OperCode; //2B value=#4 or #5 //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
U16 Length; //2B
U16 check; //2B
U8 MessageSum; //1B //257B
U8 Message[256]; //256B
} sMessage;
extern sMessage *pMessagevar,*pMessagevarB;
typedef struct //Require GPS Data storage in FLASH STRU
{
U16 OperCode; //2B //value=#8 //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
U16 Length; //2B //value=8Byte
U16 check; //2B
U16 StartYear; //2B //14B
U8 Starttime[5]; //5B
U16 EndYear; //2B
U8 Endtime[5]; //5B
} sReqGps;
extern sReqGps *pReqGpsvar;
//******************UP***********************
typedef struct //Comm Register STRU #100 or #6
{
U16 OperCode; //2B //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
U16 Length; //2B
U16 check; //2B
U8 IPaddr[4]; //4B //6B
U16 IPport; //2B
} sCommReg;
extern sCommReg *pCommRegvar,*pServerIpvar;
typedef struct //GPS DATA STRU #101
{
U16 OperCode; //2B //14B
U16 TerminalID0; //2B
U16 TerminalID1; //2B
U16 TerminalID2; //2B
U16 ID; //2B
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -