| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #ifndef __PROC_H__
- #define __PROC_H__
- #include "stm32f10x.h"
- #include "gw_ctrl.h"
- #define FIRST_SYSTEM_TYPE 0x01 //系统类
- #define SECOND_SYSTEM_TRANS_DOWN 0x1052 //透传下行
- #define SECOND_SYSTEM_TRANS_UP 0x2052 //透传上行
- #define SECOND_SYSTEM_PROT_DOWN 0x1007 //版本问询下行
- #define SECOND_SYSTEM_PROT_UP 0x2007 //版本问询上行
- //3.0协议 透传指令下行
- typedef struct _transparent_down_3_t
- {
- uint16_t first_type; //一级设备类型
- uint32_t first_sn; //一级设备SN
- uint16_t des_type; //目标设备类型
- uint32_t des_sn; //目标设备SN
- uint8_t tax_no; //报税口号 从1开始, 从7开始显示屏的透传
- uint16_t data_len; //数据长度
- uint8_t data[BUSINESS_DATA_LEN]; //数据
- }__attribute__((packed)) transparent_down_3_t;
- //3.0协议 透传指令上行
- typedef struct _transparent_up_3_t
- {
- uint16_t first_type; //一级设备类型
- uint32_t first_sn; //一级设备SN
- uint16_t des_type; //目标设备类型
- uint32_t des_sn; //目标设备SN
- uint8_t tax_no; //报税口号 从1开始, 从7开始显示屏的透传
- uint8_t status; //状态(1:成功 ;2:读取数据超时;3:明文密文状态错误;4:报税口号或枪号错误;5:编码器指令错误;6:报税口正在加油)
- uint16_t data_len; //数据长度
- uint8_t data[BUSINESS_DATA_LEN]; //数据
- }__attribute__((packed)) transparent_up_3_t;
- //协议版本问询下行
- typedef struct _prot_check_down
- {
- uint16_t first_type; //一级设备类型
- uint32_t first_sn; //一级设备SN
- uint16_t rcv_type; //接收设备类型
- uint32_t rcv_sn; //接收设备sn
- uint16_t des_type; //目标设备类型
- uint32_t des_sn; //目标设备SN
- uint32_t reserve; //预留
- }__attribute__((packed)) prot_check_down_t;
- //协议版本问询上行
- typedef struct _prot_check_up
- {
- uint16_t first_type; //一级设备类型
- uint32_t first_sn; //一级设备SN
- uint16_t des_type; //目标设备类型
- uint32_t des_sn; //目标设备SN
- uint32_t reserve; //预留
- uint8_t prover; //协议版本
- }__attribute__((packed)) prot_check_up_t;
- #define TRANSP_DOWN_HEADER_LEN sizeof(transparent_down_3_t)-BUSINESS_DATA_LEN
- #define TRANSP_UP_HEADER_LEN sizeof(transparent_up_3_t)-BUSINESS_DATA_LEN
- #define PROT_DOWN_HEADER_LEN sizeof(prot_check_down_t)
- #define PROT_UP_HEADER_LEN sizeof(prot_check_up_t)
- //接收信息存储
- typedef struct _msg_rcv_info
- {
- uint16_t frame_header; //帧头
- uint8_t proto_Ver; //版本号
- uint32_t msg_id; //消息序列号
- uint8_t first_type; //一级消息类型
- uint16_t second_type; //二级消息类型
- uint16_t msg_len; //消息长度
- uint16_t first_device_type; //一级设备类型
- uint32_t first_device_sn; //一级设备SN
- uint16_t rcv_type; //接收设备类型
- uint32_t rcv_sn; //接收设备sn
- uint16_t des_type; //目标设备类型
- uint32_t des_sn; //目标设备SN
- uint8_t tax_no; //报税口号
- uint8_t gun_no; //枪号
- uint8_t uart; //串口号
- }__attribute__((packed)) msg_rcv_info_t;
- extern msg_rcv_info_t msg_rcv_info;
- void msg_rcv_info_init(void);
- void transparent_up_ver3_return(uint8_t state, uint8_t *data, uint16_t len);
- void coll_rcv_lora_ver3_handle(uint8_t *data, uint16_t len);
- void coll_rcv_lora_verff_handle(uint8_t *data, uint16_t len);
- #endif
|