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.

435 lines
19 KiB

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