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.
129 lines
3.7 KiB
129 lines
3.7 KiB
//
|
|
// Created by zwsd
|
|
//
|
|
|
|
#pragma once
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <list>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "iflytop/components/zcanreceiver/zcanhost.hpp"
|
|
#include "iflytop/core/core.hpp"
|
|
#include "zservice_container/zservice_container.hpp"
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* service: DeviceIoControlService
|
|
*
|
|
* 监听事件:
|
|
* 依赖状态:
|
|
* 依赖服务:
|
|
* 作用:
|
|
*
|
|
*/
|
|
|
|
namespace iflytop {
|
|
using namespace std;
|
|
using namespace core;
|
|
|
|
class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlService> {
|
|
ENABLE_LOGGER(DeviceIoControlService);
|
|
|
|
unique_ptr<Thread> m_workThread;
|
|
shared_ptr<ZCanHost> m_zcanHost;
|
|
|
|
//
|
|
ZCanHost::hpp272_data_t m_hpp272_data_1;
|
|
ZCanHost::huacheng_pressure_sensor_read_c1005_t m_pressure_sensor_data[5];
|
|
|
|
//
|
|
bool m_waterImmersionSensor1 = false; // 漏液检测
|
|
bool m_waterImmersionSensor2 = false; // 仓内液体检测
|
|
|
|
int m_adc_0 = 0; //
|
|
int m_adc_1 = 0; //
|
|
int m_adc_2 = 0;
|
|
|
|
public:
|
|
DeviceIoControlService();
|
|
void initialize();
|
|
void startScan();
|
|
|
|
public:
|
|
/*******************************************************************************
|
|
* 空压机控制 *
|
|
*******************************************************************************/
|
|
void airCompressor_setState(bool val);
|
|
int getAirCompressor_io1();
|
|
int getAirCompressor_io2();
|
|
int getAirCompressor_currentValue();
|
|
|
|
/*******************************************************************************
|
|
* 鼓风机控制 *
|
|
*******************************************************************************/
|
|
int getAirBlower_io1();
|
|
int getAirBlower_io2();
|
|
int getAirBlower_currentValue();
|
|
int AirBlower_setState(bool state);
|
|
|
|
// heatingStrip
|
|
/*******************************************************************************
|
|
* 加热片控制 *
|
|
*******************************************************************************/
|
|
int getHeatingStrip_io1();
|
|
int getHeatingStrip_io2();
|
|
int getHeatingStrip_currentValue();
|
|
void heartingPlate_setPower(bool val);
|
|
|
|
/*******************************************************************************
|
|
* 泵控制 *
|
|
*******************************************************************************/
|
|
int getSprinkler_PumpRPM();
|
|
int getChargingPump_PumpRPM();
|
|
// 排液泵
|
|
void drainingPump_open();
|
|
void drainingPump_close();
|
|
// 充液泵
|
|
void replenishingFluidsPump_open();
|
|
void replenishingFluidsPump_close();
|
|
// 喷液泵
|
|
void sprayLiquidPump_open();
|
|
void sprayLiquidPump_close();
|
|
/*******************************************************************************
|
|
* 水浸传感器 *
|
|
*******************************************************************************/
|
|
int getWaterImmersionSensor1();
|
|
int getWaterImmersionSensor2();
|
|
|
|
int getDisinfectantVolume_g(); // g
|
|
|
|
typedef struct {
|
|
int h2o2; // ppm
|
|
int temp; // 温度
|
|
int humid; // 湿度 %RS
|
|
int saturation; // 相对饱和度 %RS
|
|
} h2o2sensor_data_t;
|
|
|
|
h2o2sensor_data_t getH2O2SenSorData1();
|
|
|
|
typedef struct {
|
|
h2o2sensor_data_t h2o2sensor_data[3];
|
|
bool h2o2sensor_status[3];
|
|
|
|
int min_h2o2;
|
|
int max_h2o2;
|
|
int max_humid;
|
|
int max_saturation;
|
|
|
|
} all_h2o2sensor_data_t;
|
|
bool getAllSensorData(DeviceIoControlService::all_h2o2sensor_data_t& data);
|
|
};
|
|
} // namespace iflytop
|