From ee1f8ffe4776735553871c6fe2ac8b65377c9fbc Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 17 May 2024 20:31:48 +0800 Subject: [PATCH] update --- api/cmds/device_state_cmd_impl.cpp | 10 ++++-- api/cmds/device_state_cmd_impl.hpp | 23 +++++++------- api/cmds/disinfection_cmd_impl.cpp | 63 ++++++++++++++++++++++++++++++++++++++ api/cmds/disinfection_cmd_impl.hpp | 13 ++++++++ 4 files changed, 95 insertions(+), 14 deletions(-) diff --git a/api/cmds/device_state_cmd_impl.cpp b/api/cmds/device_state_cmd_impl.cpp index 82f5d13..f42defb 100644 --- a/api/cmds/device_state_cmd_impl.cpp +++ b/api/cmds/device_state_cmd_impl.cpp @@ -32,8 +32,6 @@ json DeviceStateCmdImpl::createSensorDataJson() { #else #endif - - report["h2o2_1"] = m_deviceIoControlService->H2O2Sensor_readH2O2PPM(0); report["temp_1"] = m_deviceIoControlService->H2O2Sensor_readTemperature(0); report["humid_1"] = m_deviceIoControlService->H2O2Sensor_readHumid(0); @@ -79,7 +77,7 @@ void DeviceStateCmdImpl::getState(json& cmd, json& receipt) { #elif (defined PROJECT_TYPE_DRAW_BAR_BOX) #else #endif - receipt["state"]["disinfectionWorkState"] = m_disinfectionCtrlService->getDisinfectionWorkState(); + receipt["state"]["disinfectionWorkState"] = m_disinfectionCtrlService->getDisinfectionWorkState(); /** * @brief 历史接口 */ @@ -115,6 +113,12 @@ void DeviceStateCmdImpl::getState(json& cmd, json& receipt) { receipt["disinfectionConfig"]["continued_humi"] = m_disinfectionCtrlService->m_context.continued_humi; return; } + +void DeviceStateCmdImpl::DeviceState__getDBDBExtChannelCtrlComponentState(json& cmd, json& receipt) { + receipt["ack"]["online"] = m_deviceIoControlService->DBDB__extValBoardIsOnline(); + return; +} + void DeviceStateCmdImpl::initialize() { GET_TO_SERVICE(m_msgProcesser); GET_TO_SERVICE(m_zconfig); diff --git a/api/cmds/device_state_cmd_impl.hpp b/api/cmds/device_state_cmd_impl.hpp index 8274c56..2c759d6 100644 --- a/api/cmds/device_state_cmd_impl.hpp +++ b/api/cmds/device_state_cmd_impl.hpp @@ -14,17 +14,17 @@ namespace iflytop { class DeviceStateCmdImpl : public enable_shared_from_this { ENABLE_LOGGER(DeviceStateCmdImpl); - shared_ptr m_msgProcesser; - shared_ptr m_zconfig; - shared_ptr m_iflytopwsService; - shared_ptr m_dbService; - shared_ptr m_deviceStateService; - shared_ptr m_disinfectionCtrlService; - shared_ptr m_deviceIoControlService; - shared_ptr m_disinfectionLogsManager; - shared_ptr m_zcanhost; - shared_ptr m_dataExportService; - shared_ptr m_frontMsgProcesser; + shared_ptr m_msgProcesser; + shared_ptr m_zconfig; + shared_ptr m_iflytopwsService; + shared_ptr m_dbService; + shared_ptr m_deviceStateService; + shared_ptr m_disinfectionCtrlService; + shared_ptr m_deviceIoControlService; + shared_ptr m_disinfectionLogsManager; + shared_ptr m_zcanhost; + shared_ptr m_dataExportService; + shared_ptr m_frontMsgProcesser; unique_ptr m_reportThread; @@ -34,6 +34,7 @@ class DeviceStateCmdImpl : public enable_shared_from_this { private: void getState(json& cmd, json& receipt); + void DeviceState__getDBDBExtChannelCtrlComponentState(json& cmd, json& receipt); private: json createSensorDataJson(); diff --git a/api/cmds/disinfection_cmd_impl.cpp b/api/cmds/disinfection_cmd_impl.cpp index 45c913f..2d341ba 100644 --- a/api/cmds/disinfection_cmd_impl.cpp +++ b/api/cmds/disinfection_cmd_impl.cpp @@ -123,6 +123,69 @@ void DisinfectionCmdImpl::getDisinfectionConfig(json& cmd, json& receipt) { return; } +// { +// "command" : "setDehumidifyAfterDisinfectionEnable", +// "messageId" : "call-2", +// "params" : {"enable":true} +// } + +bool DehumidifyBeforeDisinfectionEnable; +bool DehumidifyAfterDisinfectionEnable; +bool DegradeAfterDisinfectionEnable; +int32_t DehumidifyBeforeDisinfectionThreshold; +int32_t DehumidifyAfterDisinfectionThreshold; + +void DisinfectionCmdImpl::setDehumidifyBeforeDisinfectionEnable(json& cmd, json& receipt) { + bool enable = cmd["enable"]; + logger->info("setDehumidifyBeforeDisinfectionEnable {}", enable); + DehumidifyBeforeDisinfectionEnable = enable; + return; +} +void DisinfectionCmdImpl::setDehumidifyAfterDisinfectionEnable(json& cmd, json& receipt) { + bool enable = cmd["enable"]; + logger->info("setDehumidifyAfterDisinfectionEnable {}", enable); + DehumidifyAfterDisinfectionEnable = enable; + return; +} +void DisinfectionCmdImpl::setDegradeAfterDisinfectionEnable(json& cmd, json& receipt) { + bool enable = cmd["enable"]; + logger->info("setDegradeAfterDisinfectionEnable {}", enable); + DegradeAfterDisinfectionEnable = enable; + return; +} +void DisinfectionCmdImpl::setDehumidifyBeforeDisinfectionThreshold(json& cmd, json& receipt) { + int32_t value = jsonGet(cmd["value"]); + logger->info("setDehumidifyBeforeDisinfectionThreshold {}", value); + DehumidifyBeforeDisinfectionThreshold = value; + return; +} +void DisinfectionCmdImpl::setDehumidifyAfterDisinfectionThreshold(json& cmd, json& receipt) { + int32_t value = jsonGet(cmd["value"]); + logger->info("setDehumidifyAfterDisinfectionThreshold {}", value); + DehumidifyAfterDisinfectionThreshold = value; + return; +} +void DisinfectionCmdImpl::getDehumidifyBeforeDisinfectionEnable(json& cmd, json& receipt) { + receipt["ack"]["enable"] = DehumidifyBeforeDisinfectionEnable; + return; +} +void DisinfectionCmdImpl::getDehumidifyAfterDisinfectionEnable(json& cmd, json& receipt) { + receipt["ack"]["enable"] = DehumidifyAfterDisinfectionEnable; + return; +} +void DisinfectionCmdImpl::getDegradeAfterDisinfectionEnable(json& cmd, json& receipt) { + receipt["ack"]["enable"] = DegradeAfterDisinfectionEnable; + return; +} +void DisinfectionCmdImpl::getDehumidifyBeforeDisinfectionThreshold(json& cmd, json& receipt) { + receipt["ack"]["value"] = DehumidifyBeforeDisinfectionThreshold; + return; +} +void DisinfectionCmdImpl::getDehumidifyAfterDisinfectionThreshold(json& cmd, json& receipt) { + receipt["ack"]["value"] = DehumidifyAfterDisinfectionThreshold; + return; +} + void DisinfectionCmdImpl::initialize() { GET_TO_SERVICE(m_msgProcesser); GET_TO_SERVICE(m_zconfig); diff --git a/api/cmds/disinfection_cmd_impl.hpp b/api/cmds/disinfection_cmd_impl.hpp index ed16853..247fff8 100644 --- a/api/cmds/disinfection_cmd_impl.hpp +++ b/api/cmds/disinfection_cmd_impl.hpp @@ -42,6 +42,19 @@ class DisinfectionCmdImpl : public enable_shared_from_this void startDraining(json& cmd, json& receipt); void stopDraining(json& cmd, json& receipt); #endif + + void setDehumidifyBeforeDisinfectionEnable(json& cmd, json& receipt); + void setDehumidifyAfterDisinfectionEnable(json& cmd, json& receipt); + void setDegradeAfterDisinfectionEnable(json& cmd, json& receipt); + void setDehumidifyBeforeDisinfectionThreshold(json& cmd, json& receipt); + void setDehumidifyAfterDisinfectionThreshold(json& cmd, json& receipt); + + void getDehumidifyBeforeDisinfectionEnable(json& cmd, json& receipt); + void getDehumidifyAfterDisinfectionEnable(json& cmd, json& receipt); + void getDegradeAfterDisinfectionEnable(json& cmd, json& receipt); + void getDehumidifyBeforeDisinfectionThreshold(json& cmd, json& receipt); + void getDehumidifyAfterDisinfectionThreshold(json& cmd, json& receipt); + void startFormula(json& cmd, json& receipt); };