|
|
@ -255,10 +255,31 @@ void DeviceIoControlService::processReportPacket(uint8_t* packet, size_t len) { |
|
|
|
/*******************************************************************************
|
|
|
|
* H2O2 * |
|
|
|
*******************************************************************************/ |
|
|
|
bool fake_sensor_val_enable[10] = {false}; |
|
|
|
int32_t fake_sensor_val_h2o2[10]; |
|
|
|
int32_t fake_sensor_val_humid[10]; |
|
|
|
int32_t fake_sensor_val_temp[10]; |
|
|
|
int32_t fake_sensor_val_saturation[10]; |
|
|
|
bool fake_sensor_val_sensorstate[10]; |
|
|
|
|
|
|
|
bool DeviceIoControlService::H2O2Sensor_updateFakeVal(int32_t sensorid, bool enable, int32_t h2o2, int32_t humid, int32_t temp, int32_t saturation) { |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return false; |
|
|
|
fake_sensor_val_enable[sensorid] = enable; |
|
|
|
fake_sensor_val_h2o2[sensorid] = h2o2; |
|
|
|
fake_sensor_val_humid[sensorid] = humid; |
|
|
|
fake_sensor_val_temp[sensorid] = temp; |
|
|
|
fake_sensor_val_saturation[sensorid] = saturation; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
bool DeviceIoControlService::H2O2Sensor_readSensorState(int32_t sensorid) { |
|
|
|
std::lock_guard<std::mutex> lck(m_h2o2_sensor_data_lock_); |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return false; |
|
|
|
|
|
|
|
if (fake_sensor_val_enable[sensorid]) { |
|
|
|
return fake_sensor_val_sensorstate[sensorid]; |
|
|
|
} |
|
|
|
|
|
|
|
h2o2_sensor_data_t* data = &m_h2o2_sensor_data[sensorid]; |
|
|
|
if (zsys_haspassedms(data->updatetime) > 10 * 1000) return false; |
|
|
|
return true; |
|
|
@ -268,6 +289,10 @@ int32_t DeviceIoControlService::H2O2Sensor_readH2O2PPM(int32_t sensorid) { |
|
|
|
std::lock_guard<std::mutex> lck(m_h2o2_sensor_data_lock_); |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return -1; |
|
|
|
|
|
|
|
if (fake_sensor_val_enable[sensorid]) { |
|
|
|
return fake_sensor_val_h2o2[sensorid]; |
|
|
|
} |
|
|
|
|
|
|
|
h2o2_sensor_data_t* data = &m_h2o2_sensor_data[sensorid]; |
|
|
|
if (data->updatetime == 0) return -1; |
|
|
|
|
|
|
@ -284,6 +309,10 @@ int32_t DeviceIoControlService::H2O2Sensor_readHumid(int32_t sensorid) { |
|
|
|
std::lock_guard<std::mutex> lck(m_h2o2_sensor_data_lock_); |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return -1; |
|
|
|
|
|
|
|
if (fake_sensor_val_enable[sensorid]) { |
|
|
|
return fake_sensor_val_humid[sensorid]; |
|
|
|
} |
|
|
|
|
|
|
|
h2o2_sensor_data_t* data = &m_h2o2_sensor_data[sensorid]; |
|
|
|
if (data->updatetime == 0) return -1; |
|
|
|
|
|
|
@ -295,6 +324,10 @@ int32_t DeviceIoControlService::H2O2Sensor_readTemperature(int32_t sensorid) { |
|
|
|
std::lock_guard<std::mutex> lck(m_h2o2_sensor_data_lock_); |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return -1; |
|
|
|
|
|
|
|
if (fake_sensor_val_enable[sensorid]) { |
|
|
|
return fake_sensor_val_temp[sensorid]; |
|
|
|
} |
|
|
|
|
|
|
|
h2o2_sensor_data_t* data = &m_h2o2_sensor_data[sensorid]; |
|
|
|
if (data->updatetime == 0) return -1; |
|
|
|
|
|
|
@ -306,6 +339,10 @@ int32_t DeviceIoControlService::H2O2Sensor_readSaturation(int32_t sensorid) { |
|
|
|
std::lock_guard<std::mutex> lck(m_h2o2_sensor_data_lock_); |
|
|
|
if (sensorid >= MAX_H2O2_SENSOR_NUM) return -1; |
|
|
|
|
|
|
|
if (fake_sensor_val_enable[sensorid]) { |
|
|
|
return fake_sensor_val_saturation[sensorid]; |
|
|
|
} |
|
|
|
|
|
|
|
h2o2_sensor_data_t* data = &m_h2o2_sensor_data[sensorid]; |
|
|
|
if (data->updatetime == 0) return -1; |
|
|
|
|
|
|
@ -515,6 +552,8 @@ void DeviceIoControlService::replenishingFluidsPump_close() { |
|
|
|
m_zcanHost->pumpctrl_c1004(1, 100, 0, 1, 20); |
|
|
|
} |
|
|
|
|
|
|
|
int DeviceIoControlService::replenishingFluidsPump_getRPM() { return m_zcanHost->pumpctrl_c1004_get_speed_cache(1); } |
|
|
|
|
|
|
|
void DeviceIoControlService::replenishingFluidsPump_open_for_test(int gpm) { |
|
|
|
logger->info("replenishingFluidsPump_open_for_test {}", gpm); |
|
|
|
int speed = replenishingFluidsPump_GPM2RPM(gpm); |
|
|
|