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.

464 lines
20 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
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
9 months ago
8 months ago
9 months ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months 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 8
  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. kfn_enable_period_log = 9, // cmd: 使能周期日志
  122. kreport_heatpacket_pong = 50, // cmd:no ack:no report:heatpacket_t
  123. kreport_exception_error = 51, // report:error_code,subid
  124. kreport_device_reset = 52, // report:error_code,subid
  125. /***********************************************************************************************************************
  126. * *
  127. ***********************************************************************************************************************/
  128. /**
  129. * (id,)
  130. *
  131. *
  132. * TMC参数
  133. * TMC参数
  134. * ihold,irun,idelay
  135. *
  136. */
  137. kfn_pump_rotate = 100, // cmd: index rpm ack:none
  138. kfn_pump_stop = 101, // cmd: index rpm ack:none
  139. kfn_pump_set_ihold_irun_idelay = 102, // cmd: index irun,ihold,idelay ack:none
  140. kfn_pump_set_acc = 104, // cmd: index acc ack:none , delete
  141. kfn_pump_ping = 105, // cmd: index, ack:none
  142. kfn_pump_set_ramp = 106, // cmd: index,vs,a1,amx,v1 ack:none
  143. kfn_pump_set_tzw = 107, // cmd: index,timeZeroWait ack:none
  144. kfn_pump_set_subic_reg = 110, // cmd: index,val ack:none
  145. kfn_pump_get_subic_reg = 111, // cmd: index, ack:val
  146. kfn_pump_is_run = 112, // cmd: index, ack:run
  147. /***********************************************************************************************************************
  148. * *
  149. ***********************************************************************************************************************/
  150. /**
  151. * @brief
  152. * /
  153. *
  154. *
  155. *
  156. *
  157. *
  158. */
  159. kfn_heater_ctrl = 600, // cmd: power(0-100)
  160. kfn_heater_ctrl_safe_valve = 601, // cmd: valve_state
  161. kfn_heater_read_ei = 602, // report:electric_current(ma)
  162. kfn_heater_read_temperature_data = 603, // report:temperature(0.01)
  163. kfn_heater_read_ei_adc_raw = 604, // report:temperature(0.01)
  164. kfn_heater_read_temperature_data_adc_raw = 605, // report:temperature(0.01)
  165. kfn_heater_is_open = 606, // cmd: index, ack:open
  166. /***********************************************************************************************************************
  167. * H2O2传感器数值上报 *
  168. ***********************************************************************************************************************/
  169. kfn_h2o2_sensor_read_calibration_date = 700, // cmd:subid ack:year,month,day
  170. kfn_h2o2_sensor_read_sub_ic_errorcode = 701, // cmd:subid ack:errorcode
  171. kfn_h2o2_sensor_read_sub_ic_reg = 702, // cmd:subid,reg,num ack:errorcode
  172. kreport_h2o2_sensor_data = 750, // report:subid h2o2_sensor_data
  173. /***********************************************************************************************************************
  174. * *
  175. ***********************************************************************************************************************/
  176. kfn_triple_warning_light_ctl = 800, // cmd: r,g,b,warning
  177. kfn_triple_warning_light_read_state = 801, // cmd: none, ack:r,g,b,w
  178. /***********************************************************************************************************************
  179. * *
  180. ***********************************************************************************************************************/
  181. kfn_evaporation_tank_water_sensor_read_state = 900, // cmd: state
  182. kfn_device_bottom_water_sensor_read_state = 901, // cmd: state
  183. kreport_evaporation_bin_water_sensor = 950, // report:state //蒸发仓水浸 //report_evaporation_bin_water_sensor_data_t
  184. kreport_device_bottom_water_sensor = 951, // report:state //设备底部水浸 //report_device_bottom_water_sensor_data
  185. /***********************************************************************************************************************
  186. * *
  187. ***********************************************************************************************************************/
  188. kfn_blower_ctrl = 1000, // cmd: power(0-100)
  189. kfn_blower_ctrl_safe_valve = 1001, // cmd: valve_state
  190. kfn_blower_read_ei = 1002, // cmd: electric_current(ma)
  191. // kfn_blower_is_error = 1003, // cmd: ack:{error} !deleted!
  192. // kfn_blower_read_ei_adc_raw = 1004, // cmd: electric_current(ma) !deleted!
  193. kfn_blower_is_open = 1005, // cmd: index, !deleted!
  194. kfn_blower_read_type = 1006, // cmd: 返回风机类型
  195. kfn_blower_read_state = 1007, // cmd: 返回风机状态, 不同类型返回的状态代表的含义不一样
  196. /***********************************************************************************************************************
  197. * *
  198. ***********************************************************************************************************************/
  199. kfn_air_compressor_ctrl = 1100, // cmd: power(0-100)
  200. kfn_air_compressor_ctrl_safe_valve = 1101, // cmd: valve_state
  201. kfn_air_compressor_read_ei = 1102, // report:electric_current(ma)
  202. // kfn_air_compressor_read_ei_adc_raw = 1103, // report:electric_current(ma)
  203. kfn_air_compressor_is_open = 1104, // cmd: index, ack:open
  204. kfn_air_compressor_read_type = 1105, // cmd: 返回空压机类型
  205. kfn_air_compressor_read_state = 1106, // cmd: index, ack:open
  206. /***********************************************************************************************************************
  207. * *
  208. ***********************************************************************************************************************/
  209. /**
  210. * @brief air Tightness Test AirCompressor
  211. * /
  212. *
  213. */
  214. kfn_air_leak_detect_ac_ctrl = 1200,
  215. kfn_air_leak_detect_ac_is_open = 1201,
  216. /***********************************************************************************************************************
  217. * *
  218. ***********************************************************************************************************************/
  219. kfn_psbus_read_data = 1300, // cmd:subid ack:pressure(0.1pa)
  220. kfn_psbus_scan = 1302, //
  221. kfn_psbus_start_report = 1303, // cmd:period
  222. kfn_psbus_stop_report = 1304, // cmd:
  223. kreport_pressure_data = 1350, // report:subid pressure(0.1pa)
  224. /***********************************************************************************************************************
  225. * - *
  226. ***********************************************************************************************************************/
  227. kfn_proportional_set_valve = 1400, // 设置比例阀 {4:valveId,4:valveValue}
  228. kfn_proportional_read_pos = 1402, //
  229. kfn_proportional_is_busy = 1403, //
  230. /***********************************************************************************************************************
  231. * *
  232. ***********************************************************************************************************************/
  233. kfn_air_leak_test_set_mode = 1500, // 0:消毒模式 1:打气模式 2:气压测试模式
  234. kfn_air_leak_test_get_mode = 1501, // 气密性测试-封闭通道
  235. /***********************************************************************************************************************
  236. * *
  237. ***********************************************************************************************************************/
  238. kfn_ext_ch_selector_set_ch = 1600, // 外部通道选择器设置通道
  239. kfn_ext_ch_selector_get_ch = 1601, // 读取当前通道
  240. /***********************************************************************************************************************
  241. * *
  242. ***********************************************************************************************************************/
  243. /***********************************************************************************************************************
  244. * *
  245. ***********************************************************************************************************************/
  246. // kfn_add_liquid_pump_air_intake_valve = 1700, // cmd: state ,true打开进气阀,false关闭进气阀门 加液进气电磁阀(打开,可以正常加液排液,关闭后加液泵倒转可以排空管路
  247. kfn_set_add_fluid_channel_selector_valve = 1700, // cmd: state ,true打开进气阀,false关闭进气阀门 加液进气电磁阀(打开,可以正常加液排液,关闭后加液泵倒转可以排空管路
  248. /***********************************************************************************************************************
  249. * *
  250. ***********************************************************************************************************************/
  251. kfn_disinfectant_bucket_level_sensor_read_level = 1800, // cmd ack:io_state //bit0:低液位置,bit1:中液位,bit2:高液位
  252. } cmd_t;
  253. #pragma pack(1)
  254. typedef enum {
  255. kAirLeakTestMode_disinfection,
  256. kAirLeakTestMode_inflation,
  257. kAirLeakTestMode_leakTest,
  258. } air_leak_test_mode_t;
  259. /***********************************************************************************************************************
  260. * CMD ENUM *
  261. ***********************************************************************************************************************/
  262. typedef enum {
  263. kext_ch_disinfection,
  264. kext_ch_degradation,
  265. kext_ch_dehumidification,
  266. } ExtChType_t;
  267. /***********************************************************************************************************************
  268. * ACK *
  269. ***********************************************************************************************************************/
  270. typedef struct {
  271. uint16_t boardType;
  272. uint16_t projectId;
  273. uint16_t protcol_version;
  274. uint16_t software_version;
  275. uint16_t hardware_version;
  276. } ack_read_board_info_data_t;
  277. typedef struct {
  278. uint8_t taskName[8];
  279. uint16_t stackRemindSize;
  280. uint16_t priority;
  281. uint8_t state;
  282. } ask_taskinfo_t;
  283. typedef struct {
  284. uint32_t total_heap_size;
  285. uint32_t free_heap_size;
  286. uint32_t free_sys_heap_size;
  287. uint16_t taskNum;
  288. uint16_t sysHasRun;
  289. } ack_sysinfo_t;
  290. typedef struct {
  291. int16_t power;
  292. int16_t state0;
  293. int16_t state1;
  294. int16_t state2;
  295. } ack_blower_state_t;
  296. // typedef struct {
  297. // int16_t power;
  298. // int16_t blowerI; // 风机电流 ma
  299. // int16_t coolfanI; // 冷却风扇电流 ma
  300. // int16_t blowerFbCNT; // 风机反馈CNT
  301. // int16_t coolfanFbCnt; // 冷却风扇反馈CNT
  302. // int16_t subDeviceErrorCode; // 从设备错误码
  303. // } ack_blower_state_t;
  304. typedef struct {
  305. int16_t power;
  306. int16_t airCompressorI; // 空压机电流 ma
  307. int16_t airCompressorFbCnt; // 空压机反馈 CNT
  308. } ack_ac_state_t;
  309. static inline const char* PSType2Str(int type) {
  310. switch (type) {
  311. case 0:
  312. return "P100";
  313. case 1:
  314. return "DP600";
  315. case 2:
  316. return "OTHERS";
  317. default:
  318. return "UNKNOWN";
  319. }
  320. }
  321. static inline const char* p100uint2Str(uint8_t uint) {
  322. switch (uint) {
  323. case 0:
  324. return "Mpa";
  325. case 1:
  326. return "kpa";
  327. case 2:
  328. return "pa";
  329. case 3:
  330. return "bar";
  331. case 4:
  332. return "Mbar";
  333. case 5:
  334. return "kgcm2";
  335. case 6:
  336. return "psi";
  337. case 7:
  338. return "mh2o";
  339. case 8:
  340. return "mh2o";
  341. default:
  342. return "UNKNOWN";
  343. }
  344. }
  345. // ptype:P100 precision:1 unit:kpa zero:-900 full:1000
  346. typedef struct {
  347. uint8_t isOnline;
  348. uint8_t subid;
  349. uint8_t ptype;
  350. uint8_t uint;
  351. uint8_t precision;
  352. int16_t zero;
  353. int16_t full;
  354. } ps_info_t;
  355. typedef struct {
  356. uint8_t numOnlineId;
  357. ps_info_t sensor[10];
  358. } ack_psbus_scan_t;
  359. /***********************************************************************************************************************
  360. * Report *
  361. ***********************************************************************************************************************/
  362. typedef struct {
  363. uint16_t heartIndex;
  364. uint8_t boardType;
  365. uint8_t flag; // 0:reset_flag
  366. } report_heatpacket_data_t;
  367. typedef struct {
  368. uint32_t ecode;
  369. uint16_t subid;
  370. uint32_t detailinfo;
  371. } report_exeception_data_t;
  372. #if 1
  373. typedef struct {
  374. uint8_t sensorDataNum;
  375. struct {
  376. uint8_t subid;
  377. int16_t pressureVal;
  378. } data[];
  379. } report_pressure_data_t;
  380. #endif
  381. typedef struct {
  382. uint8_t sensor_error; // 传感器异常
  383. uint16_t h2o2; // ppm * 10
  384. uint16_t rh; // %RH * 10
  385. uint16_t temp; // °C * 10
  386. uint16_t rs; // %RS * 10
  387. uint16_t h2o2adc; // adc_val
  388. int16_t df_ptemp; // Dew/frost point temperature °C * 10
  389. int16_t ah; // Absolute humidity g/m3 * 10
  390. int16_t mr; // Mixing ratio g/kg * 10
  391. int16_t wet_bulb_temp; // Wet-bulb temperature °C * 10
  392. int16_t enthalpy; // Enthalpy kJ/kg * 10
  393. } report_h2o2_data_t;
  394. typedef struct {
  395. uint16_t temperature; // 0.01
  396. } report_heater_temperature_data_t;
  397. typedef struct {
  398. uint16_t subid; // 0->100
  399. uint16_t valve_state; // 0->100
  400. } report_proportional_valve_value_data_t;
  401. typedef struct {
  402. uint16_t state;
  403. } report_water_sensor_state_t;
  404. #pragma pack()
  405. } // namespace transmit_disfection_protocol
  406. } // namespace iflytop