⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 struct_def.h

📁 通过车载终端采集GPS数据
💻 H
字号:
#ifndef STRUCT_DEF
#define STRUCT_DEF

#include "typedef.h"

#define TIME_SIZE       6/*年月日时分秒*/
#define LINEID_SIZE     4/*线路ID的空间*/
#define TERMINALID_SIZE 3/*终端ID的空间*/
#define BUSID_SIZE      7/*汽车ID的空间*/
#define STATIONID_SIZE  4/*站台ID的空间*/
#define PHONE_NUMBER    6/*电话号码的空间*/
#define ICCID_SIZE      10/*SIM卡号码的空间*/
#define LONGITUDE       4/*经度*/
#define LATITUDE        4/*纬度*/
#define T_MESSAGE         140/*文本消息内容*/
#define STATIONNUM_SIZE  1/*站台序号的空间*/

/**************  消息头 *************/

struct _mess_head_info		
{
	Uchar mess_sync[4];
	Uchar mess_version;			
	Uchar mess_reserve;
	Word  mess_type;
	Word  mess_chksum;
	Word  mess_length;
};

/*心跳包*/
typedef struct _bus_heartbeat
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/  
    Byte  terminal_id[TERMINALID_SIZE];/*终端ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
}BUS_HEARTBEAT;

/*******************定位信息**************************/
typedef struct _bus_position
{
    struct _mess_head_info  mess_head;  
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  station_id[STATIONID_SIZE];/*站台ID*/
    Byte  tag;/*0x00表示无任务时剩余时间(距离)无效,0x01为无任务时剩余时间,0x02为无任务时剩余距离;0x10表示有任务时剩余时间(距离)无效,0x11为有任务时剩余时间,0x12为有任务时剩余距*/
    Byte  terminalid[TERMINALID_SIZE];
    Byte  renew;/*补ff*/
    Byte  gps_flag;/*gps有效标志*/
    Int32 longitude;/*经度*/
    Int32 latitude;/*纬度*/
    Uchar  date[3];
    Uchar  time[3];
    Int16 speed;/*速度*/
    Int32 direction;/*方向*/
}BUS_POSITION;

/*******行驶状态(到/出站)/按键汇报消息************/
typedef struct _bus_runmode
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  station_id[STATIONID_SIZE];/*站台ID*/
    Byte  station_num;/*站台序号*/
    Byte  rundir;/*行车方向*/
    Byte  messmode;/*消息类型*/
}BUS_RUNMODE;

/*******行驶状态(到/出站)/按键汇报消息************/
typedef struct _ack_message
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Uchar  date[3];
    Uchar  time[3];
    Uchar message_id[4];
}ACK_MESSAGE_FRAME;

/*******客流采集汇报消息************/
typedef struct _bus_passenger
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  station_id[STATIONID_SIZE];/*站台ID*/
    Byte  station_num;/*站台序号*/
    Byte  rundir;/*行车方向*/
    Byte  messmode;/*消息类型*/
    Byte  time[3];/*时间:时、分、秒*/
    Byte  upnumber;/*上车人数*/
    Byte  downnumber;/*下车人数*/
    Int16 number;/*当前车上人数*/ 
    Byte gpsTime[6];
}BUS_PASSENGER;

/*******上下班汇报消息************/
typedef struct _bus_assess
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  station_id[STATIONID_SIZE];/*站台ID*/
    Byte  sta_num;/*站台序号*/
    Byte  rundir;/*行车方向*/
    Byte  messagetype;/*消息类型*/
    Byte  terminalid[15];/*终端自编号*/
    Byte  driverid[4];
}BUS_ASSESS;

/***新版本的注册消息定义****/
typedef struct _bus_assess_new
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  station_id[STATIONID_SIZE];/*站台ID*/
    Byte  sta_num;/*站台序号*/
    Byte  rundir;/*行车方向*/
    Byte  messagetype;/*消息类型*/
    Byte  driverid[4];
    Byte  time[6];//时间
    Byte  hostId[3];//主机ID
    Byte termId[3];//终端ID
    Byte hostSoft[4];//主机软件版本
    Byte termSoft[4];//终端软件版本
    Byte res;//保留
    Byte simcard[20];
    Byte line[24];
}BUS_ASSESS_NEW;

/*******文本消息************/
typedef struct _bus_text
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Uchar  date[3];
    Uchar  time[3];
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  mess_date[128];
}BUS_TEXT;

/*******报警消息************/
/*以下定义几种报警类型*/
#define LOOKBUS_ALARM 0x01//看车状态报警
#define STEALBUS_ALARM 0x02//车辆防盗设备报警
#define OUTLINE_ALARM 0x04//越界报警
#define CHANGEDIRECTION_ALARM 0x08//转向报警
#define OVERLOAD_ALARM 0x10//超载报警
#define NOTSTOP_ALARM 0x20//"溜站"报警
#define SUPERSPEED_ALARM 0x40//超速报警
#define HURRY_ALARM 0x80//应急报警
typedef struct _bus_alarm
{
    struct _mess_head_info  mess_head;
    Int32 messageid;/*消息序号*/
    Uchar  date[3];
    Uchar  time[3];
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Uchar runmode;/*行车状态*/
    Uchar gps_flag;/*gps有效标志*/
    Int32 longitude;/*经度*/
    Int32 latitude;/*纬度*/
    Int16 speed;/*速度*/
    Int16 direction;/*方向*/
    Byte alarmStatus;
    Byte changeStatus;
}BUS_ALARM;


/****照片消息*****/
typedef struct _remote_photomsg
{
    struct _mess_head_info  mess_head;
    Byte messageid[4];/*消息序号*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Uint16 packNum;
    Uint16 curNum;
    Byte memo[512];
}REMOTE_PHOTOMSG;
/*******调度消息应答************/
typedef struct _res_direct
{
    struct _mess_head_info  mess_head;
    Byte  line_id[LINEID_SIZE];/*线路ID*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/ 
    Byte res_messageid[4];/*消息序号*/ 
}RES_DIREC;

/********终端参数配置应答************/
typedef struct _res_configure
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  res_value;/*返回值*/
}RES_CONFIGUR;

/********查询位置信息应答************/
typedef struct _res_seeposition
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Uchar  date[3];
    Uchar  time[3];
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  res_value;/*返回值*/
    Uchar runmode;/*行车状态*/
    Uchar gps_flag;/*gps有效标志*/
    Int32 longitude;/*经度*/
    Int32 latitude;/*纬度*/
    Int16 speed;/*速度*/
    Int16 direction;/*方向*/
}RES_SEEPOSITIO ;

/********查询终端信息应答************/
typedef struct _res_seeterminal
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  res_value;/*返回值*/
    Byte  soft_edition;/*软件版本*/
//	Byte  hard_edition;/*硬件版本*/
//	Byte  phone_num[PHONE_NUMBER];/*电话号码*/
//	Byte  iccid[ICCID_SIZE];/*SIM卡号码的空间*/
}RES_SEETERMINA;

typedef struct _debug_remote
{
    Uint16 totalPacket;
    Uint16 curPacket;
    Uint16 addr;
}DEBUG_REMOTE;
typedef struct _res_remote_update
{
    struct _mess_head_info  mess_head;
    Uchar messageid[4];/*消息序号*/
    Byte type;//程序类型
    Byte bus_id[BUSID_SIZE];//车辆ID
    DEBUG_REMOTE content;//包括:总包数、当前包序号、目标程序起始位置
}RES_REMOTE_UPDATE;

/********远程更新下载应答************/
typedef struct _res_update
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  res_value;/*返回值*/
    Word  block;/*返回的block*/
    Byte  update_type;/*更新内容的种类*/
}RES_UPDAT;

/********查询终端参数配置应答************/
typedef struct _res_seeconfigure
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Byte  terminal_id[TERMINALID_SIZE];/*终端id*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  res_value;/*返回值*/
    Byte  heartbeat_interval;/*心跳间隔*/
    Word  potision_interval;/*gps间隔*/
    Byte  in_distance;/*到站距离*/
    Byte  out_distance;/*出站距离*/
}RES_SEECONFIGUR;


typedef struct _res_photoMessage_str
{
    struct _mess_head_info  mess_head;
    Uchar messID[4];
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
}RES_PHOTOMESSAGE_STR;
/*******通用消息应答************/
typedef struct _res_general
{
    struct _mess_head_info  mess_head;
    Byte  memo[100];/*线路ID*/
}RES_GENERAL;


/*********查询广告通告应答************/
typedef struct _res_querynotice
{
    struct _mess_head_info  mess_head;
    Int32 res_messageid;/*消息序号*/
    Byte  bus_id[BUSID_SIZE];/*汽车ID*/
    Byte  seq;//序号
    Byte  type;
    Uchar  date[3];
    Uchar  time[3];
}RES_QUERYNOTICE_STRUCT;

/***********************发送/接收缓存结构*****************/
typedef struct protocol_send_buffer_struct
{
    Byte valid[6];
    Byte buf[6][255];
}PROTOCOL_SEND_BUFFER;

extern PROTOCOL_SEND_BUFFER sbuf;/*缓存*/

/*****单独定义商船上传照片的缓存*************************/
typedef struct protocol_photo_buffer_struct
{
    Byte valid;
    Byte buf[550];
}PROTOCOL_PHOTO_BUFFER;

extern PROTOCOL_PHOTO_BUFFER sbufPhoto;/*传送照片缓存*/
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -