From e3cd8477bc025d589be68d9062cec2fb2c205f71 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 15 May 2024 22:13:32 +0800 Subject: [PATCH] update --- api/cmds/device_state_cmd_impl.cpp | 31 +++--- api/cmds/device_state_cmd_impl.hpp | 2 +- api/cmds/disinfection_cmd_impl.hpp | 2 +- api/cmds/record_mgr_cmd_impl.hpp | 2 +- api/cmds/selftest_cmd_impl.hpp | 2 +- api/cmds/setting_page_cmd_impl.hpp | 2 +- api/cmds/system_operate_cmd_impl.hpp | 2 +- api/cmds/test_page_cmd_impl.hpp | 2 +- api/cmds/usrcmd_impl.hpp | 2 +- service/disinfection_ctl_service.cpp | 179 +++++++++++++++++++---------------- service/disinfection_ctl_service.hpp | 23 ++++- 11 files changed, 141 insertions(+), 108 deletions(-) diff --git a/api/cmds/device_state_cmd_impl.cpp b/api/cmds/device_state_cmd_impl.cpp index 3a2f7a0..852d5b7 100644 --- a/api/cmds/device_state_cmd_impl.cpp +++ b/api/cmds/device_state_cmd_impl.cpp @@ -16,7 +16,7 @@ json DeviceStateCmdImpl::createSensorDataJson() { report["heatingStrip"]["currentVal"] = m_deviceIoControlService->heatingStrip_getcurrentValue(); report["sprinklerPumpRPM"] = m_deviceIoControlService->sprayLiquidPump_getRPM(); - report["chargingPumpRPM"] = m_deviceIoControlService->getChargingPump_PumpRPM(); + report["chargingPumpRPM"] = m_deviceIoControlService->drainingPump_getRPM(); report["sprinklerPumpGPM"] = m_deviceIoControlService->sprayLiquidPump_getGPM(); // report["chargingPumpGPM"] = m_deviceIoControlService->getChargingPump_PumpGPM(); @@ -26,22 +26,19 @@ json DeviceStateCmdImpl::createSensorDataJson() { // Water immersion sensor report["disinfectant_volume"] = m_deviceIoControlService->getDisinfectantVolume_g(); - // report["h2o2_1"] = m_deviceIoControlService->getH2O2SenSorData1().h2o2; - report["h2o2_1"] = m_deviceIoControlService->getH2O2SenSorData1().h2o2; - report["temp_1"] = m_deviceIoControlService->getH2O2SenSorData1().temp; - report["humid_1"] = m_deviceIoControlService->getH2O2SenSorData1().humid; - report["saturation_1"] = m_deviceIoControlService->getH2O2SenSorData1().saturation + 1; // 为了让曲线不重叠 - - // logger->info("m_deviceIoControlService->getH2O2SenSorData1().h2o2 {}", m_deviceIoControlService->getH2O2SenSorData1().h2o2); - - report["h2o2_2"] = -1; - report["temp_2"] = -1; - report["humid_2"] = -1; - report["saturation_2"] = -1; - report["h2o2_3"] = -1; - report["temp_3"] = -1; - report["humid_3"] = -1; - report["saturation_3"] = -1; + + report["h2o2_1"] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0); + report["temp_1"] = m_deviceIoControlService->H2O2Sensor_readTemperature(0); + report["humid_1"] = m_deviceIoControlService->H2O2Sensor_readHumid(0); + report["saturation_1"] = m_deviceIoControlService->H2O2Sensor_readSaturation(0) + 1; //+1是为让曲线不重合 + report["h2o2_2"] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(1); + report["temp_2"] = m_deviceIoControlService->H2O2Sensor_readTemperature(1); + report["humid_2"] = m_deviceIoControlService->H2O2Sensor_readHumid(1); + report["saturation_2"] = m_deviceIoControlService->H2O2Sensor_readSaturation(1) + 1; //+1是为让曲线不重合 + report["h2o2_3"] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(2); + report["temp_3"] = m_deviceIoControlService->H2O2Sensor_readTemperature(2); + report["humid_3"] = m_deviceIoControlService->H2O2Sensor_readHumid(2); + report["saturation_3"] = m_deviceIoControlService->H2O2Sensor_readSaturation(2) + 1; //+1是为让曲线不重合 return report; } diff --git a/api/cmds/device_state_cmd_impl.hpp b/api/cmds/device_state_cmd_impl.hpp index 636abaa..8274c56 100644 --- a/api/cmds/device_state_cmd_impl.hpp +++ b/api/cmds/device_state_cmd_impl.hpp @@ -20,7 +20,7 @@ class DeviceStateCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/disinfection_cmd_impl.hpp b/api/cmds/disinfection_cmd_impl.hpp index a443a68..7ecd4f0 100644 --- a/api/cmds/disinfection_cmd_impl.hpp +++ b/api/cmds/disinfection_cmd_impl.hpp @@ -20,7 +20,7 @@ class DisinfectionCmdImpl : public enable_shared_from_this shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/record_mgr_cmd_impl.hpp b/api/cmds/record_mgr_cmd_impl.hpp index ff322b7..b74a5cf 100644 --- a/api/cmds/record_mgr_cmd_impl.hpp +++ b/api/cmds/record_mgr_cmd_impl.hpp @@ -20,7 +20,7 @@ class RecordMgrCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/selftest_cmd_impl.hpp b/api/cmds/selftest_cmd_impl.hpp index 1c32fd8..8b54e95 100644 --- a/api/cmds/selftest_cmd_impl.hpp +++ b/api/cmds/selftest_cmd_impl.hpp @@ -39,7 +39,7 @@ class SelfTestCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/setting_page_cmd_impl.hpp b/api/cmds/setting_page_cmd_impl.hpp index 5aa074a..65d4cb5 100644 --- a/api/cmds/setting_page_cmd_impl.hpp +++ b/api/cmds/setting_page_cmd_impl.hpp @@ -39,7 +39,7 @@ class SettingPageCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/system_operate_cmd_impl.hpp b/api/cmds/system_operate_cmd_impl.hpp index f22cb43..5515b6f 100644 --- a/api/cmds/system_operate_cmd_impl.hpp +++ b/api/cmds/system_operate_cmd_impl.hpp @@ -39,7 +39,7 @@ class SystemOperateCmdImpl : public enable_shared_from_this m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/test_page_cmd_impl.hpp b/api/cmds/test_page_cmd_impl.hpp index eaa2a7b..474e228 100644 --- a/api/cmds/test_page_cmd_impl.hpp +++ b/api/cmds/test_page_cmd_impl.hpp @@ -39,7 +39,7 @@ class TestPageCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/api/cmds/usrcmd_impl.hpp b/api/cmds/usrcmd_impl.hpp index 4039f24..b8d69ff 100644 --- a/api/cmds/usrcmd_impl.hpp +++ b/api/cmds/usrcmd_impl.hpp @@ -39,7 +39,7 @@ class UserCmdImpl : public enable_shared_from_this { shared_ptr m_dbService; shared_ptr m_deviceStateService; shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_disinfectionLogsManager; shared_ptr m_zcanhost; shared_ptr m_dataExportService; diff --git a/service/disinfection_ctl_service.cpp b/service/disinfection_ctl_service.cpp index b343740..6146359 100644 --- a/service/disinfection_ctl_service.cpp +++ b/service/disinfection_ctl_service.cpp @@ -143,7 +143,7 @@ void DisinfectionCtrlService::computeRemainTime(DisinfectionContext& context) { // } - logger->info("computeRemainTime minh2o2 {} dvalue {}", context.sensor_stat.min_h2o2, dvalue); + logger->info("computeRemainTime minh2o2 {} dvalue {}", context.min_h2o2, dvalue); } void DisinfectionCtrlService::initContext(DisinfectionContext& context, // @@ -238,53 +238,27 @@ shared_ptr DisinfectionCtrlService::createCSVLogger(string l void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& context) { #if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) - int h2o2_0 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0); - int h2o2_1 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(1); - int h2o2_2 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(2); + static_assert(MAX_H2O2_SENSOR_NUM == 3, "MAX_H2O2_SENSOR_NUM must be 3"); - int humid0 = m_deviceIoControlService->H2O2Sensor_readHumid(0); - int humid1 = m_deviceIoControlService->H2O2Sensor_readHumid(1); - int humid2 = m_deviceIoControlService->H2O2Sensor_readHumid(2); + auto& cx = context; + string h2o2str[MAX_H2O2_SENSOR_NUM]; + string tempstr[MAX_H2O2_SENSOR_NUM]; + string humidstr[MAX_H2O2_SENSOR_NUM]; + string satstr[MAX_H2O2_SENSOR_NUM]; - int temp0 = m_deviceIoControlService->H2O2Sensor_readTemperature(0); - int temp1 = m_deviceIoControlService->H2O2Sensor_readTemperature(1); - int temp2 = m_deviceIoControlService->H2O2Sensor_readTemperature(2); - - int sat0 = m_deviceIoControlService->H2O2Sensor_readSaturation(0); - int sat1 = m_deviceIoControlService->H2O2Sensor_readSaturation(1); - int sat2 = m_deviceIoControlService->H2O2Sensor_readSaturation(2); - - string h2o2_0_str = fmt::format("{}", h2o2_0); - string h2o2_1_str = fmt::format("{}", h2o2_1); - string h2o2_2_str = fmt::format("{}", h2o2_2); - - string humid0_str = fmt::format("{}", humid0); - string humid1_str = fmt::format("{}", humid1); - string humid2_str = fmt::format("{}", humid2); - - string temp0_str = fmt::format("{}", temp0); - string temp1_str = fmt::format("{}", temp1); - string temp2_str = fmt::format("{}", temp2); - - string sat0_str = fmt::format("{}", sat0); - string sat1_str = fmt::format("{}", sat1); - string sat2_str = fmt::format("{}", sat2); - - if (h2o2_0 < 0) h2o2_0_str = "N/A"; - if (h2o2_1 < 0) h2o2_1_str = "N/A"; - if (h2o2_2 < 0) h2o2_2_str = "N/A"; - - if (humid0 < 0) humid0_str = "N/A"; - if (humid1 < 0) humid1_str = "N/A"; - if (humid2 < 0) humid2_str = "N/A"; - - if (temp0 < 0) temp0_str = "N/A"; - if (temp1 < 0) temp1_str = "N/A"; - if (temp2 < 0) temp2_str = "N/A"; + for (int i = 0; i < MAX_H2O2_SENSOR_NUM; i++) { + h2o2str[i] = fmt::format("{}", cx.h2o2[i]); + tempstr[i] = fmt::format("{}", cx.temp[i]); + humidstr[i] = fmt::format("{}", cx.humid[i]); + satstr[i] = fmt::format("{}", cx.saturation[i]); + } - if (sat0 < 0) sat0_str = "N/A"; - if (sat1 < 0) sat1_str = "N/A"; - if (sat2 < 0) sat2_str = "N/A"; + for (int i = 0; i < MAX_H2O2_SENSOR_NUM; i++) { + if (cx.h2o2[i] < 0) h2o2str[i] = "N/A"; + if (cx.temp[i] < 0) tempstr[i] = "N/A"; + if (cx.humid[i] < 0) humidstr[i] = "N/A"; + if (cx.saturation[i] < 0) satstr[i] = "N/A"; + } auto ds = m_deviceIoControlService; float dvalue = 0; @@ -306,9 +280,9 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& con "{},{}", "\n", getTime(), // - h2o2_0_str, temp0_str, humid0_str, sat0_str, // - h2o2_1_str, temp1_str, humid1_str, sat1_str, // - h2o2_2_str, temp2_str, humid2_str, sat2_str, // + h2o2str[0], tempstr[0], humidstr[0], satstr[0], // + h2o2str[1], tempstr[1], humidstr[1], satstr[1], // + h2o2str[2], tempstr[2], humidstr[2], satstr[2], // (int32_t)dvalue, (int32_t)m_context.m_nowLoglevel, (int32_t)m_context.m_targetLoglevel, // ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), // m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); @@ -318,22 +292,23 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& con void DisinfectionCtrlService::log(DisinfectionContext& context) { #if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) - int h2o2_0 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0); - int h2o2_1 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(1); - int h2o2_2 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(2); + // int h2o2_0 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0); + // int h2o2_1 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(1); + // int h2o2_2 = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(2); - int humid0 = m_deviceIoControlService->H2O2Sensor_readHumid(0); - int humid1 = m_deviceIoControlService->H2O2Sensor_readHumid(1); - int humid2 = m_deviceIoControlService->H2O2Sensor_readHumid(2); + // int humid0 = m_deviceIoControlService->H2O2Sensor_readHumid(0); + // int humid1 = m_deviceIoControlService->H2O2Sensor_readHumid(1); + // int humid2 = m_deviceIoControlService->H2O2Sensor_readHumid(2); - int temp0 = m_deviceIoControlService->H2O2Sensor_readTemperature(0); - int temp1 = m_deviceIoControlService->H2O2Sensor_readTemperature(1); - int temp2 = m_deviceIoControlService->H2O2Sensor_readTemperature(2); + // int temp0 = m_deviceIoControlService->H2O2Sensor_readTemperature(0); + // int temp1 = m_deviceIoControlService->H2O2Sensor_readTemperature(1); + // int temp2 = m_deviceIoControlService->H2O2Sensor_readTemperature(2); - int sat0 = m_deviceIoControlService->H2O2Sensor_readSaturation(0); - int sat1 = m_deviceIoControlService->H2O2Sensor_readSaturation(1); - int sat2 = m_deviceIoControlService->H2O2Sensor_readSaturation(2); + // int sat0 = m_deviceIoControlService->H2O2Sensor_readSaturation(0); + // int sat1 = m_deviceIoControlService->H2O2Sensor_readSaturation(1); + // int sat2 = m_deviceIoControlService->H2O2Sensor_readSaturation(2); + auto& cx = context; auto ds = m_deviceIoControlService; float dvalue = 0; if (m_context.dvalue <= 0) { @@ -354,15 +329,14 @@ void DisinfectionCtrlService::log(DisinfectionContext& context) { "dv:{},log:{},tlog:{}," "h:{},airB:{},airC:{},pump:{}," "g:{},remainS:{}", - "\n", - getTime(), // - h2o2_0, temp0, humid0, sat0, // - h2o2_1, temp1, humid1, sat1, // - h2o2_2, temp2, humid2, sat2, // - m_context.sensor_stat.max_h2o2, m_context.sensor_stat.min_h2o2, m_context.sensor_stat.max_humid, m_context.sensor_stat.max_saturation, // - (int32_t)dvalue, (int32_t)m_context.m_nowLoglevel, (int32_t)m_context.m_targetLoglevel, // - ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), // + getTime(), // + cx.h2o2[0], cx.temp[0], cx.humid[0], cx.saturation[0], // + cx.h2o2[1], cx.temp[1], cx.humid[1], cx.saturation[1], // + cx.h2o2[2], cx.temp[2], cx.humid[2], cx.saturation[2], // + m_context.max_h2o2, m_context.min_h2o2, m_context.max_humid, m_context.max_saturation, // + (int32_t)dvalue, (int32_t)m_context.m_nowLoglevel, (int32_t)m_context.m_targetLoglevel, // + ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), // m_deviceIoControlService->getDisinfectantVolume_g(), formattimeS(remaintime))); #endif } @@ -422,9 +396,9 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont /** * @brief 检查当前 */ - float nowSatur = m_context.sensor_stat.max_saturation; - float nowh2o2 = m_context.sensor_stat.max_h2o2; - float humid = m_context.sensor_stat.max_humid; + float nowSatur = m_context.max_saturation; + float nowh2o2 = m_context.max_h2o2; + float humid = m_context.max_humid; if (m_context.injection_pump_speed_changed) { m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed); @@ -443,9 +417,9 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont m_context.m_state = kdisinfection_take_a_break; } } else { - float nowSatur = m_context.sensor_stat.max_saturation; - float nowh2o2 = m_context.sensor_stat.max_h2o2; - float humid = m_context.sensor_stat.max_humid; + float nowSatur = m_context.max_saturation; + float nowh2o2 = m_context.max_h2o2; + float humid = m_context.max_humid; // && humid < m_context.continued_satur if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs && humid < context.continued_humi) { @@ -470,11 +444,11 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { /** * @brief 更新传感器信息 */ - m_context.sensor_stat = m_deviceIoControlService->H2O2Sensor_getStatisticsResult(); + updateH2O2SensorData(m_context); /** * @brief 计算D值 */ - m_context.dvalue = getDisinfectionDValue(m_context.sensor_stat.min_h2o2); + m_context.dvalue = getDisinfectionDValue(m_context.min_h2o2); if (zsteady_clock().elapsedTimeS(m_context.m_lastComputeDvalueTp) > DVALUE_COMPUTEPERIOD_TIME_S) { m_context.m_lastComputeDvalueTp = zsteady_clock().now(); @@ -513,8 +487,8 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) { /** * @brief 等待h2o2浓度下降 */ - logger->info("waitting for h2o2 concentration to safe value {}=>{}", m_context.sensor_stat.min_h2o2, 1); - if (m_context.sensor_stat.min_h2o2 < 1) { + logger->info("waitting for h2o2 concentration to safe value {}=>{}", m_context.min_h2o2, 1); + if (m_context.min_h2o2 < 1) { logger->info("h2o2 concentration to safe value"); breakflag = true; forcelog = true; @@ -817,4 +791,51 @@ void DisinfectionCtrlService::stopDraining() { m_drainingWorkState = 0; // drainingPump_close(); m_deviceIoControlService->drainingPump_close(); -} \ No newline at end of file +} + +void DisinfectionCtrlService::updateH2O2SensorData(DisinfectionContext& context) { + auto& cx = context; + for (size_t i = 0; i < MAX_EXT_H2O2_SENSOR_NUM; i++) { + cx.h2o2[i] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(i); + } + + for (size_t i = 0; i < MAX_EXT_H2O2_SENSOR_NUM; i++) { + cx.humid[i] = m_deviceIoControlService->H2O2Sensor_readHumid(i); + } + + for (size_t i = 0; i < MAX_EXT_H2O2_SENSOR_NUM; i++) { + cx.temp[i] = m_deviceIoControlService->H2O2Sensor_readTemperature(i); + } + + for (size_t i = 0; i < MAX_EXT_H2O2_SENSOR_NUM; i++) { + cx.saturation[i] = m_deviceIoControlService->H2O2Sensor_readSaturation(i); + } + + cx.min_h2o2 = cx.h2o2[0]; + cx.max_h2o2 = cx.h2o2[0]; + cx.max_humid = cx.humid[0]; + cx.max_saturation = cx.saturation[0]; + + for (size_t i = 0; i < MAX_EXT_H2O2_SENSOR_NUM; i++) { + if (cx.h2o2[i] < cx.min_h2o2) { + cx.min_h2o2 = cx.h2o2[i]; + } + + if (cx.h2o2[i] > cx.max_h2o2) { + cx.max_h2o2 = cx.h2o2[i]; + } + + if (cx.humid[i] > cx.max_humid) { + cx.max_humid = cx.humid[i]; + } + + if (cx.saturation[i] > cx.max_saturation) { + cx.max_saturation = cx.saturation[i]; + } + } + + if (cx.max_h2o2 < 0) cx.max_h2o2 = 0; + if (cx.min_h2o2 < 0) cx.min_h2o2 = 0; + if (cx.max_humid < 0) cx.max_humid = 0; + if (cx.max_saturation < 0) cx.max_saturation = 0; +} diff --git a/service/disinfection_ctl_service.hpp b/service/disinfection_ctl_service.hpp index af168fe..9adcad5 100644 --- a/service/disinfection_ctl_service.hpp +++ b/service/disinfection_ctl_service.hpp @@ -51,7 +51,7 @@ class DisinfectionCtrlService : public enable_shared_from_this m_disinfectionThread; - shared_ptr m_deviceIoControlService; + shared_ptr m_deviceIoControlService; shared_ptr m_dbService; shared_ptr m_disinfectionLogsManager; @@ -76,8 +76,6 @@ class DisinfectionCtrlService : public enable_shared_from_this csvlogger; + + /******************************************************************************* + * 传感器信息 * + *******************************************************************************/ + + int32_t h2o2[MAX_H2O2_SENSOR_NUM]; // ppm + int32_t humid[MAX_H2O2_SENSOR_NUM]; // %RH + int32_t temp[MAX_H2O2_SENSOR_NUM]; // °C + int32_t saturation[MAX_H2O2_SENSOR_NUM]; // %RS + + int min_h2o2; + int max_h2o2; + int max_humid; + int max_saturation; }; public: @@ -187,6 +199,9 @@ class DisinfectionCtrlService : public enable_shared_from_this createCSVLogger(string log_file_name); void dumpDisinfectionLogsToCSV(DisinfectionContext& context); - void log(DisinfectionContext& context); + + void log(DisinfectionContext& context); + + void updateH2O2SensorData(DisinfectionContext& context); }; } // namespace iflytop \ No newline at end of file