| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #ifndef __GATEWAY_COLLECT_H__
- #define __GATEWAY_COLLECT_H__
- #include "stm32f10x.h"
- //#include "downlink.h"
- #include "../../APP/network/downlink.h"
- #include "../globalDef.h"
- #include "../ota/ota.h"
- /*采集器与网关通信的消息类型*/
- #define GATE_COLL_HEART_QUERY 0x56 //网关与采集器的下行心跳包
- #define COLL_GATE_HEART_QUERY 0x66 //网关与采集器的上行心跳包
- #define GATE_COLL_TAX_QUERY 0x57 //业务数据下行发送消息
- #define COLL_GATE_TAX_QUERY 0x67 //业务数据上行接收消息
- #define GATE_COLL_FIRMMSG_QUERY 0x58 //网关下发查询固件信息
- #define COLL_GATE_FIRMMSG_QUERY 0x68 //采集器上发固件信息
- #define COLL_GATE_RESTART_QUERY 0x59 //采集器设备重新启动
- #define YTSF_0XA2_0X00 0xA2
- #define YTSF_0XA1_0X11 0xA1
- #define YTSF_0XA1_0X14 0xA4
- #define FRAME_LEN 19
- #define PLAINTEXT 1 //明文
- #define CIPHERTEXT 2 //密文
- #define DISPLAY 3 //显示屏
- #define GATE_COLL_HEAD_LEN 12 // 网关与采集器通信的协议头为12个字节
- #define GATE_COLL_CMD5767_LEN 11 //0x57 0x67指令的长度
- #define GATE_COLL_CMD56_LEN 5 // 56命令的长度
- #define GATE_COLL_CMD58_LEN 5 // 58命令的长度
- #define GATE_COLL_CMD59_LEN 5 // 59命令的长度
- #define GATE_COLL_PROTOTYPE 0x11 // 网关与采集器通信协议的版本
- /*业务数据头0x17 0x27*/
- typedef struct _tax_query_info
- {
- uint32_t device_sn; //设备编号
- uint8_t device_type; // 设备类型 1:报税口 2:显示屏
- uint8_t msg_com; //串口号
- uint8_t coll_no; // 采集器索引 从1开始
- uint8_t tax_no; //报税口号 从1开始
- uint8_t gun_msgid; //枪号 从1开始
- uint8_t prot_type; //协议类型 1:明文 2:密文
- uint8_t status; //1:成功 2:数据超时
- char info[160];
- }__attribute__((packed)) tax_query_info_t;
- /* 心跳0x56 查询固件信息0x58 设备重新启动0x59*/
- typedef struct _TAX_COMM_HEAD_{
- uint32_t device_sn; // 设备编号
- uint8_t coll_no; // 采集器索引 从1开始
- }__attribute__((packed))taxComHead;
- /*心跳返回的数据0x56*/
- typedef struct _TAX_Encry_STATUS_{
- uint32_t device_sn; // 设备编号
- uint8_t coll_no; // 采集器索引 从1开始
- uint8_t factory; // 1:明文 2:密文
- }__attribute__((packed))taxEncryptStatus;
- /*固件信息返回0x58*/
- typedef struct _TAX_FIRM_MSG_{
- uint32_t device_sn; //设备SN
- uint8_t coll_no; // 采集器索引 从1开始
- uint32_t bootloaderVr; // bootloader版本事情
- uint32_t appVr; //APP版本号
- uint32_t resetNum; //复位次数
- uint8_t resetType; //最后一次复位类型
- uint32_t runTime; //运行时间
- uint8_t updateStatus; // 升级状态码
- uint8_t uuid[12]; //UUID
- char info[160]; //数据内容
- }__attribute__((packed))taxFirmMsg;
- typedef union TAX_DATA_INFO_{
- tax_query_info_t data; // 业务数据
- taxComHead comdata; //心跳 查询固件信息 设备重新启动信息
- taxFirmMsg firmMsg; //固件信息
- taxEncryptStatus taxEnStatus; // 心跳包的返回
- char info[160];
- }__attribute__((packed))taxDaInfo;
- /*网关向采集发送或是接收消息的结构体*/
- typedef struct _gateway_collect_com
- {
- uint16_t frame_header; //帧头
- uint8_t proto_ver; //协议版本 0x11
- uint32_t seq_no; //消息序列号
- uint8_t type; //一级消息类型
- uint16_t secondType; // 2级消息类型
- uint16_t len; //消息长度
- taxDaInfo taxinfo; //
- }__attribute__((packed)) gateway_collect_com_t;
- ///////////////////////////
- extern void gateway_net_send_gatewayMsg(void);
- #endif
|