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.

317 lines
14 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months 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. kLargeSpaceDMLiquidCtrlBoard = 1, // 大空间消毒机液路板
  18. kLargeSpaceDMPowerCtrlBoard = 2, // 大空间消毒机电源板
  19. kSmallSpaceDMLiquidCtrlBoard = 3, // 小空间消毒机液路板
  20. kSmallSpaceDMPowerCtrlBoard = 4, // 小空间消毒机电源板
  21. kPipeDMLiquidCtrlBoard = 5, // 管道式消毒机液路板
  22. kPipeDMPowerCtrlBoard = 6, // 管道式消毒机电源板
  23. kDrawBarDMLiquidCtrlBoard = 7, // 手持拉杆箱消毒机液路板
  24. kDrawBarDMPowerCtrlBoard = 8, // 手持拉杆箱消毒机电源板
  25. kDrawBarDMExtChSelector = 9, // 手持拉杆箱消毒机外部球阀控制板
  26. kH2O2SensorBoard = 10, // H2O2传感器板
  27. } BoardTypeId_t;
  28. typedef enum {
  29. kFixBoardId_MainBoard = 1, // 主机
  30. kFixBoardId_LiquidCtrl = 2, // 液路板
  31. kFixBoardId_PowerControl = 3, // 电源板
  32. kFixBoardId_ExtChSelector = 4, // 外部球阀控制板
  33. kFixBoardId_H2O2SensorStart = 100, // H2O2传感器板
  34. } BoardId_t;
  35. static inline const char* BoardTypeId2Str(uint32_t id) {
  36. switch (id) {
  37. case kLargeSpaceDMLiquidCtrlBoard:
  38. return "LargeSpaceDMLiquidCtrlBoard";
  39. case kLargeSpaceDMPowerCtrlBoard:
  40. return "LargeSpaceDMPowerCtrlBoard";
  41. case kSmallSpaceDMLiquidCtrlBoard:
  42. return "SmallSpaceDMLiquidCtrlBoard";
  43. case kSmallSpaceDMPowerCtrlBoard:
  44. return "SmallSpaceDMPowerCtrlBoard";
  45. case kPipeDMLiquidCtrlBoard:
  46. return "PipeDMLiquidCtrlBoard";
  47. case kPipeDMPowerCtrlBoard:
  48. return "PipeDMPowerCtrlBoard";
  49. case kDrawBarDMLiquidCtrlBoard:
  50. return "DrawBarDMLiquidCtrlBoard";
  51. case kDrawBarDMPowerCtrlBoard:
  52. return "DrawBarDMPowerCtrlBoard";
  53. case kDrawBarDMExtChSelector:
  54. return "kDrawBarDMExtChSelector";
  55. case kH2O2SensorBoard:
  56. return "H2O2SensorBoard";
  57. default:
  58. return "unkown";
  59. }
  60. }
  61. static inline const char* ProjectIDToString(uint32_t id) {
  62. switch (id) {
  63. case klarge_space_disinfection_machine:
  64. return "large_space_disinfection_machine";
  65. case ksmall_space_disinfection_machine:
  66. return "small_space_disinfection_machine";
  67. case kpipe_disinfection_machine:
  68. return "pipe_disinfection_machine";
  69. case kdraw_bar_disinfection_box:
  70. return "draw_bar_disinfection_box";
  71. case kh2o2_ext_sensor:
  72. return "h2o2_ext_sensor";
  73. default:
  74. return "unkown";
  75. }
  76. }
  77. typedef enum {
  78. // 驱动器错误
  79. kerr_motor_reset_error = 100,
  80. kerr_motor_subdevice_offline = 101,
  81. kerr_motor_driver_error = 102,
  82. kerr_motor_undervoltage_error = 103,
  83. kerr_motor_unkown_error = 104,
  84. kerr_AirBlowerError = 200, // 空压机异常
  85. kerr_HeaterError = 201, // 加热片异常
  86. kerr_BlowerError = 202, // 鼓风机异常
  87. kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
  88. } ErrorCode_t;
  89. typedef enum {
  90. /***********************************************************************************************************************
  91. * *
  92. ***********************************************************************************************************************/
  93. kfn_read_board_info = 1, // cmd:no, ack:ack_read_board_info_data_t
  94. kfn_force_report = 2, // cmd:no, ack:none //!delete
  95. kfn_read_sysinfo = 3, // cmd:no, ack:ack_sysinfo_t
  96. kfn_read_taskinfo = 4, // cmd:taskoff, ack:ask_taskinfo_t
  97. kfn_heart_ping = 5, // cmd:pingindex, ack:ask_taskinfo_t
  98. kfn_clear_reset_flag = 6, // cmd:taskoff, ack:ask_taskinfo_t
  99. kfn_enable_report = 7, // cmd:enable
  100. kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
  101. kreport_exception_error = 51, // report:error_code,subid
  102. /***********************************************************************************************************************
  103. * *
  104. ***********************************************************************************************************************/
  105. /**
  106. * (id,)
  107. *
  108. *
  109. * TMC参数
  110. * TMC参数
  111. * ihold,irun,idelay
  112. *
  113. */
  114. kfn_pump_rotate = 100, // cmd: index rpm ack:none
  115. kfn_pump_stop = 101, // cmd: index rpm ack:none
  116. kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
  117. kfn_pump_set_acc = 104, // cmd: index acc ack:none , delete
  118. kfn_pump_ping = 105, // cmd: index, ack:none
  119. kfn_pump_set_ramp = 106, // cmd: index,vs,a1,amx,v1 ack:none
  120. kfn_pump_set_tzw = 107, // cmd: index,timeZeroWait ack:none
  121. kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
  122. kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
  123. /***********************************************************************************************************************
  124. * *
  125. ***********************************************************************************************************************/
  126. /**
  127. * @brief
  128. * /
  129. *
  130. *
  131. *
  132. *
  133. *
  134. */
  135. kfn_heater_ctrl = 600, // cmd: power(0-100)
  136. kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
  137. kfn_heater_read_electric_current = 602, // report:electric_current(ma)
  138. kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
  139. /***********************************************************************************************************************
  140. * H2O2传感器数值上报 *
  141. ***********************************************************************************************************************/
  142. kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
  143. kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
  144. kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
  145. kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
  146. /***********************************************************************************************************************
  147. * *
  148. ***********************************************************************************************************************/
  149. kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
  150. /***********************************************************************************************************************
  151. * *
  152. ***********************************************************************************************************************/
  153. kfn_evaporation_tank_water_sensor_read_state = 900, // cmd: state
  154. kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
  155. kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
  156. kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
  157. /***********************************************************************************************************************
  158. * *
  159. ***********************************************************************************************************************/
  160. kfn_blower_ctrl = 1000, // cmd: power(0-100)
  161. kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
  162. kfn_blower_read_electric_current = 1002, // cmd: electric_current(ma)
  163. kfn_blower_is_error = 1003, // cmd: ack:{error}
  164. /***********************************************************************************************************************
  165. * *
  166. ***********************************************************************************************************************/
  167. kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
  168. kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
  169. kfn_air_compressor_read_electric_current = 1102, // report:electric_current(ma)
  170. /***********************************************************************************************************************
  171. * *
  172. ***********************************************************************************************************************/
  173. /**
  174. * @brief air Tightness Test AirCompressor
  175. * /
  176. *
  177. */
  178. kfn_air_tightness_test_ac_ctrl = 1200,
  179. /***********************************************************************************************************************
  180. * *
  181. ***********************************************************************************************************************/
  182. kfn_psbus_read_data = 1300, // cmd:subid ack:pressure(0.1pa)
  183. kfn_psbus_set_report_period_ms = 1301, // cmd:period
  184. kfn_psbus_scan = 1302, //
  185. kreport_pressure_data = 1350, // report:subid pressure(0.1pa)
  186. /***********************************************************************************************************************
  187. * *
  188. ***********************************************************************************************************************/
  189. kfn_proportional_set_valve = 1400, // 设置比例阀 {4:valveId,4:valveValue}
  190. kfn_proportional_read_pos = 1402, //
  191. kfn_proportional_is_busy = 1403, //
  192. /***********************************************************************************************************************
  193. * *
  194. ***********************************************************************************************************************/
  195. kfn_air_tightness_test_close_off_ch = 1500, // 气密性测试-封闭通道
  196. kfn_air_tightness_test_release_ch = 1501, // 气密性测试-释放通道
  197. kfn_ext_ch_selector_set_ch = 1600, // 外部通道选择器设置通道
  198. } cmd_t;
  199. #pragma pack(1)
  200. /***********************************************************************************************************************
  201. * CMD ENUM *
  202. ***********************************************************************************************************************/
  203. typedef enum {
  204. kext_ch_disinfection,
  205. kext_ch_degradation,
  206. kext_ch_dehumidification,
  207. } ExtChType_t;
  208. /***********************************************************************************************************************
  209. * ACK *
  210. ***********************************************************************************************************************/
  211. typedef struct {
  212. uint16_t boardType;
  213. uint16_t projectId;
  214. uint16_t protcol_version;
  215. uint16_t software_version;
  216. uint16_t hardware_version;
  217. } ack_read_board_info_data_t;
  218. typedef struct {
  219. uint8_t taskName[8];
  220. uint16_t stackRemindSize;
  221. uint16_t priority;
  222. uint8_t state;
  223. } ask_taskinfo_t;
  224. typedef struct {
  225. uint32_t total_heap_size;
  226. uint32_t free_heap_size;
  227. uint32_t free_sys_heap_size;
  228. uint16_t taskNum;
  229. uint16_t sysHasRun;
  230. } ack_sysinfo_t;
  231. typedef struct {
  232. uint8_t numOnlineId;
  233. uint8_t onlineId[10];
  234. } ack_psbus_scan_t;
  235. /***********************************************************************************************************************
  236. * Report *
  237. ***********************************************************************************************************************/
  238. typedef struct {
  239. uint16_t heartIndex;
  240. uint8_t boardType;
  241. uint8_t flag; // 0:reset_flag
  242. } report_heatpacket_data_t;
  243. typedef struct {
  244. uint32_t ecode;
  245. uint16_t subid;
  246. } report_exeception_data_t;
  247. #if 1
  248. typedef struct {
  249. uint8_t sensorDataNum;
  250. struct {
  251. uint8_t subid;
  252. int16_t pressureVal;
  253. } data[];
  254. } report_pressure_data_t;
  255. #endif
  256. typedef struct {
  257. uint8_t sensor_error; // 传感器异常
  258. uint16_t h2o2; // ppm * 10
  259. uint16_t humid; // %RH * 10
  260. uint16_t temp; // °C * 10
  261. uint16_t saturation; // %RS * 10
  262. } report_h2o2_data_t;
  263. typedef struct {
  264. uint16_t temperature; // 0.01
  265. } report_heater_temperature_data_t;
  266. typedef struct {
  267. uint16_t subid; // 0->100
  268. uint16_t valve_state; // 0->100
  269. } report_proportional_valve_value_data_t;
  270. typedef struct {
  271. uint16_t state;
  272. } report_water_sensor_state_t;
  273. #pragma pack()
  274. } // namespace transmit_disfection_protocol
  275. } // namespace iflytop