| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #ifndef __DOWNLINK_H__
- #define __DOWNLINK_H__
- #include "stm32f10x.h"
- #include "../network_mgr/net_proc.h"
- #define COLLECT_MAX_NUM 16
- #define TAX_MAX_NUM 2
- #define GUN_MAX_NUM 8
- #define DOWNLINK_CONFIG_TYPE 0x10 //0x65
- #define CONFIG_ADDR 0X100
- #define CONFIG_WRITE 0x01
- //typedef struct _tax_conf
- //{
- // uint8_t tax_id; //报税口编号
- // uint8_t gun_num; //加油枪数量
- // uint8_t gunid[GUN_MAX_NUM]; //加油枪编号
- // uint8_t alrd_sn; //是否查询过加油机的信息
- // uint8_t factory; /*厂家 1:英泰 2:拓盛 */
- // uint8_t status; // 报税口的状态 ,是否连接
- // uint8_t encryption; // 报税口的加密状态 ,由服务器下发的,暂停没有用于
- // uint8_t monitor_serino[16]; //序列号
- //}__attribute__((packed)) tax_conf_t;
- //
- //typedef struct _collect_conf
- //{
- // uint32_t collect_no; //采集器编号
- // uint8_t tax_num; //报税口数量
- // uint8_t tax_type; //报税口类型,明文或密文
- // uint8_t collect_status; // 采集器的状态 在线或是离线 0 离线 1:在线
- // uint8_t coll_send_num; // 采集器发送的次数
- // tax_conf_t tax_conf[TAX_MAX_NUM];
- //}__attribute__((packed)) collect_conf_t;
- typedef struct _downlink_config
- {
- uint8_t config_flag; //采集器配置标记
- uint32_t gateway_id; //网关id
- // uint8_t collect_num; //采集器数量
- // collect_conf_t collect_conf[COLLECT_MAX_NUM];
- }__attribute__((packed)) downlink_config_t;
- extern downlink_config_t downlink_config;
- /*==============================================================*/
- /* 以下是服务器下发 需要用到的解析*/
- /* 升级信息下行 0x1001 */
- typedef struct _downlink_system_cmd_0x1001 {
- uint16_t targetType; // 设备类型(0x0101:网关;0x0201;采集器:0x0301:液位仪采集器;0x0401:屏采集器)
- uint32_t sn; // sn 编号
- uint16_t taskNo; // 任务号
- uint8_t urlLen; // URL长度
- char url[128]; // url地址
- }__attribute__((packed)) downlinkSysCmd0x1001;
- /* 切换mqtt IP地址 0x1003 */
- typedef struct _downlink_system_cmd_0x1003 {
- uint32_t gateway_sn; // 网关SN
- uint16_t targettype; // 类型 0x0101网关 0x0201:采集器 0x0301:液位仪
- uint8_t iplen; // ip地址长度
- uint8_t portlen; // 端口长度
- uint8_t userlen; // 用户名长度
- uint8_t pwdlen; // 密码长度
- // char port[6]; // 端口号
- // char ip[32]; //IP地址
- // char admin[8]; // 用户名
- // char password[16]; // 密码
- uint8_t str[76];
- }__attribute__((packed)) downlinkSysCmd0x1003;
- /* 采集器路由信息初始化 0x1011 */
- typedef struct _configmsg_{
- uint32_t collectSn;
- uint8_t comEncrypt[2]; //报税口的加密状态
- }__attribute__((packed)) configMsg;
- typedef struct _downlink_system_cmd_0x1011 {
- uint32_t gateway_id; //网关SN
- uint8_t collect_num; //采集器数量
- configMsg cfigMsg[16];
- }__attribute__((packed)) downlinkSysCmd0x1011;
- /* 刷新税控序列号 0x1012*/
- typedef struct _downlink_system_cmd_0x1012_{
- uint32_t gateway_sn; // 网关SN
- uint32_t coll_sn; // 采集器编号
- uint8_t tax_no; // 报税口编号
- }__attribute__((packed)) downlinkSysCmd0x1012;
- /* 设备重新启动 0x1021*/
- typedef struct _downlink_system_cmd_0x1021_{
- uint16_t targetType; // 设备类型(0x0101:网关;0x0201;采集器:0x0301:液位仪采集器;0x0401:屏采集器)
- uint32_t sn; // 设备sn号
- }__attribute__((packed)) downlinkSysCmd0x1021;
- /* 状态信息 固件信息下行 0x1001*/
- typedef struct _downlink_status_cmd_0x1001_{
- uint32_t gateway_sn; // 网关ID
- uint16_t targetType; // 设备类型(0x0101:网关;0x0201;采集器:0x0301:液位仪采集器;0x0401:屏采集器)
- uint32_t sn; // 设备编号
- }__attribute__((packed)) downlinkStatusCmd0x1001;
- typedef struct _downlink_data_oil_cmd_0x1021_{
- uint32_t gateway_sn; // 网关编号
- }__attribute__((packed)) downlinkDataOilCmd0x1021;
- typedef struct _downlink_sys_oil_cmd_0x1031_{
- uint32_t gateway_sn; // 网关编号
- uint16_t paraLen; // 参数长度
- char param[48]; // 参数
- }__attribute__((packed)) downlinkSysOilCmd0x1031;
- void downlink_init(void);
- int downlink_gateway_analyze(uint8_t *data, uint16_t len);
- #endif
|