From e632902cf6bff3751cb8bd7a8b633652a2db2a3d Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 16 Sep 2024 17:56:30 +0800 Subject: [PATCH] update --- appsrc/service/app/add_liquid_service.cpp | 10 ++++++++-- appsrc/service/app/air_leak_detect_test.cpp | 6 +++++- appsrc/service/app/disinfection_ctrl_service_ext.cpp | 3 +++ appsrc/service/app/drain_liquid_service.cpp | 6 +++++- appsrc/service/app/pipeline_pressure_control.cpp | 7 ++++--- appsrc/service/app/pipeline_pressure_control.hpp | 4 ++-- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/appsrc/service/app/add_liquid_service.cpp b/appsrc/service/app/add_liquid_service.cpp index a5ff94d..6e5dbc8 100644 --- a/appsrc/service/app/add_liquid_service.cpp +++ b/appsrc/service/app/add_liquid_service.cpp @@ -142,8 +142,14 @@ void AddLiquidService::stop() { } AddLiquidService::state_t AddLiquidService::getWorkstate() { return m_workstate; } -void AddLiquidService::start(shared_ptr cxt, int stopatg) { start(stopatg); } -void AddLiquidService::stop(shared_ptr cxt) { stop(); } +void AddLiquidService::start(shared_ptr cxt, int stopatg) { + start(stopatg); + if (stateUpdateThread) stateUpdateThread->wake(); +} +void AddLiquidService::stop(shared_ptr cxt) { + stop(); + if (stateUpdateThread) stateUpdateThread->wake(); +} void AddLiquidService::getServiceConfig(shared_ptr cxt) { json cfg; cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity(); diff --git a/appsrc/service/app/air_leak_detect_test.cpp b/appsrc/service/app/air_leak_detect_test.cpp index 03a1d9e..ee183e4 100644 --- a/appsrc/service/app/air_leak_detect_test.cpp +++ b/appsrc/service/app/air_leak_detect_test.cpp @@ -101,8 +101,12 @@ void AirLeakDetectTest::airLeakDetectTestThread(int inflationTimeMs) { void AirLeakDetectTest::start(shared_ptr cxt, int inflationTimeMs) { // start(inflationTimeMs); + if (stateUpdateThread) stateUpdateThread->wake(); +} +void AirLeakDetectTest::stop(shared_ptr cxt) { + stop(); + if (stateUpdateThread) stateUpdateThread->wake(); } -void AirLeakDetectTest::stop(shared_ptr cxt) { stop(); } void AirLeakDetectTest::getServiceConfig(shared_ptr cxt) { if (PORT.isPipeDM()) { diff --git a/appsrc/service/app/disinfection_ctrl_service_ext.cpp b/appsrc/service/app/disinfection_ctrl_service_ext.cpp index 711ef0e..b875602 100644 --- a/appsrc/service/app/disinfection_ctrl_service_ext.cpp +++ b/appsrc/service/app/disinfection_ctrl_service_ext.cpp @@ -60,14 +60,17 @@ void DisinfectionCtrlServiceExt::start(shared_ptr cxt, string dcs->start(level); ADD_USER_BEHAVIOR(ds->getLoginName(), kbehavior_do_disinfection, fmt::format("开始消毒,level:{}", level)); // m_state = DisinfectionState::preheat; + if (stateUpdateThread) stateUpdateThread->wake(); } void DisinfectionCtrlServiceExt::startWithFormula(shared_ptr cxt, string formulaid) { // json formula = dcs->startWithFormula(formulaid); ADD_USER_BEHAVIOR(ds->getLoginName(), kbehavior_do_formula, fmt::format("启动配置方,{}", formula["name"])); + if (stateUpdateThread) stateUpdateThread->wake(); } void DisinfectionCtrlServiceExt::stop(shared_ptr cxt) { ADD_USER_BEHAVIOR(ds->getLoginName(), kbehavior_stop_disinfection, ""); dcs->stop(); + if (stateUpdateThread) stateUpdateThread->wake(); } void DisinfectionCtrlServiceExt::getRealtimeConfig(shared_ptr cxt) { diff --git a/appsrc/service/app/drain_liquid_service.cpp b/appsrc/service/app/drain_liquid_service.cpp index 095ade6..6329866 100644 --- a/appsrc/service/app/drain_liquid_service.cpp +++ b/appsrc/service/app/drain_liquid_service.cpp @@ -76,8 +76,12 @@ void DrainLiquidService::stop() { void DrainLiquidService::start(shared_ptr cxt) { // start(); + if (stateUpdateThread) stateUpdateThread->wake(); +} +void DrainLiquidService::stop(shared_ptr cxt) { + stop(); + if (stateUpdateThread) stateUpdateThread->wake(); } -void DrainLiquidService::stop(shared_ptr cxt) { stop(); } void DrainLiquidService::getServiceConfig(shared_ptr cxt) { json cfg; diff --git a/appsrc/service/app/pipeline_pressure_control.cpp b/appsrc/service/app/pipeline_pressure_control.cpp index 3902e83..e2461d6 100644 --- a/appsrc/service/app/pipeline_pressure_control.cpp +++ b/appsrc/service/app/pipeline_pressure_control.cpp @@ -25,8 +25,8 @@ void PipelinePressureControl::initialize() { REG_EXTFN(setIntensity, void(int), intensity); REG_EXTFN_VOID(getState, void(void)); REG_EXTFN_VOID(getConfig, void(void)); - REG_EXTFN_VOID(startStateReport, void()); - REG_EXTFN_VOID(stopStateReport, void()); + // REG_EXTFN_VOID(startStateReport, void()); + // REG_EXTFN_VOID(stopStateReport, void()); m_type = PressureType::constantPressure; m_intensity = 0; @@ -91,7 +91,7 @@ void PipelinePressureControl::setIntensity(shared_ptr cxt, in syncPressureValueState(); } void PipelinePressureControl::getState(shared_ptr cxt) { cxt->rely = getState(); } - +#if 0 void PipelinePressureControl::startStateReport(shared_ptr cxt) { if (stateUpdateThread) { stateUpdateThread->join(); @@ -115,6 +115,7 @@ void PipelinePressureControl::stopStateReport(shared_ptr cxt) stateUpdateThread = nullptr; } } +#endif json PipelinePressureControl::getState() { json state; state["type"] = m_type; diff --git a/appsrc/service/app/pipeline_pressure_control.hpp b/appsrc/service/app/pipeline_pressure_control.hpp index 2f92c2a..6fe9e30 100644 --- a/appsrc/service/app/pipeline_pressure_control.hpp +++ b/appsrc/service/app/pipeline_pressure_control.hpp @@ -73,8 +73,8 @@ class PipelinePressureControl : public enable_shared_from_this cxt); void getConfig(shared_ptr cxt); - void startStateReport(shared_ptr cxt); - void stopStateReport(shared_ptr cxt); + // void startStateReport(shared_ptr cxt); + // void stopStateReport(shared_ptr cxt); json getState(); private: