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.

437 lines
19 KiB

1 year ago
1 year ago
11 months ago
1 year ago
1 month 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 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 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 year ago
1 year ago
12 months ago
1 year ago
1 year ago
9 months ago
8 months ago
9 months 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 year ago
1 year ago
1 year ago
1 year ago
  1. #pragma once
  2. #include <stdint.h>
  3. #include "zscanprotocol/zscanprotocol.h"
  4. namespace iflytop {
  5. namespace transmit_disfection_protocol {
  6. /**
  7. * @brief
  8. *
  9. *
  10. * VERSION 7
  11. *
  12. * DT600B
  13. * DT600B_LC_BOARD
  14. * DT600B_PC_BOARD
  15. *
  16. */
  17. #define MAX_PACKET_LEN 120
  18. #define PROTOCOL_VERSION 7
  19. #define HEART_OVERTIME (30 * 1000)
  20. #define SWITCH_CASE_STR(key) \
  21. case key: \
  22. return #key;
  23. typedef enum {
  24. DT600N = 1, // 大空间消毒机
  25. DT300N = 2, // 小空间消毒机
  26. DT300W = 3, // 管道式消毒机
  27. DT100N = 4, // 手持拉杆箱消毒机
  28. EX_H2O2_SENSOR = 5, // 外部H2O2传感器
  29. DT600B = 6, // 大空间标准版消毒机
  30. } ProjID_t;
  31. typedef enum {
  32. FIXBOARDID_MAIN_BOARD = 1, // 主机
  33. FIXBOARDID_LC_BOARD = 2, // 液路板
  34. FIXBOARDID_PC_BOARD = 3, // 电源板
  35. FIXBOARDID_EXT_CH_SELECTOR = 4, // 外部球阀控制板
  36. FIXBOARDID_H2O2SENSOR_START = 100, // H2O2传感器板
  37. } BoardId_t;
  38. typedef enum {
  39. DT600N_LC_Board = 1, // 大空间消毒机液路板
  40. DT600N_PC_Board = 2, // 大空间消毒机电源板
  41. DT300N_LC_Board = 3, // 小空间消毒机液路板
  42. DT300N_PC_Board = 4, // 小空间消毒机电源板
  43. DT300W_LC_Board = 5, // 管道式消毒机液路板
  44. DT300W_PC_Board = 6, // 管道式消毒机电源板
  45. DT100N_LC_Board = 7, // 手持拉杆箱消毒机液路板
  46. DT100N_PC_Board = 8, // 手持拉杆箱消毒机电源板
  47. DT100N_EXT_CH_SELECTOR = 9, // 手持拉杆箱消毒机外部球阀控制板
  48. EX_H2O2_SENSOR_BOARD = 10, // H2O2传感器板
  49. // 小空间经济版
  50. DT600B_LC_BOARD = DT600B * 16 + 1, // 大空间标准版消毒机-液路板
  51. DT600B_PC_BOARD = DT600B * 16 + 2, // 大空间标准版消毒机-电源板
  52. } BoardTypeId_t;
  53. static inline const char* BoardTypeId2Str(uint32_t id) {
  54. switch (id) {
  55. SWITCH_CASE_STR(DT600N_LC_Board)
  56. SWITCH_CASE_STR(DT600N_PC_Board)
  57. SWITCH_CASE_STR(DT300N_LC_Board)
  58. SWITCH_CASE_STR(DT300N_PC_Board)
  59. SWITCH_CASE_STR(DT300W_LC_Board)
  60. SWITCH_CASE_STR(DT300W_PC_Board)
  61. SWITCH_CASE_STR(DT100N_LC_Board)
  62. SWITCH_CASE_STR(DT100N_PC_Board)
  63. SWITCH_CASE_STR(DT100N_EXT_CH_SELECTOR)
  64. SWITCH_CASE_STR(EX_H2O2_SENSOR_BOARD)
  65. SWITCH_CASE_STR(DT600B_LC_BOARD)
  66. SWITCH_CASE_STR(DT600B_PC_BOARD)
  67. default:
  68. return "Unknown";
  69. }
  70. }
  71. static inline const char* ProjectIDToString(uint32_t id) {
  72. switch (id) {
  73. SWITCH_CASE_STR(DT600N)
  74. SWITCH_CASE_STR(DT300N)
  75. SWITCH_CASE_STR(DT300W)
  76. SWITCH_CASE_STR(DT100N)
  77. SWITCH_CASE_STR(EX_H2O2_SENSOR)
  78. SWITCH_CASE_STR(DT600B)
  79. default:
  80. return "Unknown";
  81. }
  82. }
  83. typedef enum {
  84. kerr_noerror = 0,
  85. kerr_overtime = 1,
  86. kerr_invalid_param = 2,
  87. kerr_invalid_param_num = 3,
  88. kerr_subdevice_offline = 4,
  89. kerr_function_not_support = 5,
  90. kerr_subdevice_overtime = 6,
  91. // 驱动器错误
  92. kerr_motor_reset_error = 100,
  93. kerr_motor_subdevice_offline = 101,
  94. kerr_motor_driver_error = 102,
  95. kerr_motor_undervoltage_error = 103,
  96. kerr_motor_unkown_error = 104,
  97. kerr_motor_overtemperature_flag = 105,
  98. kerr_motor_overtemperature_pre_warning_flag = 106,
  99. kerr_motor_short_to_ground_indicator_phase_A = 107,
  100. kerr_motor_short_to_ground_indicator_phase_B = 108,
  101. kerr_motor_open_load_indicator_phase_A = 109,
  102. kerr_motor_open_load_indicator_phase_B = 110,
  103. kerr_motor_standstill_indicator = 111,
  104. kerr_AirBlowerError = 200, // 空压机异常
  105. kerr_HeaterError = 201, // 加热片异常
  106. kerr_BlowerError = 202, // 鼓风机异常
  107. kerr_ProportionalValveError = 203, // 气密性测试专用空压机异常
  108. } ErrorCode_t;
  109. typedef enum {
  110. /***********************************************************************************************************************
  111. * *
  112. ***********************************************************************************************************************/
  113. kfn_read_board_info = 1, // cmd:no, ack:ack_read_board_info_data_t
  114. kfn_force_report = 2, // cmd:no, ack:none //!delete
  115. kfn_read_sysinfo = 3, // cmd:no, ack:ack_sysinfo_t
  116. kfn_read_taskinfo = 4, // cmd:taskoff, ack:ask_taskinfo_t
  117. kfn_heart_ping = 5, // cmd:pingindex, ack:ask_taskinfo_t
  118. kfn_clear_reset_flag = 6, // cmd:taskoff, ack:ask_taskinfo_t
  119. kfn_enable_report = 7, // cmd:enable
  120. kfn_reset_board = 8, // cmd:
  121. kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
  122. kreport_exception_error = 51, // report:error_code,subid
  123. kreport_device_reset = 52, // report:error_code,subid
  124. /***********************************************************************************************************************
  125. * *
  126. ***********************************************************************************************************************/
  127. /**
  128. * (id,)
  129. *
  130. *
  131. * TMC参数
  132. * TMC参数
  133. * ihold,irun,idelay
  134. *
  135. */
  136. kfn_pump_rotate = 100, // cmd: index rpm ack:none
  137. kfn_pump_stop = 101, // cmd: index rpm ack:none
  138. kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
  139. kfn_pump_set_acc = 104, // cmd: index acc ack:none , delete
  140. kfn_pump_ping = 105, // cmd: index, ack:none
  141. kfn_pump_set_ramp = 106, // cmd: index,vs,a1,amx,v1 ack:none
  142. kfn_pump_set_tzw = 107, // cmd: index,timeZeroWait ack:none
  143. kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
  144. kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
  145. kfn_pump_is_run = 112, // cmd: index, ack:run
  146. /***********************************************************************************************************************
  147. * *
  148. ***********************************************************************************************************************/
  149. /**
  150. * @brief
  151. * /
  152. *
  153. *
  154. *
  155. *
  156. *
  157. */
  158. kfn_heater_ctrl = 600, // cmd: power(0-100)
  159. kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
  160. kfn_heater_read_ei = 602, // report:electric_current(ma)
  161. kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
  162. kfn_heater_read_ei_adc_raw = 604, // report:temperature(0.01)
  163. kfn_heater_read_temperature_data_adc_raw = 605, // report:temperature(0.01)
  164. kfn_heater_is_open = 606, // cmd: index, ack:open
  165. /***********************************************************************************************************************
  166. * H2O2传感器数值上报 *
  167. ***********************************************************************************************************************/
  168. kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
  169. kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
  170. kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
  171. kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
  172. /***********************************************************************************************************************
  173. * *
  174. ***********************************************************************************************************************/
  175. kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
  176. kfn_triple_warning_light_read_state = 801, // cmd: none, ack:r,g,b,w
  177. /***********************************************************************************************************************
  178. * *
  179. ***********************************************************************************************************************/
  180. kfn_evaporation_tank_water_sensor_read_state = 900, // cmd: state
  181. kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
  182. kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
  183. kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
  184. /***********************************************************************************************************************
  185. * *
  186. ***********************************************************************************************************************/
  187. kfn_blower_ctrl = 1000, // cmd: power(0-100)
  188. kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
  189. kfn_blower_read_ei = 1002, // cmd: electric_current(ma)
  190. kfn_blower_is_error = 1003, // cmd: ack:{error}
  191. kfn_blower_read_ei_adc_raw = 1004, // cmd: electric_current(ma)
  192. kfn_blower_is_open = 1005, // cmd: index, ack:open
  193. /***********************************************************************************************************************
  194. * *
  195. ***********************************************************************************************************************/
  196. kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
  197. kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
  198. kfn_air_compressor_read_ei = 1102, // report:electric_current(ma)
  199. kfn_air_compressor_read_ei_adc_raw = 1103, // report:electric_current(ma)
  200. kfn_air_compressor_is_open = 1104, // cmd: index, ack:open
  201. /***********************************************************************************************************************
  202. * *
  203. ***********************************************************************************************************************/
  204. /**
  205. * @brief air Tightness Test AirCompressor
  206. * /
  207. *
  208. */
  209. kfn_air_leak_detect_ac_ctrl = 1200,
  210. kfn_air_leak_detect_ac_is_open = 1201,
  211. /***********************************************************************************************************************
  212. * *
  213. ***********************************************************************************************************************/
  214. kfn_psbus_read_data = 1300, // cmd:subid ack:pressure(0.1pa)
  215. kfn_psbus_scan = 1302, //
  216. kfn_psbus_start_report = 1303, // cmd:period
  217. kfn_psbus_stop_report = 1304, // cmd:
  218. kreport_pressure_data = 1350, // report:subid pressure(0.1pa)
  219. /***********************************************************************************************************************
  220. * - *
  221. ***********************************************************************************************************************/
  222. kfn_proportional_set_valve = 1400, // 设置比例阀 {4:valveId,4:valveValue}
  223. kfn_proportional_read_pos = 1402, //
  224. kfn_proportional_is_busy = 1403, //
  225. /***********************************************************************************************************************
  226. * *
  227. ***********************************************************************************************************************/
  228. kfn_air_leak_test_set_mode = 1500, // 0:消毒模式 1:打气模式 2:气压测试模式
  229. kfn_air_leak_test_get_mode = 1501, // 气密性测试-封闭通道
  230. /***********************************************************************************************************************
  231. * *
  232. ***********************************************************************************************************************/
  233. kfn_ext_ch_selector_set_ch = 1600, // 外部通道选择器设置通道
  234. kfn_ext_ch_selector_get_ch = 1601, // 读取当前通道
  235. /***********************************************************************************************************************
  236. * *
  237. ***********************************************************************************************************************/
  238. /***********************************************************************************************************************
  239. * *
  240. ***********************************************************************************************************************/
  241. // kfn_add_liquid_pump_air_intake_valve = 1700, // cmd: state ,true打开进气阀,false关闭进气阀门 加液进气电磁阀(打开,可以正常加液排液,关闭后加液泵倒转可以排空管路
  242. kfn_set_add_fluid_channel_selector_valve = 1700, // cmd: state ,true打开进气阀,false关闭进气阀门 加液进气电磁阀(打开,可以正常加液排液,关闭后加液泵倒转可以排空管路
  243. /***********************************************************************************************************************
  244. * *
  245. ***********************************************************************************************************************/
  246. kfn_disinfectant_bucket_level_sensor_read_level = 1800, // cmd ack:io_state //bit0:低液位置,bit1:中液位,bit2:高液位
  247. } cmd_t;
  248. #pragma pack(1)
  249. typedef enum {
  250. kAirLeakTestMode_disinfection,
  251. kAirLeakTestMode_inflation,
  252. kAirLeakTestMode_leakTest,
  253. } air_leak_test_mode_t;
  254. /***********************************************************************************************************************
  255. * CMD ENUM *
  256. ***********************************************************************************************************************/
  257. typedef enum {
  258. kext_ch_disinfection,
  259. kext_ch_degradation,
  260. kext_ch_dehumidification,
  261. } ExtChType_t;
  262. /***********************************************************************************************************************
  263. * ACK *
  264. ***********************************************************************************************************************/
  265. typedef struct {
  266. uint16_t boardType;
  267. uint16_t projectId;
  268. uint16_t protcol_version;
  269. uint16_t software_version;
  270. uint16_t hardware_version;
  271. } ack_read_board_info_data_t;
  272. typedef struct {
  273. uint8_t taskName[8];
  274. uint16_t stackRemindSize;
  275. uint16_t priority;
  276. uint8_t state;
  277. } ask_taskinfo_t;
  278. typedef struct {
  279. uint32_t total_heap_size;
  280. uint32_t free_heap_size;
  281. uint32_t free_sys_heap_size;
  282. uint16_t taskNum;
  283. uint16_t sysHasRun;
  284. } ack_sysinfo_t;
  285. static inline const char* PSType2Str(int type) {
  286. switch (type) {
  287. case 0:
  288. return "P100";
  289. case 1:
  290. return "DP600";
  291. case 2:
  292. return "OTHERS";
  293. default:
  294. return "UNKNOWN";
  295. }
  296. }
  297. static inline const char* p100uint2Str(uint8_t uint) {
  298. switch (uint) {
  299. case 0:
  300. return "Mpa";
  301. case 1:
  302. return "kpa";
  303. case 2:
  304. return "pa";
  305. case 3:
  306. return "bar";
  307. case 4:
  308. return "Mbar";
  309. case 5:
  310. return "kgcm2";
  311. case 6:
  312. return "psi";
  313. case 7:
  314. return "mh2o";
  315. case 8:
  316. return "mh2o";
  317. default:
  318. return "UNKNOWN";
  319. }
  320. }
  321. // ptype:P100 precision:1 unit:kpa zero:-900 full:1000
  322. typedef struct {
  323. uint8_t isOnline;
  324. uint8_t subid;
  325. uint8_t ptype;
  326. uint8_t uint;
  327. uint8_t precision;
  328. int16_t zero;
  329. int16_t full;
  330. } ps_info_t;
  331. typedef struct {
  332. uint8_t numOnlineId;
  333. ps_info_t sensor[10];
  334. } ack_psbus_scan_t;
  335. /***********************************************************************************************************************
  336. * Report *
  337. ***********************************************************************************************************************/
  338. typedef struct {
  339. uint16_t heartIndex;
  340. uint8_t boardType;
  341. uint8_t flag; // 0:reset_flag
  342. } report_heatpacket_data_t;
  343. typedef struct {
  344. uint32_t ecode;
  345. uint16_t subid;
  346. uint32_t detailinfo;
  347. } report_exeception_data_t;
  348. #if 1
  349. typedef struct {
  350. uint8_t sensorDataNum;
  351. struct {
  352. uint8_t subid;
  353. int16_t pressureVal;
  354. } data[];
  355. } report_pressure_data_t;
  356. #endif
  357. typedef struct {
  358. uint8_t sensor_error; // 传感器异常
  359. uint16_t h2o2; // ppm * 10
  360. uint16_t rh; // %RH * 10
  361. uint16_t temp; // °C * 10
  362. uint16_t rs; // %RS * 10
  363. uint16_t h2o2adc; // adc_val
  364. int16_t df_ptemp; // Dew/frost point temperature °C * 10
  365. int16_t ah; // Absolute humidity g/m3 * 10
  366. int16_t mr; // Mixing ratio g/kg * 10
  367. int16_t wet_bulb_temp; // Wet-bulb temperature °C * 10
  368. int16_t enthalpy; // Enthalpy kJ/kg * 10
  369. } report_h2o2_data_t;
  370. typedef struct {
  371. uint16_t temperature; // 0.01
  372. } report_heater_temperature_data_t;
  373. typedef struct {
  374. uint16_t subid; // 0->100
  375. uint16_t valve_state; // 0->100
  376. } report_proportional_valve_value_data_t;
  377. typedef struct {
  378. uint16_t state;
  379. } report_water_sensor_state_t;
  380. #pragma pack()
  381. } // namespace transmit_disfection_protocol
  382. } // namespace iflytop