Browse Source

v2.4.5 | 改进气体泄露检测逻辑

master
zhaohe 1 month ago
parent
commit
04740fcba3
  1. 1
      appsrc/appbase/appbean/hardware_component.hpp
  2. 2
      appsrc/appconfig/basic/zappversion.hpp
  3. 4
      appsrc/baseservice/db/device_ext_setting_dao.cpp
  4. 8
      appsrc/baseservice/db/device_ext_setting_dao.hpp
  5. 3
      appsrc/baseservice/port/project_port.cpp
  6. 1
      appsrc/baseservice/port/project_port.hpp
  7. 101
      appsrc/service/app/air_leak_detect_test.cpp
  8. 16
      appsrc/service/app/air_leak_detect_test.hpp
  9. 100
      appsrc/service/h2o2_data_record_service.cpp
  10. 75
      appsrc/service/h2o2_data_record_service.hpp
  11. 28
      appsrc/service/hardware/h2o2_sensor_state_sync.hpp
  12. 2
      appsrc/service/hardware/sensor_state_sync_service.hpp
  13. 98
      appsrc/service/setting/ext_setting_mgr_service.cpp
  14. 5
      appsrc/service/setting/ext_setting_mgr_service.hpp
  15. 10
      html/debug/index.html

1
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) /**/ \

2
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"

4
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); }

8
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);

3
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;

1
appsrc/baseservice/port/project_port.hpp

@ -99,7 +99,6 @@ class ProjectPort {
/*******************************************************************************
* *
*******************************************************************************/
int32_t getMainH2O2SensorId();
int32_t getSprayLiquidPumpMaxRPM();
int32_t getDisinfectantBucketCapacity();
int32_t getExtH2O2SensorNum();

101
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<MsgProcessContext> cxt) {
void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> 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;
}
}

16
appsrc/service/app/air_leak_detect_test.hpp

@ -17,11 +17,13 @@ class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> {
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<AirLeakDetectTest> {
return "leakTesting";
case kstopping:
return "stopping";
case kstabilizingPressure:
return "stabilizingPressure";
default:
return "unknown";
}
@ -53,6 +57,8 @@ class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> {
return "检漏中";
case kstopping:
return "停止中";
case kstabilizingPressure:
return "稳压中";
default:
return "未知";
}

100
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<std::recursive_mutex> lock(lock_);
for (auto& recordList : h2o2DataRecords) {
auto data = h2o2SensorStateSyncService->getCacheDataCpy(recordList->sensorDataInfo.type, recordList->sensorDataInfo.id);
recordList->sensorDataInfo.isOnline = data->isOnline;
shared_ptr<H2O2SensorData> sensorData = //
make_shared<H2O2SensorData>(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<MsgProcessContext> cxt, H2O2SensorType type, int id, int64_t since, int64_t Interval) {}
shared_ptr<H2O2DataRecordList> H2O2DataRecordService::findRecordList(H2O2SensorType type, int id) {
std::lock_guard<std::recursive_mutex> 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<MsgProcessContext> cxt) {
std::lock_guard<std::recursive_mutex> lock(lock_);
list<shared_ptr<H2O2SensorDataInfo>> sensorDataInfoList;
for (auto& recordList : h2o2DataRecords) {
auto sensorDataInfo = make_shared<H2O2SensorDataInfo>();
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<std::recursive_mutex> lock(lock_);
auto recordList = findRecordList(type, id);
if (!recordList) {
recordList = make_shared<H2O2DataRecordList>();
recordList->sensorDataInfo.type = type;
recordList->sensorDataInfo.id = id;
h2o2DataRecords.push_back(recordList);
}
}

75
appsrc/service/h2o2_data_record_service.hpp

@ -0,0 +1,75 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#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<shared_ptr<H2O2SensorData>> sensorDataList;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(H2O2DataRecordList, sensorDataInfo, sensorDataList);
};
class H2O2DataRecordService : public enable_shared_from_this<H2O2DataRecordService> {
THISCLASS(H2O2DataRecordService);
// Service
SERVICE(H2O2SensorStateSyncService, h2o2SensorStateSyncService);
// Fields
unique_ptr<Thread> stateUpdateThread;
unique_ptr<Thread> captureThread;
// Data
list<shared_ptr<H2O2DataRecordList>> h2o2DataRecords;
// Lock
std::recursive_mutex lock_;
public:
void initialize();
private:
void getH2O2DataRecordList(shared_ptr<MsgProcessContext> cxt, H2O2SensorType type, int id, int64_t since, int64_t Interval);
void getH2O2SensorDataInfoList(shared_ptr<MsgProcessContext> cxt);
private:
void stateUpdateThreadFunc();
void captureThreadFunc();
shared_ptr<H2O2DataRecordList> findRecordList(H2O2SensorType type, int id);
void newH2O2DataRecordList(H2O2SensorType type, int id);
};
} // namespace iflytop

28
appsrc/service/hardware/h2o2_sensor_state_sync.hpp

@ -72,7 +72,6 @@ class H2O2SensorStateSyncService : public enable_shared_from_this<H2O2SensorStat
THISCLASS(H2O2SensorStateSyncService);
SERVICE(DeviceIoControlService, deviceIoControlService);
list<shared_ptr<H2O2SensorDataCache>> m_h2o2SensorDataList;
unique_ptr<Thread> m_h2o2SensorStateUpdateThread;
@ -86,13 +85,23 @@ class H2O2SensorStateSyncService : public enable_shared_from_this<H2O2SensorStat
public:
void initialize();
shared_ptr<H2O2SensorDataSnapshot> takeSnapshot();
shared_ptr<H2O2SensorDataCache> 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<H2O2SensorDataSnapshot> takeSnapshot();
shared_ptr<H2O2SensorDataCache> getCacheDataCpy(H2O2SensorType type, uint8_t sensorId);
list<shared_ptr<H2O2SensorDataCache>> getCacheDataList(H2O2SensorType type) {
lock_guard<recursive_mutex> lock(m_lock);
list<shared_ptr<H2O2SensorDataCache>> 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<H2O2SensorStat
private:
H2O2ReportData toH2O2ReportData(report_h2o2_data_t* h2o2data);
shared_ptr<H2O2SensorDataCache> findDataCache(H2O2SensorType type, uint8_t sensorId);
void statisticsSensorData();
void statisticsSensorData();
};
} // namespace iflytop

2
appsrc/service/hardware/sensor_state_sync_service.hpp

@ -43,6 +43,8 @@ class SensorStateSyncService : public enable_shared_from_this<SensorStateSyncSer
float m_heaterCurrent = 0;
float m_heaterTemperature = 0;
// float
recursive_mutex m_mutex;
bool triggerError = false;

98
appsrc/service/setting/ext_setting_mgr_service.cpp

@ -4,28 +4,6 @@ using namespace iflytop;
using namespace std;
using namespace core;
void ExtSettingMgrService::initialize() {
GET_TO_SERVICE(m_disinfectantWeightUpdateService);
REG_EXTFN_VOID(showHelp, json(void)); // 单位g
REG_EXTFN_VOID(getSetting, json(void)); // 单位g
// REG_EXTFN(setDeviceId, void(string));
// REG_EXTFN(setprojectType, void(ProjectTypeEnum));
// REG_EXTFN(setDeviceType, void(ProjectTypeEnum));
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));
REG_EXTFN(setCanBitrate, void(int32_t));
REG_EXTFN(setPrinterUartPath, void(string));
REG_EXTFN(setDvalueCoefficient, void(float));
REG_EXTFN_VOID(rebootDevice, void(void)); //
REG_EXTFN_VOID(restartProgram, void(void)); //
REG_EXTFN(setH2o2SensorExpireTimeMonth, void(int32_t));
REG_EXTFN(setEmptyThePipeLineTimeS, void(int32_t));
REG_EXTFN(setEmptyingLiquidStorageTankCondtionG, void(int32_t));
}
void ExtSettingMgrService::showHelp(shared_ptr<MsgProcessContext> cxt) {
json helpinfo;
@ -68,23 +46,48 @@ void ExtSettingMgrService::showHelp(shared_ptr<MsgProcessContext> cxt) {
void ExtSettingMgrService::getSetting(shared_ptr<MsgProcessContext> cxt) { //
cxt->rely["extSettings"] = DeviceExtSettingDAO::ins()->getDeviceExtSettingAsJson();
}
void ExtSettingMgrService::setDeviceType(shared_ptr<MsgProcessContext> cxt, ProjectTypeEnum deviceType) { DeviceExtSettingDAO::ins()->setDeviceType(deviceType); }
void ExtSettingMgrService::setDeviceId(shared_ptr<MsgProcessContext> cxt, string deviceId) { DeviceExtSettingDAO::ins()->setDeviceId(deviceId); }
void ExtSettingMgrService::setprojectType(shared_ptr<MsgProcessContext> cxt, ProjectTypeEnum projectType) { DeviceExtSettingDAO::ins()->setprojectType(projectType); }
void ExtSettingMgrService::setCanIF(shared_ptr<MsgProcessContext> cxt, string canIF) { DeviceExtSettingDAO::ins()->setCanIF(canIF); }
void ExtSettingMgrService::setCanBitrate(shared_ptr<MsgProcessContext> cxt, int32_t canBitrate) { DeviceExtSettingDAO::ins()->setCanBitrate(canBitrate); }
void ExtSettingMgrService::setDeviceType(shared_ptr<MsgProcessContext> cxt, ProjectTypeEnum deviceType) { //
DeviceExtSettingDAO::ins()->setDeviceType(deviceType);
}
void ExtSettingMgrService::setDeviceId(shared_ptr<MsgProcessContext> cxt, string deviceId) { //
DeviceExtSettingDAO::ins()->setDeviceId(deviceId);
}
void ExtSettingMgrService::setprojectType(shared_ptr<MsgProcessContext> cxt, ProjectTypeEnum projectType) { //
DeviceExtSettingDAO::ins()->setprojectType(projectType);
}
void ExtSettingMgrService::setCanIF(shared_ptr<MsgProcessContext> cxt, string canIF) { //
DeviceExtSettingDAO::ins()->setCanIF(canIF);
}
void ExtSettingMgrService::setCanBitrate(shared_ptr<MsgProcessContext> cxt, int32_t canBitrate) { //
DeviceExtSettingDAO::ins()->setCanBitrate(canBitrate);
}
void ExtSettingMgrService::setPrinterUartPath(shared_ptr<MsgProcessContext> cxt, string printerUartPath) { //
DeviceExtSettingDAO::ins()->setPrinterUartPath(printerUartPath);
}
void ExtSettingMgrService::setDvalueCoefficient(shared_ptr<MsgProcessContext> cxt, float dvalueCoefficient) { //
DeviceExtSettingDAO::ins()->setDvalueCoefficient(dvalueCoefficient);
}
void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr<MsgProcessContext> cxt, int32_t h2o2SensorExpireTimeMonth) { //
DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth);
}
void ExtSettingMgrService::setEmptyThePipeLineTimeS(shared_ptr<MsgProcessContext> cxt, int32_t val) { //
DeviceExtSettingDAO::ins()->setEmptyThePipeLineTimeS(val);
}
void ExtSettingMgrService::setEmptyingLiquidStorageTankCondtionG(shared_ptr<MsgProcessContext> cxt, int32_t val) { //
DeviceExtSettingDAO::ins()->setEmptyingLiquidStorageTankCondtionG(val);
}
void ExtSettingMgrService::setH2o2Sensorh2o2MinVal(shared_ptr<MsgProcessContext> cxt, int32_t h2o2Sensorh2o2MinVal) { //
DeviceExtSettingDAO::ins()->setH2o2Sensorh2o2MinVal(h2o2Sensorh2o2MinVal);
}
void ExtSettingMgrService::setPrinterUartPath(shared_ptr<MsgProcessContext> cxt, string printerUartPath) { DeviceExtSettingDAO::ins()->setPrinterUartPath(printerUartPath); }
void ExtSettingMgrService::setLeakTestInflationTimeMs(shared_ptr<MsgProcessContext> cxt, int32_t leakTestInflationTimeMs) { //
DeviceExtSettingDAO::ins()->setLeakTestInflationTimeMs(leakTestInflationTimeMs);
}
void ExtSettingMgrService::setDvalueCoefficient(shared_ptr<MsgProcessContext> cxt, float dvalueCoefficient) { DeviceExtSettingDAO::ins()->setDvalueCoefficient(dvalueCoefficient); }
void ExtSettingMgrService::setLeakTestStabilizationTimeS(shared_ptr<MsgProcessContext> cxt, int32_t leakTestStabilizationTimeS) { //
DeviceExtSettingDAO::ins()->setLeakTestStabilizationTimeS(leakTestStabilizationTimeS);
}
void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr<MsgProcessContext> cxt, int32_t h2o2SensorExpireTimeMonth) { DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth); }
void ExtSettingMgrService::setEmptyThePipeLineTimeS(shared_ptr<MsgProcessContext> cxt, int32_t val) { DeviceExtSettingDAO::ins()->setEmptyThePipeLineTimeS(val); }
void ExtSettingMgrService::setEmptyingLiquidStorageTankCondtionG(shared_ptr<MsgProcessContext> cxt, int32_t val) { DeviceExtSettingDAO::ins()->setEmptyingLiquidStorageTankCondtionG(val); }
void ExtSettingMgrService::setDeviceInfo(shared_ptr<MsgProcessContext> 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<MsgProcessContext> cxt, str
void ExtSettingMgrService::rebootDevice(shared_ptr<MsgProcessContext> cxt) { system("reboot"); }
void ExtSettingMgrService::restartProgram(shared_ptr<MsgProcessContext> 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)); //
}

5
appsrc/service/setting/ext_setting_mgr_service.hpp

@ -45,9 +45,10 @@ class ExtSettingMgrService : public enable_shared_from_this<ExtSettingMgrService
void setEmptyThePipeLineTimeS(shared_ptr<MsgProcessContext> cxt, int32_t val);
void setEmptyingLiquidStorageTankCondtionG(shared_ptr<MsgProcessContext> cxt, int32_t val);
void setH2o2Sensorh2o2MinVal(shared_ptr<MsgProcessContext> cxt, int32_t h2o2Sensorh2o2MinVal);
void setLeakTestInflationTimeMs(shared_ptr<MsgProcessContext> cxt, int32_t inflationTimeMs);
void setLeakTestStabilizationTimeS(shared_ptr<MsgProcessContext> cxt, int32_t leakTestStabilizationTimeS);
};
} // namespace iflytop

10
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) {

Loading…
Cancel
Save