You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

340 lines
16 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #pragma once
  2. #include <stdint.h>
  3. #include "zscanprotocol/zscanprotocol.hpp"
  4. namespace iflytop {
  5. namespace transmit_disfection_protocol {
  6. using namespace zscanprotocol;
  7. #define PROTOCOL_VERSION 6
  8. #define HEART_OVERTIME (30 * 1000)
  9. typedef enum {
  10. klarge_space_disinfection_machine = 1, // 大空间消毒机
  11. ksmall_space_disinfection_machine = 2, // 小空间消毒机
  12. kpipe_disinfection_machine = 3, // 管道式消毒机
  13. kdraw_bar_disinfection_box = 4, // 手持拉杆箱消毒机
  14. kh2o2_ext_sensor = 5, // 外部H2O2传感器
  15. } ProjID_t;
  16. typedef enum {
  17. kBoardType_LiquidCtrl = 1, // 液路板
  18. kBoardType_PowerControl = 2, // 电源板
  19. kBoardType_PowerControlMiniBoard = 3, // 电源控制Mini板,用于拉杆箱箱消毒机
  20. kBoardType_ExtBallValveCtrl = 4, // 外部球阀控制板
  21. kBoardType_H2O2Sensor = 5, // H2O2传感器板
  22. } BoardType_t;
  23. typedef enum {
  24. kFixBoardId_MainBoard = 1, // 主机
  25. kFixBoardId_LiquidCtrl = 2, // 液路板
  26. kFixBoardId_PowerControl = 3, // 电源板
  27. kFixBoardId_ExtBallValveCtrl = 4, // 外部球阀控制板
  28. kFixBoardId_H2O2SensorStart = 100, // H2O2传感器板
  29. } BoardId_t;
  30. static inline const char *BoardTypeToString(uint32_t type) {
  31. switch (type) {
  32. case kBoardType_LiquidCtrl:
  33. return "LiquidCtrl";
  34. case kBoardType_PowerControl:
  35. return "PowerControl";
  36. case kBoardType_PowerControlMiniBoard:
  37. return "PowerControlMiniBoard";
  38. case kBoardType_ExtBallValveCtrl:
  39. return "ExtBallValveCtrl";
  40. case kBoardType_H2O2Sensor:
  41. return "H2O2Sensor";
  42. default:
  43. return "unkown";
  44. }
  45. }
  46. static inline const char *ProjectIDToString(uint32_t id) {
  47. switch (id) {
  48. case klarge_space_disinfection_machine:
  49. return "large_space_disinfection_machine";
  50. case ksmall_space_disinfection_machine:
  51. return "small_space_disinfection_machine";
  52. case kpipe_disinfection_machine:
  53. return "pipe_disinfection_machine";
  54. case kdraw_bar_disinfection_box:
  55. return "draw_bar_disinfection_box";
  56. case kh2o2_ext_sensor:
  57. return "h2o2_ext_sensor";
  58. default:
  59. return "unkown";
  60. }
  61. }
  62. typedef enum {
  63. // 驱动器错误
  64. kerr_motor_reset_error = 100,
  65. kerr_motor_subdevice_offline = 101,
  66. kerr_motor_driver_error = 102,
  67. kerr_motor_undervoltage_error = 103,
  68. kerr_motor_unkown_error = 104,
  69. kerr_AirBlowerError = 200, // 空压机异常
  70. kerr_HeaterError = 201, // 加热片异常
  71. kerr_BlowerError = 202, // 鼓风机异常
  72. kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
  73. } ErrorCode_t;
  74. typedef enum {
  75. /***********************************************************************************************************************
  76. * *
  77. ***********************************************************************************************************************/
  78. kfn_read_board_info = 1, // cmd:no, ack:ack_read_board_info_data_t
  79. kfn_force_report = 2, // cmd:no, ack:none //!delete
  80. kfn_read_sysinfo = 3, // cmd:no, ack:ack_sysinfo_t
  81. kfn_read_taskinfo = 4, // cmd:taskoff, ack:ask_taskinfo_t
  82. kfn_heart_ping = 5, // cmd:pingindex, ack:ask_taskinfo_t
  83. kfn_clear_reset_flag = 6, // cmd:taskoff, ack:ask_taskinfo_t
  84. kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
  85. kreport_exception_error = 51, // report:error_code,subid
  86. /***********************************************************************************************************************
  87. * *
  88. ***********************************************************************************************************************/
  89. /**
  90. * (id,)
  91. *
  92. *
  93. * TMC参数
  94. * TMC参数
  95. * ihold,irun,idelay
  96. *
  97. */
  98. kfn_pump_rotate = 100, // cmd: index rpm ack:none
  99. kfn_pump_stop = 101, // cmd: index rpm ack:none
  100. kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
  101. kfn_pump_set_acc = 104, // cmd: index acc ack:none , delete
  102. kfn_pump_ping = 105, // cmd: index, ack:none
  103. kfn_pump_set_ramp = 106, // cmd: index,vs,a1,amx,v1 ack:none
  104. kfn_pump_set_tzw = 107, // cmd: index,timeZeroWait ack:none
  105. kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
  106. kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
  107. /***********************************************************************************************************************
  108. * MINI真空泵 *
  109. ***********************************************************************************************************************/
  110. /**
  111. * @brief Spray liquid mini air compressor
  112. * /
  113. */
  114. kfn_sl_mini_ac_ctrl = 200, // cmd: power(0-100)
  115. /***********************************************************************************************************************
  116. * MINI真空泵 *
  117. ***********************************************************************************************************************/
  118. /**
  119. * @brief air Tightness Test AirCompressor
  120. * /
  121. *
  122. */
  123. kfn_atta_mini_air_compressor_ctrl = 300, // cmd: power(0-100)
  124. /***********************************************************************************************************************
  125. * *
  126. ***********************************************************************************************************************/
  127. kfn_pressure_sensor_bus_read_data = 400, // cmd:subid ack:pressure(0.1pa)
  128. kfn_pressure_sensor_bus_set_report_period_ms = 401, // cmd:period
  129. kreport_pressure_data = 450, // report:subid pressure(0.1pa)
  130. /***********************************************************************************************************************
  131. * MINI_PWM风机控制 *
  132. ***********************************************************************************************************************/
  133. /**
  134. * @brief
  135. * /
  136. *
  137. *
  138. */
  139. kfn_mini_pwm_blower_ctrl = 500, // cmd: speed(0-100)
  140. kfn_mini_pwm_blower_read_fbcount = 501, // cmd: valve_state
  141. /***********************************************************************************************************************
  142. * *
  143. ***********************************************************************************************************************/
  144. /**
  145. * @brief
  146. * /
  147. *
  148. *
  149. *
  150. *
  151. *
  152. */
  153. kfn_heater_ctrl = 600, // cmd: power(0-100)
  154. kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
  155. kfn_heater_read_electric_current = 602, // report:electric_current(ma)
  156. kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
  157. /***********************************************************************************************************************
  158. * H2O2传感器数值上报 *
  159. ***********************************************************************************************************************/
  160. kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
  161. kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
  162. kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
  163. kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
  164. /***********************************************************************************************************************
  165. * *
  166. ***********************************************************************************************************************/
  167. kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
  168. /***********************************************************************************************************************
  169. * *
  170. ***********************************************************************************************************************/
  171. kfn_evaporation_tank_water_sensor_read_state = 900, // cmd: state
  172. kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
  173. kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
  174. kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
  175. /***********************************************************************************************************************
  176. * *
  177. ***********************************************************************************************************************/
  178. kfn_blower_ctrl = 1000, // cmd: power(0-100)
  179. kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
  180. kfn_blower_read_electric_current = 1002, // report:electric_current(ma)
  181. /***********************************************************************************************************************
  182. * *
  183. ***********************************************************************************************************************/
  184. kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
  185. kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
  186. kfn_air_compressor_read_electric_current = 1102, // report:electric_current(ma)
  187. #if 0
  188. /***********************************************************************************************************************
  189. * H2O2传感器数值上报 *
  190. ***********************************************************************************************************************/
  191. kreport_h2o2_data = 400, // report:subid h2o2_sensor_data
  192. /***********************************************************************************************************************
  193. * *
  194. ***********************************************************************************************************************/
  195. /**
  196. * @brief
  197. * /
  198. */
  199. kfn_electromagnetic_valve_ctrl = 900, // cmd: valve_state
  200. /***********************************************************************************************************************
  201. * *
  202. ***********************************************************************************************************************/
  203. /**
  204. * @brief
  205. * /
  206. */
  207. kfn_ball_valve_ctrl = 1000, // cmd: valve_state
  208. /***********************************************************************************************************************
  209. * *
  210. ***********************************************************************************************************************/
  211. /**
  212. * @brief
  213. * /
  214. *
  215. */
  216. kfn_proportional_valve_ctrl = 1100, // cmd: subid valve_state(0->100)
  217. kreport_proportional_valve_value = 1150, // cmd: subid valve_state(0->100)
  218. /***********************************************************************************************************************
  219. * *
  220. ***********************************************************************************************************************/
  221. kreport_evaporation_bin_water_sensor = 1200, // report:state //蒸发仓水浸
  222. kreport_device_bottom_water_sensor = 1201, // report:state //设备底部水浸
  223. #endif
  224. } cmd_t;
  225. #pragma pack(1)
  226. /***********************************************************************************************************************
  227. * ACK *
  228. ***********************************************************************************************************************/
  229. typedef struct {
  230. uint16_t boardType;
  231. uint16_t projectId;
  232. uint16_t protcol_version;
  233. uint16_t software_version;
  234. uint16_t hardware_version;
  235. } ack_read_board_info_data_t;
  236. typedef struct {
  237. uint8_t taskName[8];
  238. uint16_t stackRemindSize;
  239. uint16_t priority;
  240. uint8_t state;
  241. } ask_taskinfo_t;
  242. typedef struct {
  243. uint32_t total_heap_size;
  244. uint32_t free_heap_size;
  245. uint16_t taskNum;
  246. uint16_t sysHasRun;
  247. } ack_sysinfo_t;
  248. /***********************************************************************************************************************
  249. * Report *
  250. ***********************************************************************************************************************/
  251. typedef struct {
  252. uint16_t heartIndex;
  253. uint8_t boardType;
  254. uint8_t flag; // 0:reset_flag
  255. } report_heatpacket_data_t;
  256. typedef struct {
  257. uint32_t ecode;
  258. uint16_t subid;
  259. } report_exeception_data_t;
  260. #if 1
  261. typedef struct {
  262. uint8_t sensorDataNum;
  263. struct {
  264. uint8_t subid;
  265. int16_t pressureVal;
  266. } data[];
  267. } report_pressure_data_t;
  268. #endif
  269. typedef struct {
  270. uint8_t sensor_error; // 传感器异常
  271. uint16_t h2o2; // ppm * 10
  272. uint16_t humid; // %RH * 10
  273. uint16_t temp; // °C * 10
  274. uint16_t saturation; // %RS * 10
  275. } report_h2o2_data_t;
  276. typedef struct {
  277. uint16_t temperature; // 0.01
  278. } report_heater_temperature_data_t;
  279. typedef struct {
  280. uint16_t subid; // 0->100
  281. uint16_t valve_state; // 0->100
  282. } report_proportional_valve_value_data_t;
  283. typedef struct {
  284. uint16_t state;
  285. } report_water_sensor_state_t;
  286. #pragma pack()
  287. } // namespace transmit_disfection_protocol
  288. } // namespace iflytop