Browse Source

update

master
zhaohe 1 year ago
parent
commit
23b2151f6c
  1. 12
      api/cmds/device_state_cmd_impl.cpp
  2. 8
      api/cmds/disinfection_cmd_impl.cpp
  3. 26
      api/cmds/disinfection_cmd_impl.hpp
  4. 105
      api/cmds/test_page_cmd_impl.cpp
  5. 44
      api/cmds/test_page_cmd_impl.hpp
  6. 86
      service/disinfection_ctl_service.cpp
  7. 12
      service/disinfection_ctl_service.hpp

12
api/cmds/device_state_cmd_impl.cpp

@ -3,6 +3,8 @@ using namespace iflytop;
json DeviceStateCmdImpl::createSensorDataJson() {
json report;
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
report["airCompressor"]["io1"] = m_deviceIoControlService->airCompressor_getio1();
report["airCompressor"]["io2"] = m_deviceIoControlService->airCompressor_getio2();
report["airCompressor"]["currentVal"] = m_deviceIoControlService->airCompressor_getcurrentValue();
@ -26,6 +28,11 @@ json DeviceStateCmdImpl::createSensorDataJson() {
// Water immersion sensor
report["disinfectant_volume"] = m_deviceIoControlService->getDisinfectantVolume_g();
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
report["h2o2_1"] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0);
report["temp_1"] = m_deviceIoControlService->H2O2Sensor_readTemperature(0);
@ -66,9 +73,12 @@ void DeviceStateCmdImpl::getState(json& cmd, json& receipt) {
/*******************************************************************************
* disinfectionState *
*******************************************************************************/
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
receipt["state"]["replenishingFluidsWorkState"] = m_disinfectionCtrlService->getReplenishingFluidsWorkState();
receipt["state"]["drainingWorkState"] = m_disinfectionCtrlService->getDrainingWorkState();
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
receipt["state"]["disinfectionWorkState"] = m_disinfectionCtrlService->getDisinfectionWorkState();
/**
* @brief

8
api/cmds/disinfection_cmd_impl.cpp

@ -45,8 +45,7 @@ void DisinfectionCmdImpl::changeDisinfectionParameter(json& cmd, json& receipt)
continued_humi = jsonGet<int>(cmd["continued_humi"]);
}
m_disinfectionCtrlService->changeDisinfectionParameter(injection_pump_speed, stoped_gs, continued_gs, stoped_satur, continued_satur, stoped_humi,
continued_humi);
m_disinfectionCtrlService->changeDisinfectionParameter(injection_pump_speed, stoped_gs, continued_gs, stoped_satur, continued_satur, stoped_humi, continued_humi);
return;
}
void DisinfectionCmdImpl::stopDisinfection(json& cmd, json& receipt) {
@ -54,6 +53,8 @@ void DisinfectionCmdImpl::stopDisinfection(json& cmd, json& receipt) {
m_dbService->addUserBehaviorRecord(m_deviceStateService->getLoginUid(), kbehavior_stop_disinfection, "");
return;
}
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
void DisinfectionCmdImpl::startReplenishingFluids(json& cmd, json& receipt) {
int16_t stopAt = jsonGet<int>(cmd["stopAt"]);
logger->info("startReplenishingFluids {}", stopAt);
@ -82,6 +83,7 @@ void DisinfectionCmdImpl::stopDraining(json& cmd, json& receipt) {
m_disinfectionCtrlService->stopDraining();
return;
}
#endif
void DisinfectionCmdImpl::startFormula(json& cmd, json& receipt) {
int id = jsonGet<int>(cmd["id"]);
@ -138,9 +140,11 @@ void DisinfectionCmdImpl::initialize() {
m_msgProcesser->registerMsgProcesser("changeDisinfectionParameter", BIND(DisinfectionCmdImpl::changeDisinfectionParameter));
m_msgProcesser->registerMsgProcesser("getDisinfectionConfig", BIND(DisinfectionCmdImpl::getDisinfectionConfig));
m_msgProcesser->registerMsgProcesser("stopDisinfection", BIND(DisinfectionCmdImpl::stopDisinfection));
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_msgProcesser->registerMsgProcesser("startReplenishingFluids", BIND(DisinfectionCmdImpl::startReplenishingFluids));
m_msgProcesser->registerMsgProcesser("stopReplenishingFluids", BIND(DisinfectionCmdImpl::stopReplenishingFluids));
m_msgProcesser->registerMsgProcesser("startDraining", BIND(DisinfectionCmdImpl::startDraining));
m_msgProcesser->registerMsgProcesser("stopDraining", BIND(DisinfectionCmdImpl::stopDraining));
#endif
m_msgProcesser->registerMsgProcesser("startFormula", BIND(DisinfectionCmdImpl::startFormula));
}

26
api/cmds/disinfection_cmd_impl.hpp

@ -14,17 +14,17 @@ namespace iflytop {
class DisinfectionCmdImpl : public enable_shared_from_this<DisinfectionCmdImpl> {
ENABLE_LOGGER(DisinfectionCmdImpl);
shared_ptr<FrontMsgProcesser> m_msgProcesser;
shared_ptr<GConfig> m_zconfig;
shared_ptr<IflytopFrontEndService> m_iflytopwsService;
shared_ptr<DBService> m_dbService;
shared_ptr<DeviceStateService> m_deviceStateService;
shared_ptr<DisinfectionCtrlService> m_disinfectionCtrlService;
shared_ptr<IF_DeviceIoContrlService> m_deviceIoControlService;
shared_ptr<DisinfectionLogsManager> m_disinfectionLogsManager;
shared_ptr<ZCanHost> m_zcanhost;
shared_ptr<DataExportService> m_dataExportService;
shared_ptr<FrontMsgProcesser> m_frontMsgProcesser;
shared_ptr<FrontMsgProcesser> m_msgProcesser;
shared_ptr<GConfig> m_zconfig;
shared_ptr<IflytopFrontEndService> m_iflytopwsService;
shared_ptr<DBService> m_dbService;
shared_ptr<DeviceStateService> m_deviceStateService;
shared_ptr<DisinfectionCtrlService> m_disinfectionCtrlService;
shared_ptr<IF_DeviceIoContrlService> m_deviceIoControlService;
shared_ptr<DisinfectionLogsManager> m_disinfectionLogsManager;
shared_ptr<ZCanHost> m_zcanhost;
shared_ptr<DataExportService> m_dataExportService;
shared_ptr<FrontMsgProcesser> m_frontMsgProcesser;
public:
DisinfectionCmdImpl(){};
@ -35,12 +35,14 @@ class DisinfectionCmdImpl : public enable_shared_from_this<DisinfectionCmdImpl>
void changeDisinfectionParameter(json& cmd, json& receipt);
void getDisinfectionConfig(json& cmd, json& receipt);
void stopDisinfection(json& cmd, json& receipt);
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
void startReplenishingFluids(json& cmd, json& receipt);
void stopReplenishingFluids(json& cmd, json& receipt);
void startDraining(json& cmd, json& receipt);
void stopDraining(json& cmd, json& receipt);
#endif
void startFormula(json& cmd, json& receipt);
};
} // namespace iflytop

105
api/cmds/test_page_cmd_impl.cpp

@ -1,6 +1,7 @@
#include "test_page_cmd_impl.hpp"
using namespace iflytop;
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
void TestPageCmdImpl::test_sprayLiquidPumpCtrl(json& cmd, json& receipt) {
int ctrl = jsonGet<int>(cmd["ctrl"]);
int speed = jsonGet<int>(cmd["speed"]);
@ -25,6 +26,7 @@ void TestPageCmdImpl::test_replenishingFluidsPumpCtrl(json& cmd, json& receipt)
}
return;
}
void TestPageCmdImpl::exceCanCmd(json& cmd, json& receipt) {
string cancmd = cmd["cancmd"];
logger->info("exceCanCmd {}", cancmd);
@ -36,7 +38,6 @@ void TestPageCmdImpl::exceCanCmd(json& cmd, json& receipt) {
}
return;
}
void TestPageCmdImpl::TestPage_WarningLightCtrl(json& cmd, json& receipt) {
int r = jsonGet<int>(cmd["r"]);
int g = jsonGet<int>(cmd["g"]);
@ -47,6 +48,89 @@ void TestPageCmdImpl::TestPage_WarningLightCtrl(json& cmd, json& receipt) {
m_deviceIoControlService->warningLightCtrl(r, g, b, w);
return;
}
#endif
#ifdef PROJECT_TYPE_DRAW_BAR_BOX
void TestPageCmdImpl::DBDBTestPage__sprayLiquidPump_run(json& cmd, json& receipt) {
int gpm = jsonGet<int>(cmd["params"]["gpm"]);
m_deviceIoControlService->DBDB__sprayLiquidPump_run(gpm);
return;
}
void TestPageCmdImpl::DBDBTestPage__readPressureSensor(json& cmd, json& receipt) {
int index = jsonGet<int>(cmd["params"]["index"]);
int32_t pressure = m_deviceIoControlService->DBDB__readPressureSensor(index);
receipt["ack"]["pressure"] = pressure;
return;
}
void TestPageCmdImpl::DBDBTestPage__sprayAirCompressorPowerCtrl(json& cmd, json& receipt) {
int power = jsonGet<int>(cmd["params"]["power"]);
m_deviceIoControlService->DBDB__sprayAirCompressorPowerCtrl(power);
return;
}
void TestPageCmdImpl::DBDBTestPage__airTightnessTestAirCompressorPowerCtrl(json& cmd, json& receipt) {
int power = jsonGet<int>(cmd["params"]["power"]);
m_deviceIoControlService->DBDB__airTightnessTestAirCompressorPowerCtrl(power);
return;
}
void TestPageCmdImpl::DBDBTestPage__heaterCtrl(json& cmd, json& receipt) {
int power = jsonGet<int>(cmd["params"]["power"]);
m_deviceIoControlService->DBDB__heaterCtrl(power);
return;
}
void TestPageCmdImpl::DBDBTestPage__heaterCtrlSafeValve(json& cmd, json& receipt) {
int power = jsonGet<int>(cmd["params"]["power"]);
m_deviceIoControlService->DBDB__heaterCtrlSafeValve(power);
return;
}
void TestPageCmdImpl::DBDBTestPage__heaterReadElectricCurrent(json& cmd, json& receipt) {
int32_t current = m_deviceIoControlService->DBDB__heaterReadElectricCurrent();
receipt["ack"]["current"] = current;
return;
}
void TestPageCmdImpl::DBDBTestPage__heaterReadTemperatureData(json& cmd, json& receipt) {
int32_t temperature = m_deviceIoControlService->DBDB__heaterReadTemperatureData();
receipt["ack"]["temperature"] = temperature;
return;
}
void TestPageCmdImpl::DBDBTestPage__miniPwmBlowerCtrl(json& cmd, json& receipt) {
int power100 = jsonGet<int>(cmd["params"]["power100"]);
m_deviceIoControlService->DBDB__miniPwmBlowerCtrl(power100);
return;
}
void TestPageCmdImpl::DBDBTestPage__miniPwmBlowerReadFbcount(json& cmd, json& receipt) {
int32_t fbcount = m_deviceIoControlService->DBDB__miniPwmBlowerReadFbcount();
receipt["ack"]["fbcount"] = fbcount;
return;
}
void TestPageCmdImpl::DBDBTestPage__extValveCtrl(json& cmd, json& receipt) {
string channel = jsonGet<string>(cmd["params"]["channel"]);
int channleVal = -1;
if (channel == "disinfectionChannel") {
channleVal = IF_DeviceIoContrlService::kExtValveChannel_disinfectionChannel;
} else if (channel == "dehumidificationChannel") {
channleVal = IF_DeviceIoContrlService::kExtValveChannel_dehumidificationChannel;
} else if (channel == "degradationChannel") {
channleVal = IF_DeviceIoContrlService::kExtValveChannel_degradationChannel;
} else {
logger->error("channel error:{}", channel);
receipt["ackcode"] = err::zecode(err::kfail);
receipt["errorinfo"] = "unkownchannel";
return;
}
m_deviceIoControlService->DBDB__extValveCtrl(channleVal);
return;
}
void TestPageCmdImpl::DBDBTestPage__extValBoardIsOnline(json& cmd, json& receipt) {
bool isOnline = m_deviceIoControlService->DBDB__extValBoardIsOnline();
receipt["ack"]["isOnline"] = isOnline;
return;
}
#endif
void TestPageCmdImpl::initialize() {
GET_TO_SERVICE(m_msgProcesser);
@ -60,9 +144,26 @@ void TestPageCmdImpl::initialize() {
GET_TO_SERVICE(m_zcanhost);
GET_TO_SERVICE(m_dataExportService);
GET_TO_SERVICE(m_frontMsgProcesser);
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_msgProcesser->registerMsgProcesser("test_sprayLiquidPumpCtrl", BIND(TestPageCmdImpl::test_sprayLiquidPumpCtrl));
m_msgProcesser->registerMsgProcesser("test_replenishingFluidsPumpCtrl", BIND(TestPageCmdImpl::test_replenishingFluidsPumpCtrl));
m_msgProcesser->registerMsgProcesser("exceCanCmd", BIND(TestPageCmdImpl::exceCanCmd));
m_msgProcesser->registerMsgProcesser("TestPage_WarningLightCtrl", BIND(TestPageCmdImpl::TestPage_WarningLightCtrl));
#endif
#ifdef PROJECT_TYPE_DRAW_BAR_BOX
m_msgProcesser->registerMsgProcesser("DBDBTestPage__sprayLiquidPump_run", BIND(TestPageCmdImpl::DBDBTestPage__sprayLiquidPump_run));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__readPressureSensor", BIND(TestPageCmdImpl::DBDBTestPage__readPressureSensor));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__sprayAirCompressorPowerCtrl", BIND(TestPageCmdImpl::DBDBTestPage__sprayAirCompressorPowerCtrl));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__airTightnessTestAirCompressorPowerCtrl", BIND(TestPageCmdImpl::DBDBTestPage__airTightnessTestAirCompressorPowerCtrl));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__heaterCtrl", BIND(TestPageCmdImpl::DBDBTestPage__heaterCtrl));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__heaterCtrlSafeValve", BIND(TestPageCmdImpl::DBDBTestPage__heaterCtrlSafeValve));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__heaterReadElectricCurrent", BIND(TestPageCmdImpl::DBDBTestPage__heaterReadElectricCurrent));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__heaterReadTemperatureData", BIND(TestPageCmdImpl::DBDBTestPage__heaterReadTemperatureData));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__miniPwmBlowerCtrl", BIND(TestPageCmdImpl::DBDBTestPage__miniPwmBlowerCtrl));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__miniPwmBlowerReadFbcount", BIND(TestPageCmdImpl::DBDBTestPage__miniPwmBlowerReadFbcount));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__extValveCtrl", BIND(TestPageCmdImpl::DBDBTestPage__extValveCtrl));
m_msgProcesser->registerMsgProcesser("DBDBTestPage__extValBoardIsOnline", BIND(TestPageCmdImpl::DBDBTestPage__extValBoardIsOnline));
#endif
}

44
api/cmds/test_page_cmd_impl.hpp

@ -33,28 +33,48 @@ using namespace core;
class TestPageCmdImpl : public enable_shared_from_this<TestPageCmdImpl> {
ENABLE_LOGGER(TestPageCmdImpl);
shared_ptr<FrontMsgProcesser> m_msgProcesser;
shared_ptr<GConfig> m_zconfig;
shared_ptr<IflytopFrontEndService> m_iflytopwsService;
shared_ptr<DBService> m_dbService;
shared_ptr<DeviceStateService> m_deviceStateService;
shared_ptr<DisinfectionCtrlService> m_disinfectionCtrlService;
shared_ptr<IF_DeviceIoContrlService> m_deviceIoControlService;
shared_ptr<DisinfectionLogsManager> m_disinfectionLogsManager;
shared_ptr<ZCanHost> m_zcanhost;
shared_ptr<DataExportService> m_dataExportService;
shared_ptr<FrontMsgProcesser> m_frontMsgProcesser;
shared_ptr<FrontMsgProcesser> m_msgProcesser;
shared_ptr<GConfig> m_zconfig;
shared_ptr<IflytopFrontEndService> m_iflytopwsService;
shared_ptr<DBService> m_dbService;
shared_ptr<DeviceStateService> m_deviceStateService;
shared_ptr<DisinfectionCtrlService> m_disinfectionCtrlService;
shared_ptr<IF_DeviceIoContrlService> m_deviceIoControlService;
shared_ptr<DisinfectionLogsManager> m_disinfectionLogsManager;
shared_ptr<ZCanHost> m_zcanhost;
shared_ptr<DataExportService> m_dataExportService;
shared_ptr<FrontMsgProcesser> m_frontMsgProcesser;
public:
TestPageCmdImpl(){};
void initialize();
private:
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
void test_sprayLiquidPumpCtrl(json& cmd, json& receipt);
void test_replenishingFluidsPumpCtrl(json& cmd, json& receipt);
void exceCanCmd(json& cmd, json& receipt);
void TestPage_WarningLightCtrl(json& cmd, json& receipt);
#endif
#ifdef PROJECT_TYPE_DRAW_BAR_BOX
void DBDBTestPage__sprayLiquidPump_run(json& cmd, json& receipt);
void DBDBTestPage__readPressureSensor(json& cmd, json& receipt);
void DBDBTestPage__sprayAirCompressorPowerCtrl(json& cmd, json& receipt);
void DBDBTestPage__airTightnessTestAirCompressorPowerCtrl(json& cmd, json& receipt);
void DBDBTestPage__heaterCtrl(json& cmd, json& receipt);
void DBDBTestPage__heaterCtrlSafeValve(json& cmd, json& receipt);
void DBDBTestPage__heaterReadElectricCurrent(json& cmd, json& receipt);
void DBDBTestPage__heaterReadTemperatureData(json& cmd, json& receipt);
void DBDBTestPage__miniPwmBlowerCtrl(json& cmd, json& receipt);
void DBDBTestPage__miniPwmBlowerReadFbcount(json& cmd, json& receipt);
void DBDBTestPage__extValveCtrl(json& cmd, json& receipt);
void DBDBTestPage__extValBoardIsOnline(json& cmd, json& receipt);
#endif
};
} // namespace iflytop

86
service/disinfection_ctl_service.cpp

@ -57,6 +57,7 @@ void DisinfectionCtrlService::initialize() {
GET_TO_SERVICE(m_disinfectionLogsManager);
GET_TO_SERVICE(m_disinfectionPrinterService);
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->drainingPump_close();
m_deviceIoControlService->replenishingFluidsPump_close();
m_deviceIoControlService->sprayLiquidPump_close();
@ -64,6 +65,11 @@ void DisinfectionCtrlService::initialize() {
m_deviceIoControlService->heartingPlate_setPower(false);
m_deviceIoControlService->airBlower_setState(false);
m_deviceIoControlService->airCompressor_setState(false);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
m_context.beforeDisinfectantVolume_g = 0;
#else
#endif
m_dvalueComputer.initialize();
}
@ -283,7 +289,14 @@ void DisinfectionCtrlService::pushDisinfectionPrinterTask(DisinfectionContext& c
task->targetLog = context.cfg_targetLoglevel;
task->actualLog = context.state_now_loglevel;
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
task->disinfectantVolume = dio->getDisinfectantVolume_g();
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
task->disinfectantVolume = 0;
#else
#endif
m_disinfectionPrinterService->pushPrintTask(task);
}
@ -411,8 +424,14 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context,
m_context.max_humid = 0;
m_context.max_saturation = 0;
m_context.stateSnapshotList.clear();
m_context.afterDisinfectantVolume_g = 0;
m_context.afterDisinfectantVolume_g = 0;
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_context.beforeDisinfectantVolume_g = m_deviceIoControlService->getDisinfectantVolume_g();
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
m_context.beforeDisinfectantVolume_g = 0;
#else
#endif
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION)
m_deviceIoControlService->warningLightCtrl(0, 0, 1, 0);
@ -422,8 +441,13 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context,
m_deviceIoControlService->warningLightCtrl(1, 1, 0, 0);
#endif
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->heartingPlate_setPower(true);
m_deviceIoControlService->airBlower_setState(true);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
context.csvlogger = createCSVLogger(context.m_disinfectionID);
m_context.firstLog = true;
@ -433,6 +457,7 @@ void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) {
context.state_remaintime = 0;
logger->info("stop disinfection {}", context.m_disinfectionID);
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
// sprayLiquidPump_close();
m_deviceIoControlService->sprayLiquidPump_close();
usleep(1000 * 1000);
@ -447,6 +472,9 @@ void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) {
m_disinfectionWorkState = 3;
m_deviceIoControlService->warningLightCtrl(0, 1, 0, 0);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
}
void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context) {
@ -454,17 +482,38 @@ void DisinfectionCtrlService::processPreheatState(DisinfectionContext& context)
// logger->info("preheat {}", context.m_disinfectionID);
if ((context.m_state == kstate_preheat && hasstarttime > m_context.pre_heat_time_s)) {
/**
* @brief
*
*/
logger->info("preheat finished {}", context.m_disinfectionID);
m_deviceIoControlService->airBlower_setState(true);
logger->info("preheat finished {}", context.m_disinfectionID);
#ifdef PROJECT_TYPE_PIPE_DISINFECTION
m_deviceIoControlService->airCompressor_channelSelect(1);
m_deviceIoControlService->airCompressor_setValve1(1);
m_deviceIoControlService->airCompressor_setValve2(1);
#endif
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->airBlower_setState(true);
usleep(1000 * 1000);
m_deviceIoControlService->airCompressor_setState(true);
usleep(1000 * 1000);
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
m_deviceIoControlService->DBDB__sprayAirCompressorPowerCtrl(1);
usleep(1000 * 1000);
m_deviceIoControlService->DBDB__heaterCtrl(1);
usleep(100 * 1000);
m_deviceIoControlService->DBDB__heaterCtrlSafeValve(1);
usleep(100 * 1000);
m_deviceIoControlService->DBDB__miniPwmBlowerCtrl(1);
usleep(100 * 1000);
m_deviceIoControlService->DBDB__extValveCtrl(IF_DeviceIoContrlService::kExtValveChannel_disinfectionChannel);
#else
#endif
context.m_state = kstate_disinfection;
} else {
logger->info("{}: preheat {}", context.m_disinfectionID, m_context.pre_heat_time_s - hasstarttime);
@ -492,7 +541,12 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont
float humid = m_context.max_humid;
if (m_context.injection_pump_speed_changed) {
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
m_context.injection_pump_speed_changed = false;
}
@ -500,9 +554,13 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont
if (nowSatur > m_context.stoped_satur || nowh2o2 > m_context.stoped_gs || humid > m_context.stoped_humi) {
logger->info("stop sprayLiquid");
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->sprayLiquidPump_close();
usleep(1000 * 1000);
m_deviceIoControlService->airCompressor_setState(false);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
// m_context.sprayLiquidFlag = false;
m_context.state_is_disinfection_take_break = true;
@ -516,9 +574,14 @@ void DisinfectionCtrlService::processDisinfectionState(DisinfectionContext& cont
if (nowSatur < m_context.continued_satur && nowh2o2 < m_context.continued_gs && humid < context.continued_humi) {
logger->info("start sprayLiquid");
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->sprayLiquidPump_open(context.injection_pump_speed);
usleep(1000 * 1000);
m_deviceIoControlService->airCompressor_setState(true);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
m_context.state_is_disinfection_take_break = false;
}
}
@ -549,11 +612,17 @@ void DisinfectionCtrlService::processState_Disinfection(DisinfectionContext& con
m_context.state_remaintime = 0;
m_context.state_now_loglevel = m_context.cfg_targetLoglevel + 0.01;
logger->info("disinfection finished {},but waitting for h2o2 to safe", m_context.m_disinfectionID);
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_deviceIoControlService->sprayLiquidPump_close();
usleep(1000 * 1000);
m_deviceIoControlService->airCompressor_setState(false);
usleep(1000 * 1000);
m_deviceIoControlService->heartingPlate_setPower(false);
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
#else
#endif
m_context.m_state = kstate_degradation;
}
}
@ -606,9 +675,16 @@ void DisinfectionCtrlService::disinfectionLoop(bool& breakflag) {
/**
* @brief
*/
breakflag = true;
m_context.complete_tp = zsystem_clock().now();
breakflag = true;
m_context.complete_tp = zsystem_clock().now();
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
m_context.afterDisinfectantVolume_g = m_deviceIoControlService->getDisinfectantVolume_g();
#elif (defined PROJECT_TYPE_DRAW_BAR_BOX)
m_context.afterDisinfectantVolume_g = 0;
#else
m_context.afterDisinfectantVolume_g = 0;
#endif
if (m_context.m_state != kstate_finished) {
m_context.m_state = kstate_finished;
}
@ -719,6 +795,7 @@ int32_t DisinfectionCtrlService::getPreHeatRaminTimeS() {
string DisinfectionCtrlService::getDisinfectionID() { return m_context.m_disinfectionID; }
bool DisinfectionCtrlService::isPreheatState() { return m_context.m_state == kstate_preheat; }
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
/*******************************************************************************
* // 加液 *
@ -845,6 +922,7 @@ void DisinfectionCtrlService::stopDraining() {
m_deviceIoControlService->drainingPump_close();
}
int DisinfectionCtrlService::getDrainingWorkState() { return m_drainingWorkState; }
#endif
void DisinfectionCtrlService::updateH2O2SensorData(DisinfectionContext& context) {
auto& cx = context;

12
service/disinfection_ctl_service.hpp

@ -90,8 +90,8 @@ class DisinfectionCtrlService : public enable_shared_from_this<DisinfectionCtrlS
void stopDisinfection();
int getDisinfectionWorkState();
int getReplenishingFluidsWorkState();
int getDrainingWorkState();
#if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION)
/*******************************************************************************
* *
@ -103,6 +103,11 @@ class DisinfectionCtrlService : public enable_shared_from_this<DisinfectionCtrlS
*******************************************************************************/
void startDraining();
void stopDraining();
int getReplenishingFluidsWorkState();
int getDrainingWorkState();
#endif
/*******************************************************************************
* State *
*******************************************************************************/
@ -150,5 +155,8 @@ class DisinfectionCtrlService : public enable_shared_from_this<DisinfectionCtrlS
void log(DisinfectionContext& context);
void takeStateSnapshot(DisinfectionContext& context);
void updateH2O2SensorData(DisinfectionContext& context);
private:
};
} // namespace iflytop
Loading…
Cancel
Save