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.

128 lines
3.7 KiB

2 years ago
  1. //
  2. // Created by zwsd
  3. //
  4. #pragma once
  5. #include <fstream>
  6. #include <iostream>
  7. #include <list>
  8. #include <map>
  9. #include <memory>
  10. #include <mutex>
  11. #include <set>
  12. #include <sstream>
  13. #include <string>
  14. #include <vector>
  15. #include "iflytop/components/zcanreceiver/zcanhost.hpp"
  16. #include "iflytop/core/core.hpp"
  17. #include "zservice_container/zservice_container.hpp"
  18. /**
  19. * @brief
  20. *
  21. * service: DeviceIoControlService
  22. *
  23. * :
  24. * :
  25. * :
  26. * :
  27. *
  28. */
  29. namespace iflytop {
  30. using namespace std;
  31. using namespace core;
  32. class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlService> {
  33. ENABLE_LOGGER(DeviceIoControlService);
  34. unique_ptr<Thread> m_workThread;
  35. shared_ptr<ZCanHost> m_zcanHost;
  36. //
  37. ZCanHost::hpp272_data_t m_hpp272_data_1;
  38. ZCanHost::huacheng_pressure_sensor_read_c1005_t m_pressure_sensor_data[5];
  39. //
  40. bool m_waterImmersionSensor1 = false; // 漏液检测
  41. bool m_waterImmersionSensor2 = false; // 仓内液体检测
  42. int m_adc_0 = 0; //
  43. int m_adc_1 = 0; //
  44. int m_adc_2 = 0;
  45. public:
  46. DeviceIoControlService();
  47. void initialize();
  48. void startScan();
  49. public:
  50. /*******************************************************************************
  51. * *
  52. *******************************************************************************/
  53. void airCompressor_setState(bool val);
  54. int getAirCompressor_io1();
  55. int getAirCompressor_io2();
  56. int getAirCompressor_currentValue();
  57. /*******************************************************************************
  58. * *
  59. *******************************************************************************/
  60. int getAirBlower_io1();
  61. int getAirBlower_io2();
  62. int getAirBlower_currentValue();
  63. int AirBlower_setState(bool state);
  64. // heatingStrip
  65. /*******************************************************************************
  66. * *
  67. *******************************************************************************/
  68. int getHeatingStrip_io1();
  69. int getHeatingStrip_io2();
  70. int getHeatingStrip_currentValue();
  71. void heartingPlate_setPower(bool val);
  72. /*******************************************************************************
  73. * *
  74. *******************************************************************************/
  75. int getSprinkler_PumpRPM();
  76. int getChargingPump_PumpRPM();
  77. // 排液泵
  78. void drainingPump_open();
  79. void drainingPump_close();
  80. // 充液泵
  81. void replenishingFluidsPump_open();
  82. void replenishingFluidsPump_close();
  83. // 喷液泵
  84. void sprayLiquidPump_open();
  85. void sprayLiquidPump_close();
  86. /*******************************************************************************
  87. * *
  88. *******************************************************************************/
  89. int getWaterImmersionSensor1();
  90. int getWaterImmersionSensor2();
  91. int getDisinfectantVolume_g(); // g
  92. typedef struct {
  93. int h2o2; // ppm
  94. int temp; // 温度
  95. int humid; // 湿度 %RS
  96. int saturation; // 相对饱和度 %RS
  97. } h2o2sensor_data_t;
  98. h2o2sensor_data_t getH2O2SenSorData1();
  99. typedef struct {
  100. h2o2sensor_data_t h2o2sensor_data[3];
  101. bool h2o2sensor_status[3];
  102. int min_h2o2;
  103. int max_h2o2;
  104. int max_humid;
  105. int max_saturation;
  106. } all_h2o2sensor_data_t;
  107. bool getAllSensorData(DeviceIoControlService::all_h2o2sensor_data_t& data);
  108. };
  109. } // namespace iflytop