diff --git a/appsrc/appbase/appbean/hardware_component.hpp b/appsrc/appbase/appbean/hardware_component.hpp index 6f69b71..643b6d6 100644 --- a/appsrc/appbase/appbean/hardware_component.hpp +++ b/appsrc/appbase/appbean/hardware_component.hpp @@ -17,7 +17,6 @@ marco(type, ExtChSelector) /**/ \ marco(type, EvaporationBinWS) /**/ \ marco(type, DeviceBottomWS) /**/ \ - marco(type, MainH2O2Sensor) /**/ \ marco(type, ACPostPS) /**/ \ marco(type, AirLeakDetectPS) /**/ \ marco(type, LiquidWeightPS) /**/ \ diff --git a/appsrc/appconfig/basic/zappversion.hpp b/appsrc/appconfig/basic/zappversion.hpp index 5ba2bba..081b4da 100644 --- a/appsrc/appconfig/basic/zappversion.hpp +++ b/appsrc/appconfig/basic/zappversion.hpp @@ -1,3 +1,3 @@ #pragma once -#define VERSION "2.4.4" +#define VERSION "2.4.5" #define PROJECT_NAME "TRANSMIT_DM" \ No newline at end of file diff --git a/appsrc/baseservice/db/device_ext_setting_dao.cpp b/appsrc/baseservice/db/device_ext_setting_dao.cpp index 5650a73..16e74be 100644 --- a/appsrc/baseservice/db/device_ext_setting_dao.cpp +++ b/appsrc/baseservice/db/device_ext_setting_dao.cpp @@ -46,6 +46,8 @@ DeviceExtSetting DeviceExtSettingDAO::getDeviceExtSetting() { // setting.emptyThePipeLineTimeS = get("emptyThePipeLineTimeS", 20); setting.emptyingLiquidStorageTankCondtionG = get("emptyingLiquidStorageTankCondtionG", 20); setting.h2o2Sensorh2o2MinVal = get("h2o2Sensorh2o2MinVal", 20); + setting.leakTestInflationTimeMs = get("leakTestInflationTimeMs", 600); + setting.leakTestStabilizationTimeS = get("leakTestStabilizationTimeS", 8); return setting; } @@ -66,5 +68,7 @@ void DeviceExtSettingDAO::setDeviceType(string deviceType) { set("deviceType", d void DeviceExtSettingDAO::setEmptyThePipeLineTimeS(int32_t val) { set("emptyThePipeLineTimeS", val); } void DeviceExtSettingDAO::setEmptyingLiquidStorageTankCondtionG(int32_t val) { set("emptyingLiquidStorageTankCondtionG", val); } void DeviceExtSettingDAO::setH2o2Sensorh2o2MinVal(int32_t h2o2Sensorh2o2MinVal) { set("h2o2Sensorh2o2MinVal", to_string(h2o2Sensorh2o2MinVal)); } +void DeviceExtSettingDAO::setLeakTestInflationTimeMs(int32_t inflationTimeMs) { set("leakTestInflationTimeMs", inflationTimeMs); } +void DeviceExtSettingDAO::setLeakTestStabilizationTimeS(int32_t leakTestStabilizationTimeS) { set("leakTestStabilizationTimeS", leakTestStabilizationTimeS); } int32_t DeviceExtSettingDAO::getH2O2Sensorh2o2MinVal() { return get("h2o2Sensorh2o2MinVal", 10); } diff --git a/appsrc/baseservice/db/device_ext_setting_dao.hpp b/appsrc/baseservice/db/device_ext_setting_dao.hpp index 185704a..4b1a939 100644 --- a/appsrc/baseservice/db/device_ext_setting_dao.hpp +++ b/appsrc/baseservice/db/device_ext_setting_dao.hpp @@ -55,8 +55,11 @@ class DeviceExtSetting { int32_t h2o2Sensorh2o2MinVal = 10; // h2o2传感器最小值,单位ppm,小于此值认为是无效数据 + int32_t leakTestInflationTimeMs; // 默认 充气时间,单位毫秒 + int32_t leakTestStabilizationTimeS; // 默认 充气时间,单位秒 + NLOHMANN_DEFINE_TYPE_INTRUSIVE(DeviceExtSetting, deviceId, projectType, deviceType, canIF, canBitrate, printerUartPath, dvalueCoefficient, h2o2SensorExpireTimeMonth, emptyThePipeLineTimeS, - emptyingLiquidStorageTankCondtionG, h2o2Sensorh2o2MinVal); + emptyingLiquidStorageTankCondtionG, h2o2Sensorh2o2MinVal, leakTestInflationTimeMs, leakTestStabilizationTimeS); }; } // namespace db @@ -100,7 +103,8 @@ class DeviceExtSettingDAO : public KeyValDBV2Dao { void setEmptyThePipeLineTimeS(int32_t val); void setEmptyingLiquidStorageTankCondtionG(int32_t val); - + void setLeakTestInflationTimeMs(int32_t inflationTimeMs) ; + void setLeakTestStabilizationTimeS(int32_t leakTestStabilizationTimeS) ; int32_t getH2O2Sensorh2o2MinVal(); // void setTestMode(bool testMode); diff --git a/appsrc/baseservice/port/project_port.cpp b/appsrc/baseservice/port/project_port.cpp index c9a25f5..2496326 100644 --- a/appsrc/baseservice/port/project_port.cpp +++ b/appsrc/baseservice/port/project_port.cpp @@ -74,8 +74,6 @@ void ProjectPort::initProjectSetting(int projectTypeInt) { INSERT(HardwareComponent::DeviceBottomWS, FIXBOARDID_LC_BOARD, 0); // 主H2O2传感器 if (!isDT600B()) { - INSERT(HardwareComponent::MainH2O2Sensor, FIXBOARDID_PC_BOARD, 0); - // 液体重量传感器 INSERT(HardwareComponent::LiquidWeightPS, FIXBOARDID_LC_BOARD, 1); // 空压机后压力传感器 INSERT(HardwareComponent::ACPostPS, FIXBOARDID_LC_BOARD, 2); @@ -180,7 +178,6 @@ float ProjectPort::pressurePa2VolumeG(int pa) { THROW_APP_EXCEPTION(err::kappe_code_error, fmt::format("project [{}({})] not support: ", to_string(projectTypeInt).c_str(), projectTypeInt)); return 0; } -int32_t ProjectPort::getMainH2O2SensorId() { return getId(HardwareComponent::MainH2O2Sensor).boardId; } int32_t ProjectPort::getSprayLiquidPumpMaxRPM() { if (isDT600N()) { return 600; diff --git a/appsrc/baseservice/port/project_port.hpp b/appsrc/baseservice/port/project_port.hpp index 1bc4813..78735d3 100644 --- a/appsrc/baseservice/port/project_port.hpp +++ b/appsrc/baseservice/port/project_port.hpp @@ -99,7 +99,6 @@ class ProjectPort { /******************************************************************************* * 产品不同参数 * *******************************************************************************/ - int32_t getMainH2O2SensorId(); int32_t getSprayLiquidPumpMaxRPM(); int32_t getDisinfectantBucketCapacity(); int32_t getExtH2O2SensorNum(); diff --git a/appsrc/service/app/air_leak_detect_test.cpp b/appsrc/service/app/air_leak_detect_test.cpp index 0bafc4c..887e5c2 100644 --- a/appsrc/service/app/air_leak_detect_test.cpp +++ b/appsrc/service/app/air_leak_detect_test.cpp @@ -3,8 +3,6 @@ #include "pipeline_pressure_control.hpp" using namespace iflytop; -#define DEFAULT_INFLATION_TIME_MS 300 - void AirLeakDetectTest::initialize() { logger->info("AirLeakDetectTest initialize"); @@ -72,54 +70,85 @@ void AirLeakDetectTest::stop() { AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; } void AirLeakDetectTest::airLeakDetectTestThread(int inflationTimeMs) { - if (PORT.isDT300W()) { - m_workstate = kinitDevice; - // 初始化设备,关闭比例法 - m_dics->PosiPressureProp_setValve(0); - m_dics->NegaPressureProp_setValve(0); - m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); + if (inflationTimeMs <= 0) { + inflationTimeMs = DeviceExtSettingDAO::ins()->getDeviceExtSetting().leakTestInflationTimeMs; + } + + int32_t leakTestStabilizationTimeS = DeviceExtSettingDAO::ins()->getDeviceExtSetting().leakTestStabilizationTimeS; + ThisThread thisThread; + + logger->info("==================start airLeakDetectTest==============="); + logger->info("= inflationTimeMs: {} ms", inflationTimeMs); + logger->info("= leakTestStabilizationTimeS: {} s", leakTestStabilizationTimeS); + logger->info("= "); + + m_workstate = kinitDevice; + // 初始化设备,关闭比例法 + m_dics->PosiPressureProp_setValve(0); + m_dics->NegaPressureProp_setValve(0); + m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); + { // 等待比例法关闭 - while (!ThisThread().getExitFlag()) { + while (!thisThread.getExitFlag()) { if (m_dics->PosiPressureProp_isBusy() || m_dics->NegaPressureProp_isBusy()) { - ThisThread().sleepForMs(1000); + thisThread.sleepForMs(1000); logger->info("AirLeakDetectTest wait for valve to close , posi:{} nega:{}", m_dics->PosiPressureProp_isBusy(), m_dics->NegaPressureProp_isBusy()); } else { break; } } - if (ThisThread().getExitFlag()) return; + if (thisThread.getExitFlag()) goto end; + } + { // 开始充气 logger->info("inflate....."); m_workstate = kinflating; m_dics->AC_ctrlNoDelay(1); - if (inflationTimeMs == 0) inflationTimeMs = DEFAULT_INFLATION_TIME_MS; - ThisThread().sleepForMs(inflationTimeMs); // 充气时间 + thisThread.sleepForMs(inflationTimeMs); m_dics->AC_close(); m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::leakTest); + if (thisThread.getExitFlag()) goto end; + } - if (ThisThread().getExitFlag()) return; - // 等待充气完成 - ThisThread().sleepForMs(5000); - while (!ThisThread().getExitFlag()) { - pressurePa = m_dics->ACPostPS_readPa(); - m_workstate = kleakTesting; // TODO:将状态切换放到 pressurePa = m_dics->ACPostPS_readPa(); 之后 - ThisThread().sleepForMs(1000); + { + // 稳压中 + logger->info("stabilizing pressure....."); + m_workstate = kstabilizingPressure; + for (int i = 0; i < leakTestStabilizationTimeS; ++i) { + pressurePa = m_dics->ACPostPS_readPa(); + thisThread.sleepForMs(1000); + logger->info(" waiting for stabilizing pressure, current pressure: {} kPa", pressurePa / 1000.0); + if (thisThread.getExitFlag()) { + break; + } } + if (thisThread.getExitFlag()) goto end; + } - m_workstate = kstopping; - // 放气 - logger->info("stoping....."); - m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); - m_dics->PosiPressureProp_setValve(50); - m_dics->NegaPressureProp_setValve(50); - usleep(3000 * 1000); - logger->info("stoped"); - - GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); - m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); + { + // 检漏中 + logger->info("leak testing....."); + m_workstate = kleakTesting; + while (!thisThread.getExitFlag()) { + pressurePa = m_dics->ACPostPS_readPa(); + thisThread.sleepForMs(1000); + } } + +end: + m_workstate = kstopping; + // 放气 + logger->info("stoping....."); + m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); + m_dics->PosiPressureProp_setValve(50); + m_dics->NegaPressureProp_setValve(50); + usleep(3000 * 1000); + logger->info("stoped"); + + GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); + m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); } /******************************************************************************* * EXT * @@ -137,12 +166,10 @@ void AirLeakDetectTest::stop(shared_ptr cxt) { void AirLeakDetectTest::getServiceConfig(shared_ptr cxt) { if (PORT.isDT300W()) { json cfg; - cfg["pressureUint"] = "kPa"; - cfg["pressureMax"] = 8.0; - cfg["show"] = true; - cfg["updatePeriod"] = 300; - cfg["inflationTimeMs"] = DEFAULT_INFLATION_TIME_MS; - cxt->rely = cfg; + cfg["pressureUint"] = "kPa"; + cfg["pressureMax"] = 8.0; + cfg["updatePeriod"] = 300; + cxt->rely = cfg; } } diff --git a/appsrc/service/app/air_leak_detect_test.hpp b/appsrc/service/app/air_leak_detect_test.hpp index c9c313b..70b0c5e 100644 --- a/appsrc/service/app/air_leak_detect_test.hpp +++ b/appsrc/service/app/air_leak_detect_test.hpp @@ -17,11 +17,13 @@ class AirLeakDetectTest : public enable_shared_from_this { public: typedef enum { - kidle = 0, // 空闲 - kinitDevice = 1, // 初始化设备 - kinflating = 2, // 打压中 - kleakTesting = 3, // 检漏中 - kstopping = 4, // 停止中 + kidle = 0, // 空闲 + kinitDevice = 1, // 初始化设备 + kinflating = 2, // 打压中 + kleakTesting = 3, // 检漏中 + kstopping = 4, // 停止中 + kstabilizingPressure = 5, // 稳压中 + } state_t; static const char* state2str(state_t state) { @@ -36,6 +38,8 @@ class AirLeakDetectTest : public enable_shared_from_this { return "leakTesting"; case kstopping: return "stopping"; + case kstabilizingPressure: + return "stabilizingPressure"; default: return "unknown"; } @@ -53,6 +57,8 @@ class AirLeakDetectTest : public enable_shared_from_this { return "检漏中"; case kstopping: return "停止中"; + case kstabilizingPressure: + return "稳压中"; default: return "未知"; } diff --git a/appsrc/service/h2o2_data_record_service.cpp b/appsrc/service/h2o2_data_record_service.cpp new file mode 100644 index 0000000..471d22a --- /dev/null +++ b/appsrc/service/h2o2_data_record_service.cpp @@ -0,0 +1,100 @@ +#include "h2o2_data_record_service.hpp" + +#include "service/hardware/device_io_ctrl_service.hpp" + +using namespace iflytop; + +#define RECORD_PERIOD (10 * 1000) // 10 seconds +#define MAX_RECORD_NUM (8 * 60 * 60 * 1000 / RECORD_PERIOD) // + + + +void H2O2DataRecordService::initialize() { + if (PORT.getExtH2O2SensorNum() == 0) { + newH2O2DataRecordList(H2O2SensorType::Internal, 1); + } else if (PORT.getExtH2O2SensorNum() == 1) { + newH2O2DataRecordList(H2O2SensorType::Internal, 1); + newH2O2DataRecordList(H2O2SensorType::WiredExtSensor, 1); + } else if (PORT.getExtH2O2SensorNum() == 2) { + newH2O2DataRecordList(H2O2SensorType::Internal, 1); + newH2O2DataRecordList(H2O2SensorType::WiredExtSensor, 1); + newH2O2DataRecordList(H2O2SensorType::WiredExtSensor, 2); + } + + // + stateUpdateThread.reset(new Thread("FERDC-stateUpdateThread", [this]() { + while (!ThisThread().getExitFlag()) { + try { + } catch (const std::exception& e) { + logger->error("stateUpdateThread error:{}", e.what()); + } + ThisThread().sleepForMs(1000); + } + })); +} + +void H2O2DataRecordService::stateUpdateThreadFunc() {} +void H2O2DataRecordService::captureThreadFunc() { + ThisThread thisThread; + while (true) { + { + std::lock_guard lock(lock_); + + for (auto& recordList : h2o2DataRecords) { + auto data = h2o2SensorStateSyncService->getCacheDataCpy(recordList->sensorDataInfo.type, recordList->sensorDataInfo.id); + + recordList->sensorDataInfo.isOnline = data->isOnline; + shared_ptr sensorData = // + make_shared(data->h2o2, // + data->rh, // + data->temp, // + data->rs, // + zsys_get_ticket()); + + recordList->sensorDataList.push_back(sensorData); + if (recordList->sensorDataList.size() > MAX_RECORD_NUM) { + recordList->sensorDataList.pop_front(); // Remove the oldest record if it exceeds the max limit + } + } + } + thisThread.sleepForMs(RECORD_PERIOD); + } +} + +void H2O2DataRecordService::getH2O2DataRecordList(shared_ptr cxt, H2O2SensorType type, int id, int64_t since, int64_t Interval) {} + +shared_ptr H2O2DataRecordService::findRecordList(H2O2SensorType type, int id) { + std::lock_guard lock(lock_); + for (auto& recordList : h2o2DataRecords) { + if (recordList->sensorDataInfo.type == type && recordList->sensorDataInfo.id == id) { + return recordList; + } + } + return nullptr; // Not found +} +void H2O2DataRecordService::getH2O2SensorDataInfoList(shared_ptr cxt) { + std::lock_guard lock(lock_); + list> sensorDataInfoList; + + for (auto& recordList : h2o2DataRecords) { + auto sensorDataInfo = make_shared(); + sensorDataInfo->type = recordList->sensorDataInfo.type; + sensorDataInfo->id = recordList->sensorDataInfo.id; + sensorDataInfo->isOnline = recordList->sensorDataInfo.isOnline; + + sensorDataInfoList.push_back(sensorDataInfo); + } + + // cxt->rely = sensorDataInfoList; +} + +void H2O2DataRecordService::newH2O2DataRecordList(H2O2SensorType type, int id) { + std::lock_guard lock(lock_); + auto recordList = findRecordList(type, id); + if (!recordList) { + recordList = make_shared(); + recordList->sensorDataInfo.type = type; + recordList->sensorDataInfo.id = id; + h2o2DataRecords.push_back(recordList); + } +} \ No newline at end of file diff --git a/appsrc/service/h2o2_data_record_service.hpp b/appsrc/service/h2o2_data_record_service.hpp new file mode 100644 index 0000000..4c10499 --- /dev/null +++ b/appsrc/service/h2o2_data_record_service.hpp @@ -0,0 +1,75 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include "baseservice/baseservice.hpp" +#include "service/hardware/h2o2_sensor_state_sync.hpp" + +namespace iflytop { +class H2O2SensorData { + public: + float h2o2 = -1; // ppm + float rh = -1; // %RH + float temp = -1; // °C + float rs = -1; // %RS + int64_t timestamp = 0; // Timestamp in milliseconds since epoch + + NLOHMANN_DEFINE_TYPE_INTRUSIVE(H2O2SensorData, h2o2, rh, temp, rs, timestamp); + H2O2SensorData(float h2o2, float rh, float temp, float rs, int64_t timestamp) : h2o2(h2o2), rh(rh), temp(temp), rs(rs), timestamp(timestamp) {} +}; + +class H2O2SensorDataInfo { + public: + H2O2SensorType type; + int id; + bool isOnline; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(H2O2SensorDataInfo, type, id, isOnline); +}; + +class H2O2DataRecordList { + public: + H2O2SensorDataInfo sensorDataInfo; + list> sensorDataList; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(H2O2DataRecordList, sensorDataInfo, sensorDataList); +}; + +class H2O2DataRecordService : public enable_shared_from_this { + THISCLASS(H2O2DataRecordService); + + // Service + SERVICE(H2O2SensorStateSyncService, h2o2SensorStateSyncService); + + // Fields + unique_ptr stateUpdateThread; + unique_ptr captureThread; + + // Data + list> h2o2DataRecords; + + // Lock + std::recursive_mutex lock_; + + public: + void initialize(); + + private: + void getH2O2DataRecordList(shared_ptr cxt, H2O2SensorType type, int id, int64_t since, int64_t Interval); + void getH2O2SensorDataInfoList(shared_ptr cxt); + + private: + void stateUpdateThreadFunc(); + void captureThreadFunc(); + + shared_ptr findRecordList(H2O2SensorType type, int id); + + void newH2O2DataRecordList(H2O2SensorType type, int id); +}; + +} // namespace iflytop diff --git a/appsrc/service/hardware/h2o2_sensor_state_sync.hpp b/appsrc/service/hardware/h2o2_sensor_state_sync.hpp index 1ef6453..6518774 100644 --- a/appsrc/service/hardware/h2o2_sensor_state_sync.hpp +++ b/appsrc/service/hardware/h2o2_sensor_state_sync.hpp @@ -72,7 +72,6 @@ class H2O2SensorStateSyncService : public enable_shared_from_this> m_h2o2SensorDataList; unique_ptr m_h2o2SensorStateUpdateThread; @@ -86,13 +85,23 @@ class H2O2SensorStateSyncService : public enable_shared_from_this takeSnapshot(); - shared_ptr getCacheDataCpy(H2O2SensorType type, uint8_t sensorId); - - int getMinH2O2() { return m_minH2O2; } - int getMaxH2O2() { return m_maxH2O2; } - int getMaxHumid() { return m_maxHumid; } - int getMaxSaturation() { return m_maxSaturation; } + shared_ptr takeSnapshot(); + shared_ptr getCacheDataCpy(H2O2SensorType type, uint8_t sensorId); + list> getCacheDataList(H2O2SensorType type) { + lock_guard lock(m_lock); + list> dataList; + for (auto& sensor_data : m_h2o2SensorDataList) { + if (sensor_data->type.eq(type.getId())) { + dataList.push_back(sensor_data); + } + } + return dataList; + } + + int getMinH2O2() { return m_minH2O2; } + int getMaxH2O2() { return m_maxH2O2; } + int getMaxHumid() { return m_maxHumid; } + int getMaxSaturation() { return m_maxSaturation; } void updateH2o2SensorData(H2O2SensorType type, int sensorid, report_h2o2_data_t* sensordata); private: @@ -101,7 +110,6 @@ class H2O2SensorStateSyncService : public enable_shared_from_this findDataCache(H2O2SensorType type, uint8_t sensorId); - void statisticsSensorData(); - + void statisticsSensorData(); }; } // namespace iflytop \ No newline at end of file diff --git a/appsrc/service/hardware/sensor_state_sync_service.hpp b/appsrc/service/hardware/sensor_state_sync_service.hpp index b17a45c..61bf880 100644 --- a/appsrc/service/hardware/sensor_state_sync_service.hpp +++ b/appsrc/service/hardware/sensor_state_sync_service.hpp @@ -43,6 +43,8 @@ class SensorStateSyncService : public enable_shared_from_this cxt) { json helpinfo; @@ -68,23 +46,48 @@ void ExtSettingMgrService::showHelp(shared_ptr cxt) { void ExtSettingMgrService::getSetting(shared_ptr cxt) { // cxt->rely["extSettings"] = DeviceExtSettingDAO::ins()->getDeviceExtSettingAsJson(); } -void ExtSettingMgrService::setDeviceType(shared_ptr cxt, ProjectTypeEnum deviceType) { DeviceExtSettingDAO::ins()->setDeviceType(deviceType); } - -void ExtSettingMgrService::setDeviceId(shared_ptr cxt, string deviceId) { DeviceExtSettingDAO::ins()->setDeviceId(deviceId); } - -void ExtSettingMgrService::setprojectType(shared_ptr cxt, ProjectTypeEnum projectType) { DeviceExtSettingDAO::ins()->setprojectType(projectType); } - -void ExtSettingMgrService::setCanIF(shared_ptr cxt, string canIF) { DeviceExtSettingDAO::ins()->setCanIF(canIF); } - -void ExtSettingMgrService::setCanBitrate(shared_ptr cxt, int32_t canBitrate) { DeviceExtSettingDAO::ins()->setCanBitrate(canBitrate); } +void ExtSettingMgrService::setDeviceType(shared_ptr cxt, ProjectTypeEnum deviceType) { // + DeviceExtSettingDAO::ins()->setDeviceType(deviceType); +} +void ExtSettingMgrService::setDeviceId(shared_ptr cxt, string deviceId) { // + DeviceExtSettingDAO::ins()->setDeviceId(deviceId); +} +void ExtSettingMgrService::setprojectType(shared_ptr cxt, ProjectTypeEnum projectType) { // + DeviceExtSettingDAO::ins()->setprojectType(projectType); +} +void ExtSettingMgrService::setCanIF(shared_ptr cxt, string canIF) { // + DeviceExtSettingDAO::ins()->setCanIF(canIF); +} +void ExtSettingMgrService::setCanBitrate(shared_ptr cxt, int32_t canBitrate) { // + DeviceExtSettingDAO::ins()->setCanBitrate(canBitrate); +} +void ExtSettingMgrService::setPrinterUartPath(shared_ptr cxt, string printerUartPath) { // + DeviceExtSettingDAO::ins()->setPrinterUartPath(printerUartPath); +} +void ExtSettingMgrService::setDvalueCoefficient(shared_ptr cxt, float dvalueCoefficient) { // + DeviceExtSettingDAO::ins()->setDvalueCoefficient(dvalueCoefficient); +} +void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr cxt, int32_t h2o2SensorExpireTimeMonth) { // + DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth); +} +void ExtSettingMgrService::setEmptyThePipeLineTimeS(shared_ptr cxt, int32_t val) { // + DeviceExtSettingDAO::ins()->setEmptyThePipeLineTimeS(val); +} +void ExtSettingMgrService::setEmptyingLiquidStorageTankCondtionG(shared_ptr cxt, int32_t val) { // + DeviceExtSettingDAO::ins()->setEmptyingLiquidStorageTankCondtionG(val); +} +void ExtSettingMgrService::setH2o2Sensorh2o2MinVal(shared_ptr cxt, int32_t h2o2Sensorh2o2MinVal) { // + DeviceExtSettingDAO::ins()->setH2o2Sensorh2o2MinVal(h2o2Sensorh2o2MinVal); +} -void ExtSettingMgrService::setPrinterUartPath(shared_ptr cxt, string printerUartPath) { DeviceExtSettingDAO::ins()->setPrinterUartPath(printerUartPath); } +void ExtSettingMgrService::setLeakTestInflationTimeMs(shared_ptr cxt, int32_t leakTestInflationTimeMs) { // + DeviceExtSettingDAO::ins()->setLeakTestInflationTimeMs(leakTestInflationTimeMs); +} -void ExtSettingMgrService::setDvalueCoefficient(shared_ptr cxt, float dvalueCoefficient) { DeviceExtSettingDAO::ins()->setDvalueCoefficient(dvalueCoefficient); } +void ExtSettingMgrService::setLeakTestStabilizationTimeS(shared_ptr cxt, int32_t leakTestStabilizationTimeS) { // + DeviceExtSettingDAO::ins()->setLeakTestStabilizationTimeS(leakTestStabilizationTimeS); +} -void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr cxt, int32_t h2o2SensorExpireTimeMonth) { DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth); } -void ExtSettingMgrService::setEmptyThePipeLineTimeS(shared_ptr cxt, int32_t val) { DeviceExtSettingDAO::ins()->setEmptyThePipeLineTimeS(val); } -void ExtSettingMgrService::setEmptyingLiquidStorageTankCondtionG(shared_ptr cxt, int32_t val) { DeviceExtSettingDAO::ins()->setEmptyingLiquidStorageTankCondtionG(val); } void ExtSettingMgrService::setDeviceInfo(shared_ptr cxt, ProjectTypeEnum type, int year, int month, int day, int index) { DeviceExtSettingDAO::ins()->setprojectType(type); DeviceExtSettingDAO::ins()->setDeviceType(type); @@ -120,3 +123,26 @@ void ExtSettingMgrService::setDeviceInfo2(shared_ptr cxt, str void ExtSettingMgrService::rebootDevice(shared_ptr cxt) { system("reboot"); } void ExtSettingMgrService::restartProgram(shared_ptr cxt) { system("systemctl restart zapp &"); } + +void ExtSettingMgrService::initialize() { + GET_TO_SERVICE(m_disinfectantWeightUpdateService); + + REG_EXTFN_VOID(showHelp, json(void)); // 单位g + REG_EXTFN_VOID(getSetting, json(void)); // 单位g + REG_EXTFN(setDeviceInfo, json(ProjectTypeEnum, int, int, int, int, int), deviceType, year, month, day, index); + REG_EXTFN(setDeviceInfo2, json(string), id); + + REG_EXTFN(setCanIF, void(string), canIF); + REG_EXTFN(setCanBitrate, void(int32_t), canBitrate); + REG_EXTFN(setPrinterUartPath, void(string), printerUartPath); + REG_EXTFN(setDvalueCoefficient, void(float), dvalueCoefficient); + REG_EXTFN(setH2o2SensorExpireTimeMonth, void(int32_t), h2o2SensorExpireTimeMonth); + REG_EXTFN(setEmptyThePipeLineTimeS, void(int32_t), emptyThePipeLineTimeS); + REG_EXTFN(setEmptyingLiquidStorageTankCondtionG, void(int32_t), emptyingLiquidStorageTankCondtionG); + REG_EXTFN(setH2o2Sensorh2o2MinVal, void(int32_t), h2o2Sensorh2o2MinVal); + REG_EXTFN(setLeakTestInflationTimeMs, void(int32_t), leakTestInflationTimeMs); + REG_EXTFN(setLeakTestStabilizationTimeS, void(int32_t), leakTestStabilizationTimeS); + + REG_EXTFN_VOID(rebootDevice, void(void)); + REG_EXTFN_VOID(restartProgram, void(void)); // +} diff --git a/appsrc/service/setting/ext_setting_mgr_service.hpp b/appsrc/service/setting/ext_setting_mgr_service.hpp index 3cf9c0d..86fdd44 100644 --- a/appsrc/service/setting/ext_setting_mgr_service.hpp +++ b/appsrc/service/setting/ext_setting_mgr_service.hpp @@ -45,9 +45,10 @@ class ExtSettingMgrService : public enable_shared_from_this cxt, int32_t val); void setEmptyingLiquidStorageTankCondtionG(shared_ptr cxt, int32_t val); + void setH2o2Sensorh2o2MinVal(shared_ptr cxt, int32_t h2o2Sensorh2o2MinVal); - - + void setLeakTestInflationTimeMs(shared_ptr cxt, int32_t inflationTimeMs); + void setLeakTestStabilizationTimeS(shared_ptr cxt, int32_t leakTestStabilizationTimeS); }; } // namespace iflytop diff --git a/html/debug/index.html b/html/debug/index.html index af67ad5..4062992 100644 --- a/html/debug/index.html +++ b/html/debug/index.html @@ -188,11 +188,11 @@ }, showKeyboard(values, param) { - const inputElement = document.querySelector(`input[placeholder="${param}"]`); - if (inputElement) { - VirtualKeyboard.show(inputElement); - this.updateDisplayContainer(inputElement); - } + // const inputElement = document.querySelector(`input[placeholder="${param}"]`); + // if (inputElement) { + // VirtualKeyboard.show(inputElement); + // this.updateDisplayContainer(inputElement); + // } }, updateDisplayContainer(inputElement) {