From 8d4d215c0993208b4dca1427df8dd7af7b209509 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 16 Aug 2024 10:00:42 +0800 Subject: [PATCH] update --- appsrc/appsetting/appsetting.hpp | 2 +- .../appsetting/project_setting/project_setting.cpp | 103 +++++++++++++++++++++ .../appsetting/project_setting/project_setting.hpp | 83 +++++++++++++++++ .../project_setting/project_setting_mgr.cpp | 103 --------------------- .../project_setting/project_setting_mgr.hpp | 71 -------------- appsrc/baseservice/db/setting_db_dao.cpp | 4 +- appsrc/service/audit_mgr_service.cpp | 5 +- appsrc/service/disinfection_logs_service.cpp | 8 +- appsrc/service/disinfection_logs_service.hpp | 1 - appsrc/service/hardware/base/uint_convert_mgr.cpp | 7 +- appsrc/service/hardware/base/uint_convert_mgr.hpp | 5 +- appsrc/service/hardware/device_ctrl_service.cpp | 8 +- appsrc/service/main_control_service.cpp | 2 - 13 files changed, 202 insertions(+), 200 deletions(-) create mode 100644 appsrc/appsetting/project_setting/project_setting.cpp create mode 100644 appsrc/appsetting/project_setting/project_setting.hpp delete mode 100644 appsrc/appsetting/project_setting/project_setting_mgr.cpp delete mode 100644 appsrc/appsetting/project_setting/project_setting_mgr.hpp diff --git a/appsrc/appsetting/appsetting.hpp b/appsrc/appsetting/appsetting.hpp index 3dac55a..1a60f41 100644 --- a/appsrc/appsetting/appsetting.hpp +++ b/appsrc/appsetting/appsetting.hpp @@ -1,3 +1,3 @@ #pragma once -#include "project_setting/project_setting_mgr.hpp" +#include "project_setting/project_setting.hpp" diff --git a/appsrc/appsetting/project_setting/project_setting.cpp b/appsrc/appsetting/project_setting/project_setting.cpp new file mode 100644 index 0000000..eacd154 --- /dev/null +++ b/appsrc/appsetting/project_setting/project_setting.cpp @@ -0,0 +1,103 @@ +#include "project_setting.hpp" + +#include "appbase/appbase.hpp" +#include "components/zservice_container/zservice_container.hpp" +using namespace std; +using namespace iflytop; +#define INSERT(id, boardId, subId) componentIdMap.insert({id, {boardId, subId}}) + +static string projectType2Str(int val) { + switch (val) { + case klarge_space_disinfection_machine: + return PROJECT_LARGE_SPACE_DM; + case ksmall_space_disinfection_machine: + return PROJECT_SMALL_SPACE_DM; + case kpipe_disinfection_machine: + return PROJECT_PIPE_DM; + case kdraw_bar_disinfection_box: + return PROJECT_DRAW_BAR_DM; + default: + return "not-support"; + } +} + +void ProjectSetting::initialize() { + GET_TO_SERVICE(gConfig); + if (gConfig->get_projectType() == PROJECT_LARGE_SPACE_DM) { + initProjectSetting(klarge_space_disinfection_machine); + } else if (gConfig->get_projectType() == PROJECT_SMALL_SPACE_DM) { + initProjectSetting(ksmall_space_disinfection_machine); + } else if (gConfig->get_projectType() == PROJECT_PIPE_DM) { + initProjectSetting(kpipe_disinfection_machine); + } else if (gConfig->get_projectType() == PROJECT_DRAW_BAR_DM) { + initProjectSetting(kdraw_bar_disinfection_box); + } else { + THROW_APP_EXCEPTION(err::kappe_code_error, "ProjectSetting::initialize: projectType not found"); + } +} + +void ProjectSetting::initProjectSetting(int projectTypeInt) { + projectTypeInt = projectTypeInt; + projectType = projectType2Str(projectTypeInt); + + if (projectTypeInt == klarge_space_disinfection_machine) { + extSensorNum = LARGE_SPACE_DM_EXT_SENSOR_NUM; + gpmToSpeedRadio = LARGE_SPACE_DM_GPM_TO_SPEED_RADIO; + } else if (projectTypeInt == ksmall_space_disinfection_machine) { + extSensorNum = SMALL_SPACE_DM_EXT_SENSOR_NUM; + gpmToSpeedRadio = SMALL_SPACE_DM_GPM_TO_SPEED_RADIO; + } else if (projectTypeInt == kpipe_disinfection_machine) { + extSensorNum = PIPE_DM_EXT_SENSOR_NUM; + gpmToSpeedRadio = PIPE_DM_GPM_TO_SPEED_RADIO; + } else if (projectTypeInt == kdraw_bar_disinfection_box) { + extSensorNum = DRAW_BAR_DM_EXT_SENSOR_NUM; + gpmToSpeedRadio = DRAW_BAR_DM_GPM_TO_SPEED_RADIO; + } else { + ZCHECK(false, "projectTypeInt not support: " + to_string(projectTypeInt)); + } + + // 设备ID初始化 + if (isLageSpaceDM() || isSmallSpaceDM() || isPipeDM()) { + // 加液泵 + INSERT(HardwareComponent::kAddLiquidPump, kFixBoardId_LiquidCtrl, kpumpid_add_liquid); + // 喷雾泵 + INSERT(HardwareComponent::kSprayPump, kFixBoardId_LiquidCtrl, kpumpid_spray); + // 风机 + INSERT(HardwareComponent::kBlower, kFixBoardId_PowerControl, 0); + // 空压机 + INSERT(HardwareComponent::kAirCompressor, kFixBoardId_PowerControl, 0); + // 加热器 + INSERT(HardwareComponent::kHeater, kFixBoardId_PowerControl, 0); + // 报警灯 + INSERT(HardwareComponent::kWarningLight, kFixBoardId_LiquidCtrl, 0); + // 蒸发仓水浸 + INSERT(HardwareComponent::kEvaporationBinWS, kFixBoardId_LiquidCtrl, 0); + // 底部水浸 + INSERT(HardwareComponent::kDeviceBottomWS, kFixBoardId_LiquidCtrl, 0); + // 主H2O2传感器 + INSERT(HardwareComponent::kMainH2O2Sensor, kFixBoardId_PowerControl, 0); + // 液体重量传感器 + INSERT(HardwareComponent::kLiquidWeightPS, kFixBoardId_LiquidCtrl, 1); + // 空压机后压力传感器 + INSERT(HardwareComponent::kACPostPS, kFixBoardId_LiquidCtrl, 0); + // 喷雾泵后压力传感器 + INSERT(HardwareComponent::kSprayPumpPostPS, kFixBoardId_LiquidCtrl, 0); + // 加液泵后压力传感器 + INSERT(HardwareComponent::kAddLiquidPumpPostPS, kFixBoardId_LiquidCtrl, 0); + + if (isPipeDM()) { + // 正压比例阀 + INSERT(HardwareComponent::kPositivePressureProportional, kFixBoardId_LiquidCtrl, POSITIVE_PRESSURE_PROPORTIONAL_ID); + // 负压比例阀 + INSERT(HardwareComponent::kNegativePressureProportional, kFixBoardId_LiquidCtrl, NEGATIVE_PRESSURE_PROPORTIONAL_ID); + // 气密传感器 + INSERT(HardwareComponent::kAirLeakDetectPS, kFixBoardId_LiquidCtrl, 0); + // 空气密度测试空压机 + INSERT(HardwareComponent::kAirLeakDetectTestAC, kFixBoardId_LiquidCtrl, 0); + // 空气密度测试通道控制 + INSERT(HardwareComponent::kAirLeakDetectTestChannelCtrl, kFixBoardId_LiquidCtrl, 0); + } + } + if (isDrawBarDM()) { + } +} \ No newline at end of file diff --git a/appsrc/appsetting/project_setting/project_setting.hpp b/appsrc/appsetting/project_setting/project_setting.hpp new file mode 100644 index 0000000..478470c --- /dev/null +++ b/appsrc/appsetting/project_setting/project_setting.hpp @@ -0,0 +1,83 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include "appbase/appbasedep.hpp" +#include "appbase/appbean/hardware_component.hpp" +// +#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp" +// +#include "basic/componentid.hpp" +#include "basic/gconfig.hpp" +#include "basic/project_constant.hpp" +// +namespace iflytop { +using namespace std; +using namespace transmit_disfection_protocol; + +class ProjectSetting { + THISCLASS(ProjectSetting); + + private: + ProjectSetting() {} + + public: + /* data */ + shared_ptr gConfig; + map componentIdMap; + string projectType = PROJECT_LARGE_SPACE_DM; + int projectTypeInt = klarge_space_disinfection_machine; + + // + // some properties + // + int extSensorNum = 0; + double gpmToSpeedRadio = 0; + bool isInited = false; + + public: + static ProjectSetting &ins() { + static ProjectSetting instance; + if (!instance.isInited) { + instance.initialize(); + instance.isInited = true; + } + return instance; + } + void initialize(); + + public: + int32_t getProjType(); + + bool isLageSpaceDM() { return projectTypeInt == klarge_space_disinfection_machine; } + bool isSmallSpaceDM() { return projectTypeInt == ksmall_space_disinfection_machine; } + bool isPipeDM() { return projectTypeInt == kpipe_disinfection_machine; } + bool isDrawBarDM() { return projectTypeInt == kdraw_bar_disinfection_box; } + + bool isProjectType(int id) { return id == projectTypeInt; } + bool isProjectType(int id0, int id1) { return id0 == projectTypeInt || id1 == projectTypeInt; } + bool isProjectType(int id0, int id1, int id2) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt; } + bool isProjectType(int id0, int id1, int id2, int id3) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt || id3 == projectTypeInt; } + + ComponentId getId(HardwareComponent component) { + auto it = componentIdMap.find(component); + if (it != componentIdMap.end()) { + return it->second; + } + THROW_APP_EXCEPTION(err::kappe_code_error, "ComponentIdMgr::getId: component not found"); + } + + private: + void initProjectSetting(int projectTypeInt); +}; +#define PROJECT_TYPE (GET_SERVICE(ProjectSettingMgr)->getProjType()) +#define PROJECT_SETTING (GET_SERVICE(ProjectSettingMgr)) +} // namespace iflytop diff --git a/appsrc/appsetting/project_setting/project_setting_mgr.cpp b/appsrc/appsetting/project_setting/project_setting_mgr.cpp deleted file mode 100644 index 2d46147..0000000 --- a/appsrc/appsetting/project_setting/project_setting_mgr.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "project_setting_mgr.hpp" - -#include "appbase/appbase.hpp" -#include "components/zservice_container/zservice_container.hpp" -using namespace std; -using namespace iflytop; -#define INSERT(id, boardId, subId) componentIdMap.insert({id, {boardId, subId}}) - -static string projectType2Str(int val) { - switch (val) { - case klarge_space_disinfection_machine: - return PROJECT_LARGE_SPACE_DM; - case ksmall_space_disinfection_machine: - return PROJECT_SMALL_SPACE_DM; - case kpipe_disinfection_machine: - return PROJECT_PIPE_DM; - case kdraw_bar_disinfection_box: - return PROJECT_DRAW_BAR_DM; - default: - return "not-support"; - } -} - -void ProjectSetting::initialize() { - GET_TO_SERVICE(gConfig); - if (gConfig->get_projectType() == PROJECT_LARGE_SPACE_DM) { - initProjectSetting(klarge_space_disinfection_machine); - } else if (gConfig->get_projectType() == PROJECT_SMALL_SPACE_DM) { - initProjectSetting(ksmall_space_disinfection_machine); - } else if (gConfig->get_projectType() == PROJECT_PIPE_DM) { - initProjectSetting(kpipe_disinfection_machine); - } else if (gConfig->get_projectType() == PROJECT_DRAW_BAR_DM) { - initProjectSetting(kdraw_bar_disinfection_box); - } else { - THROW_APP_EXCEPTION(err::kappe_code_error, "ProjectSetting::initialize: projectType not found"); - } -} - -void ProjectSetting::initProjectSetting(int projectTypeInt) { - projectTypeInt = projectTypeInt; - projectType = projectType2Str(projectTypeInt); - - if (projectTypeInt == klarge_space_disinfection_machine) { - extSensorNum = LARGE_SPACE_DM_EXT_SENSOR_NUM; - gpmToSpeedRadio = LARGE_SPACE_DM_GPM_TO_SPEED_RADIO; - } else if (projectTypeInt == ksmall_space_disinfection_machine) { - extSensorNum = SMALL_SPACE_DM_EXT_SENSOR_NUM; - gpmToSpeedRadio = SMALL_SPACE_DM_GPM_TO_SPEED_RADIO; - } else if (projectTypeInt == kpipe_disinfection_machine) { - extSensorNum = PIPE_DM_EXT_SENSOR_NUM; - gpmToSpeedRadio = PIPE_DM_GPM_TO_SPEED_RADIO; - } else if (projectTypeInt == kdraw_bar_disinfection_box) { - extSensorNum = DRAW_BAR_DM_EXT_SENSOR_NUM; - gpmToSpeedRadio = DRAW_BAR_DM_GPM_TO_SPEED_RADIO; - } else { - ZCHECK(false, "projectTypeInt not support: " + to_string(projectTypeInt)); - } - - // 设备ID初始化 - if (isLageSpaceDM() || isSmallSpaceDM() || isPipeDM()) { - // 加液泵 - INSERT(HardwareComponent::kAddLiquidPump, kFixBoardId_LiquidCtrl, kpumpid_add_liquid); - // 喷雾泵 - INSERT(HardwareComponent::kSprayPump, kFixBoardId_LiquidCtrl, kpumpid_spray); - // 风机 - INSERT(HardwareComponent::kBlower, kFixBoardId_PowerControl, 0); - // 空压机 - INSERT(HardwareComponent::kAirCompressor, kFixBoardId_PowerControl, 0); - // 加热器 - INSERT(HardwareComponent::kHeater, kFixBoardId_PowerControl, 0); - // 报警灯 - INSERT(HardwareComponent::kWarningLight, kFixBoardId_LiquidCtrl, 0); - // 蒸发仓水浸 - INSERT(HardwareComponent::kEvaporationBinWS, kFixBoardId_LiquidCtrl, 0); - // 底部水浸 - INSERT(HardwareComponent::kDeviceBottomWS, kFixBoardId_LiquidCtrl, 0); - // 主H2O2传感器 - INSERT(HardwareComponent::kMainH2O2Sensor, kFixBoardId_PowerControl, 0); - // 液体重量传感器 - INSERT(HardwareComponent::kLiquidWeightPS, kFixBoardId_LiquidCtrl, 1); - // 空压机后压力传感器 - INSERT(HardwareComponent::kACPostPS, kFixBoardId_LiquidCtrl, 0); - // 喷雾泵后压力传感器 - INSERT(HardwareComponent::kSprayPumpPostPS, kFixBoardId_LiquidCtrl, 0); - // 加液泵后压力传感器 - INSERT(HardwareComponent::kAddLiquidPumpPostPS, kFixBoardId_LiquidCtrl, 0); - - if (isPipeDM()) { - // 正压比例阀 - INSERT(HardwareComponent::kPositivePressureProportional, kFixBoardId_LiquidCtrl, POSITIVE_PRESSURE_PROPORTIONAL_ID); - // 负压比例阀 - INSERT(HardwareComponent::kNegativePressureProportional, kFixBoardId_LiquidCtrl, NEGATIVE_PRESSURE_PROPORTIONAL_ID); - // 气密传感器 - INSERT(HardwareComponent::kAirLeakDetectPS, kFixBoardId_LiquidCtrl, 0); - // 空气密度测试空压机 - INSERT(HardwareComponent::kAirLeakDetectTestAC, kFixBoardId_LiquidCtrl, 0); - // 空气密度测试通道控制 - INSERT(HardwareComponent::kAirLeakDetectTestChannelCtrl, kFixBoardId_LiquidCtrl, 0); - } - } - if (isDrawBarDM()) { - } -} \ No newline at end of file diff --git a/appsrc/appsetting/project_setting/project_setting_mgr.hpp b/appsrc/appsetting/project_setting/project_setting_mgr.hpp deleted file mode 100644 index 8a20022..0000000 --- a/appsrc/appsetting/project_setting/project_setting_mgr.hpp +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// -#include "appbase/appbasedep.hpp" -#include "appbase/appbean/hardware_component.hpp" -// -#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp" -// -#include "basic/componentid.hpp" -#include "basic/gconfig.hpp" -#include "basic/project_constant.hpp" -// -namespace iflytop { -using namespace std; -using namespace transmit_disfection_protocol; - -class ProjectSetting { - THISCLASS(ProjectSetting); - - public: - /* data */ - shared_ptr gConfig; - map componentIdMap; - string projectType = PROJECT_LARGE_SPACE_DM; - int projectTypeInt = klarge_space_disinfection_machine; - - // - // some properties - // - int extSensorNum = 0; - double gpmToSpeedRadio = 0; - - public: - void initialize(); - - public: - int32_t getProjType(); - - bool isLageSpaceDM() { return projectTypeInt == klarge_space_disinfection_machine; } - bool isSmallSpaceDM() { return projectTypeInt == ksmall_space_disinfection_machine; } - bool isPipeDM() { return projectTypeInt == kpipe_disinfection_machine; } - bool isDrawBarDM() { return projectTypeInt == kdraw_bar_disinfection_box; } - - bool isProjectType(int id) { return id == projectTypeInt; } - bool isProjectType(int id0, int id1) { return id0 == projectTypeInt || id1 == projectTypeInt; } - bool isProjectType(int id0, int id1, int id2) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt; } - bool isProjectType(int id0, int id1, int id2, int id3) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt || id3 == projectTypeInt; } - - ComponentId getId(HardwareComponent component) { - auto it = componentIdMap.find(component); - if (it != componentIdMap.end()) { - return it->second; - } - THROW_APP_EXCEPTION(err::kappe_code_error, "ComponentIdMgr::getId: component not found"); - } - - private: - void initProjectSetting(int projectTypeInt); -}; -#define PROJECT_TYPE (GET_SERVICE(ProjectSettingMgr)->getProjType()) -#define PROJECT_SETTING (GET_SERVICE(ProjectSettingMgr)) -} // namespace iflytop diff --git a/appsrc/baseservice/db/setting_db_dao.cpp b/appsrc/baseservice/db/setting_db_dao.cpp index 7886e4d..32798d9 100644 --- a/appsrc/baseservice/db/setting_db_dao.cpp +++ b/appsrc/baseservice/db/setting_db_dao.cpp @@ -106,11 +106,11 @@ void SettingDBDao::initialize() { // if (version != DB_VERSION) { keyvaldb.clear(); keyvaldb.set("version", DB_VERSION); - auto projSetting = GET_SERVICE(ProjectSetting); + auto projSetting = ProjectSetting::ins(); for (auto& setting : settingInitTable) { // 部分设置项根据项目类型进行初始化 if (setting.setting_id == SettingId::injection_pump_speed) { - if (projSetting->isProjectType(kdraw_bar_disinfection_box)) { + if (projSetting.isProjectType(kdraw_bar_disinfection_box)) { setting.default_val = "4"; setting.val = "4"; setting.val_lower_limit = "0"; diff --git a/appsrc/service/audit_mgr_service.cpp b/appsrc/service/audit_mgr_service.cpp index 6101f59..237fbc4 100644 --- a/appsrc/service/audit_mgr_service.cpp +++ b/appsrc/service/audit_mgr_service.cpp @@ -10,8 +10,8 @@ using namespace iflytop; static string getTime() { struct tm tm = {0}; - time_t t = ::time(nullptr); - struct tm* tmp = localtime_r(&t, &tm); + time_t t = ::time(nullptr); + localtime_r(&t, &tm); return fmt::format("{:0>4}{:0>2}{:0>2}{:0>2}{:0>2}{:0>2}", tm.tm_year + 1900, // tm.tm_mon + 1, // tm.tm_mday, // @@ -89,7 +89,6 @@ void AuditMgrService::getRecords(shared_ptr cxt) { cxt->content = m_db->getUserBehaviorRecordDescJson(jsonGet(params["page"]), jsonGet(params["page_size"])); } void AuditMgrService::pushTestData(shared_ptr cxt) { - ADD_USER_BEHAVIOR("123", kbehavior_login, ""); ADD_USER_BEHAVIOR("123", kbehavior_logout, ""); ADD_USER_BEHAVIOR("123", kbehavior_add_user, ""); diff --git a/appsrc/service/disinfection_logs_service.cpp b/appsrc/service/disinfection_logs_service.cpp index 81b5680..49ce3e1 100644 --- a/appsrc/service/disinfection_logs_service.cpp +++ b/appsrc/service/disinfection_logs_service.cpp @@ -108,7 +108,6 @@ void DisinfectionLogsService::initialize() { GET_TO_SERVICE(m_db); GET_TO_SERVICE(m_ds); GET_TO_SERVICE(m_gConfig); - GET_TO_SERVICE(m_projectSettingMgr); GET_TO_SERVICE(m_udiskMgrService); REGFN(DisinfectionLogsService, getRecordList); @@ -177,7 +176,6 @@ void DisinfectionLogsService::dumpDisinfectionRecord(string sessionId, listtime, "%Y-%m-%d %H:%M:%S")); @@ -187,14 +185,14 @@ void DisinfectionLogsService::dumpDisinfectionRecord(string sessionId, listrh[0])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::rs_0), /******************/ formatSensorVal(s->rs[0])); - if (projSetting->extSensorNum >= 1) { + if (ProjectSetting::ins().extSensorNum >= 1) { csv.addValue(m_csvHeaderDict.getChName(CSVHeader::ho2o2_1), /***************/ formatSensorVal(s->h2o2[1])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::temp_1), /****************/ formatSensorVal(s->temp[1])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::rh_1), /******************/ formatSensorVal(s->rh[1])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::rs_1), /******************/ formatSensorVal(s->rs[1])); } - if (projSetting->extSensorNum >= 2) { + if (ProjectSetting::ins().extSensorNum >= 2) { csv.addValue(m_csvHeaderDict.getChName(CSVHeader::ho2o2_2), /***************/ formatSensorVal(s->h2o2[2])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::temp_2), /****************/ formatSensorVal(s->temp[2])); csv.addValue(m_csvHeaderDict.getChName(CSVHeader::rh_2), /******************/ formatSensorVal(s->rh[2])); @@ -206,7 +204,7 @@ void DisinfectionLogsService::dumpDisinfectionRecord(string sessionId, listtlog)); // 拉杆箱消毒机没有消毒剂剩余量 - if (projSetting->projectTypeInt != kdraw_bar_disinfection_box) { + if (ProjectSetting::ins().projectTypeInt != kdraw_bar_disinfection_box) { csv.addValue(m_csvHeaderDict.getChName(CSVHeader::remaindisinfectant), /****/ fmt::format("{}", s->remainDisinfectant)); } csv.addValue(m_csvHeaderDict.getChName(CSVHeader::pumpvel), /***************/ fmt::format("{}", s->pumpVel)); diff --git a/appsrc/service/disinfection_logs_service.hpp b/appsrc/service/disinfection_logs_service.hpp index fa0b62d..b4341f2 100644 --- a/appsrc/service/disinfection_logs_service.hpp +++ b/appsrc/service/disinfection_logs_service.hpp @@ -48,7 +48,6 @@ class DisinfectionLogsService : public enable_shared_from_this m_db; shared_ptr m_ds; shared_ptr m_gConfig; - shared_ptr m_projectSettingMgr; shared_ptr m_udiskMgrService; string m_sessionId; diff --git a/appsrc/service/hardware/base/uint_convert_mgr.cpp b/appsrc/service/hardware/base/uint_convert_mgr.cpp index df1e9f8..551264c 100644 --- a/appsrc/service/hardware/base/uint_convert_mgr.cpp +++ b/appsrc/service/hardware/base/uint_convert_mgr.cpp @@ -8,9 +8,6 @@ void UintConvertMgr::initialize() { return; } isInited = true; - - m_projSet = GET_SERVICE(ProjectSetting); - ZASSERT(m_projSet); } -double UintConvertMgr::gpm2speed(double gpm) { return gpm * m_projSet->gpmToSpeedRadio; } -double UintConvertMgr::speed2gpm(double speed) { return (speed / m_projSet->gpmToSpeedRadio) + 0.5; } \ No newline at end of file +double UintConvertMgr::gpm2speed(double gpm) { return gpm * ProjectSetting::ins().gpmToSpeedRadio; } +double UintConvertMgr::speed2gpm(double speed) { return (speed / ProjectSetting::ins().gpmToSpeedRadio) + 0.5; } \ No newline at end of file diff --git a/appsrc/service/hardware/base/uint_convert_mgr.hpp b/appsrc/service/hardware/base/uint_convert_mgr.hpp index 25d744b..6a858e4 100644 --- a/appsrc/service/hardware/base/uint_convert_mgr.hpp +++ b/appsrc/service/hardware/base/uint_convert_mgr.hpp @@ -32,9 +32,8 @@ using namespace core; class UintConvertMgr : public enable_shared_from_this { THISCLASS(UintConvertMgr); - recursive_mutex lock_; - bool isInited = false; - shared_ptr m_projSet; + recursive_mutex lock_; + bool isInited = false; public: void initialize(); diff --git a/appsrc/service/hardware/device_ctrl_service.cpp b/appsrc/service/hardware/device_ctrl_service.cpp index d6d5704..d5cd39f 100644 --- a/appsrc/service/hardware/device_ctrl_service.cpp +++ b/appsrc/service/hardware/device_ctrl_service.cpp @@ -1,5 +1,5 @@ #include "device_ctrl_service.hpp" -#if 0 +#if 1 using namespace iflytop; using namespace std; using namespace core; @@ -32,8 +32,8 @@ bool isInPc() { // kh2o2_ext_sensor = 5, // 外部H2O2传感器 #define CAN_MASTER TransmitDisinfectionCanMaster::ins() -#define GET_BOARDID() (m_boardIdMgr->getId(COMPONENT).boardId) -#define GET_SUBID() (m_boardIdMgr->getId(COMPONENT).subId) +#define GET_BOARDID() (ProjectSetting::ins().getId(COMPONENT).boardId) +#define GET_SUBID() (ProjectSetting::ins().getId(COMPONENT).subId) void DeviceIoControlService::initialize() { GET_TO_SERVICE(m_config); @@ -131,7 +131,7 @@ int DeviceIoControlService::NegaPressureProp_readPos() { return CAN_MASTER->pro bool DeviceIoControlService::NegaPressureProp_isBusy() { return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); } #undef COMPONENT -#define COMPONENT HardwareComponent::AirLeakDetectTest +#define COMPONENT HardwareComponent::AirLeakDetectTestChannelCtrl void DeviceIoControlService::AirLeakDetectTest_cutoffCh() { CAN_MASTER->airLeakDetectTestCloseOffCh(GET_BOARDID()); } void DeviceIoControlService::AirLeakDetectTest_releaseCh() { CAN_MASTER->airLeakDetectTestReleaseCh(GET_BOARDID()); } #undef COMPONENT diff --git a/appsrc/service/main_control_service.cpp b/appsrc/service/main_control_service.cpp index 6a1b172..2ed908f 100644 --- a/appsrc/service/main_control_service.cpp +++ b/appsrc/service/main_control_service.cpp @@ -27,8 +27,6 @@ void MainControlService::dosystem(string order, bool dump) { } void MainControlService::initialize() { - BUILD_AND_REG_SERRVICE(ProjectSetting); - // Base BUILD_AND_REG_SERRVICE(IflytopFrontEndService); BUILD_AND_REG_SERRVICE(FrontMsgProcesser);