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.

449 lines
20 KiB

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