Browse Source

2.0.9

master
zhaohe 8 months ago
parent
commit
c98a98423d
  1. 6
      README.md
  2. 2
      appsrc/appconfig/basic/zappversion.hpp
  3. 2
      appsrc/baseservice/db/device_ext_setting_dao.cpp
  4. 2
      appsrc/service/app_core.cpp
  5. 2
      appsrc/service/disinfection_logs_service.cpp
  6. 8
      appsrc/service/setting/ext_setting_mgr_service.cpp
  7. 1
      appsrc/service/setting/ext_setting_mgr_service.hpp
  8. 0
      appsrc/service/test_page_api_service.cpp
  9. 46
      appsrc/service/test_page_api_service.hpp
  10. 26
      appsrc/service/test_page_mgr_service.cpp
  11. 60
      appsrc/service/test_page_service_v2.cpp
  12. 54
      appsrc/service/test_page_service_v2.hpp

6
README.md

@ -120,12 +120,16 @@ VERSION 2.0.3
VERSION 2.0.4
1. 修复部分BUG
VERSION 2.0.9
1. 修改默认打印机串口地址
2. 增加testPageServiceV2
3. 修复测试页面下加液排液没有关闭气阀导致的漏液
TODO:
1. 设备使用时间维护(UI接口已经准备好,考虑是否使用文件袋放在设备中的方案)
2. 升级方案
3. 系统垃圾自动方案
4. 部署方案

2
appsrc/appconfig/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once
#define VERSION "2.0.8"
#define VERSION "2.0.9"
#define PROJECT_NAME "TRANSMIT_DM"

2
appsrc/baseservice/db/device_ext_setting_dao.cpp

@ -38,7 +38,7 @@ DeviceExtSetting DeviceExtSettingDAO::getDeviceExtSetting() { //
setting.canBitrate = get("canBitrate", 500000);
setting.canIF = get("canIF", "can0");
setting.deviceId = get("deviceId", "");
setting.printerUartPath = get("printerUartPath", "/dev/ttyS1");
setting.printerUartPath = get("printerUartPath", "/dev/ttyS5");
setting.dvalueCoefficient = get("printerBaudrate", 2);
setting.projectTypes = get("projectTypes", "");
setting.h2o2SensorExpireTimeMonth = get("h2o2SensorExpireTimeMonth", 12);

2
appsrc/service/app_core.cpp

@ -27,6 +27,7 @@
#include "calibration/h2o2_liquid_weight_sensor_calibration_service.hpp"
#include "equipment_usage_info_mgr_service.hpp"
#include "setting/ext_setting_mgr_service.hpp"
#include "test_page_service_v2.hpp"
// DeviceExtSettingDAO
@ -156,6 +157,7 @@ void AppCore::initialize() {
BUILD_AND_REG_SERRVICE(DeviceInfoMgrService);
BUILD_AND_REG_SERRVICE(OsMgrService);
BUILD_AND_REG_SERRVICE(TestPageMgrService);
BUILD_AND_REG_SERRVICE(TestPageServiceV2);
BUILD_AND_REG_SERRVICE(AddLiquidService);
BUILD_AND_REG_SERRVICE(AirLeakDetectTest);

2
appsrc/service/disinfection_logs_service.cpp

@ -26,7 +26,7 @@ typedef DisinfectionRecordCSVHeader CSVHeader;
*******************************************************************************/
#define LOG_STORGE_PATH "./disinfection_logs/"
#define EXPORT_PATH "/mnt/exportdata/Transmit/"
#define EXPORT_PATH "/mnt/exportdata/TrySmet/"
#define MAX_LOG_NUM 300
#define IF_ERROR_RETURN(x) \
if (!x) { \

8
appsrc/service/setting/ext_setting_mgr_service.cpp

@ -19,9 +19,8 @@ void ExtSettingMgrService::initialize() {
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(setTestMode, void(bool));
}
void ExtSettingMgrService::showHelp(shared_ptr<MsgProcessContext> cxt) {
@ -82,8 +81,6 @@ void ExtSettingMgrService::setDvalueCoefficient(shared_ptr<MsgProcessContext> cx
void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr<MsgProcessContext> cxt, int32_t h2o2SensorExpireTimeMonth) { DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth); }
void ExtSettingMgrService::rebootDevice(shared_ptr<MsgProcessContext> cxt) { system("reboot"); }
void ExtSettingMgrService::setDeviceInfo(shared_ptr<MsgProcessContext> cxt, DeviceType type, int year, int month, int day, int index) {
string deviceIdPrefix;
if (type == DeviceType::DT_600N) {
@ -104,3 +101,6 @@ void ExtSettingMgrService::setDeviceInfo(shared_ptr<MsgProcessContext> cxt, Devi
DeviceExtSettingDAO::ins()->setDeviceId(fmt::format("{}{:0>2d}{:0>2d}{:0>2d}{:0>3d}", deviceIdPrefix, year, month, day, index));
cxt->rely["extSettings"] = DeviceExtSettingDAO::ins()->getDeviceExtSettingAsJson();
}
void ExtSettingMgrService::rebootDevice(shared_ptr<MsgProcessContext> cxt) { system("reboot"); }
void ExtSettingMgrService::restartProgram(shared_ptr<MsgProcessContext> cxt) { system("systemctl restart zapp &"); }

1
appsrc/service/setting/ext_setting_mgr_service.hpp

@ -39,6 +39,7 @@ class ExtSettingMgrService : public enable_shared_from_this<ExtSettingMgrService
// void setTestMode(shared_ptr<MsgProcessContext> cxt, bool testMode);
void rebootDevice(shared_ptr<MsgProcessContext> cxt);
void restartProgram(shared_ptr<MsgProcessContext> cxt);
};
} // namespace iflytop

0
appsrc/service/test_page_api_service.cpp

46
appsrc/service/test_page_api_service.hpp

@ -1,46 +0,0 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "appbase/appbean/test_page_iterm.hpp"
#include "baseservice/baseservice.hpp"
#include "service/hardware/device_io_ctrl_service.hpp"
#include "testpage/test_page_processer.hpp"
namespace iflytop {
using namespace testpage;
class TestPageMgrService : public enable_shared_from_this<TestPageMgrService> {
THISCLASS(TestPageMgrService);
shared_ptr<DeviceStateService> m_ds;
shared_ptr<DeviceIoControlService> dcs;
unique_ptr<Thread> m_thread;
// shared_ptr<ZDictionary> m_dict;
TestPageItemMgr m_testPageItemMgr;
public:
void initialize();
private:
void getTestPageCfgInfo(shared_ptr<MsgProcessContext> cxt);
void onButton(shared_ptr<MsgProcessContext> cxt, string groupName, string buttonName, json params);
void readState(shared_ptr<MsgProcessContext> cxt);
void startReportState(shared_ptr<MsgProcessContext> cxt);
void stopReportState(shared_ptr<MsgProcessContext> cxt);
private:
int PrinterTest_test();
};
} // namespace iflytop

26
appsrc/service/test_page_mgr_service.cpp

@ -5,15 +5,14 @@ using namespace iflytop;
using namespace testpage;
/**
* @brief
*
*
* @brief
*
*
* WARNING:
* Date: 2024-12-05
*
*
*/
void TestPageMgrService::getTestPageCfgInfo(shared_ptr<MsgProcessContext> cxt) { cxt->rely["items"] = m_testPageItemMgr.getPageCfgInfo(); }
void TestPageMgrService::onButton(shared_ptr<MsgProcessContext> cxt, string groupName, string buttonName, json params) { m_testPageItemMgr.processOnButton(groupName, buttonName, params); }
void TestPageMgrService::readState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = m_testPageItemMgr.readState(); }
@ -47,28 +46,27 @@ void TestPageMgrService::initialize() {
REG_FN_VOID(PrinterTest_test, void());
auto SprayPumpCtrl = m_testPageItemMgr.createButtons({"SprayPumpCtrl", "喷液泵控制"}, // 模组名
{
auto SprayPumpCtrl = m_testPageItemMgr.createButtons({"SprayPumpCtrl", "喷液泵控制"}, // 模组名
{
// 参数
{{"pumpVel", "速度"}, "g/min", {{"5"}, {"10"}, {"15"}}}, //
},
{
{
// 按键
{"forward", "正转"},
{"backward", "反转"},
{"stop", "停止"},
},
[this](string buttonName, vector<string> param) { //
[this](string buttonName, vector<string> param) { //
logger->info("SprayPumpCtrl on button.{} ({})", buttonName, param[0]);
if (buttonName == "forward") {
dcs->SprayPump_startInRPM(atoi(param[0].c_str()));
dcs->SprayPump_start(atoi(param[0].c_str()));
} else if (buttonName == "backward") {
dcs->SprayPump_startInRPM(-atoi(param[0].c_str()));
dcs->SprayPump_start(-atoi(param[0].c_str()));
} else if (buttonName == "stop") {
dcs->SprayPump_stop();
}
});
auto AddDischargePumpCtrl = m_testPageItemMgr.createButtons({"AddDischargePumpCtrl", "加液泵控制"}, // 模组名
{
// 参数
@ -82,15 +80,19 @@ void TestPageMgrService::initialize() {
[this](string buttonName, vector<string> param) { //
logger->info("on AddDischargePumpCtrl.{}", buttonName);
if (buttonName == "addingLiquid") {
dcs->setAddFluidChannelSelectorValve(true);
dcs->AddLiquidPump_stop();
usleep(500 * 1000);
dcs->AddLiquidPump_addLiquid();
} else if (buttonName == "drainLiquid") {
dcs->setAddFluidChannelSelectorValve(true);
dcs->AddLiquidPump_stop();
usleep(500 * 1000);
dcs->AddLiquidPump_drainLiquid();
} else {
dcs->AddLiquidPump_stop();
usleep(1500 * 1000);
dcs->setAddFluidChannelSelectorValve(false);
}
});

60
appsrc/service/test_page_service_v2.cpp

@ -0,0 +1,60 @@
#include "test_page_service_v2.hpp"
#include "appdep/components/ziconv.hpp"
using namespace iflytop;
using namespace testpage;
void TestPageServiceV2::initialize() {
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(dcs);
// REG_EXTFN_VOID(getSetting, json(void)); // 单位g
// REG_EXTFN(setDeviceId, void(string));
REG_EXTFN(doSprayPumpFroward, void(int), gpm);
REG_EXTFN(doSprayPumpBackward, void(int), gpm);
REG_EXTFN_VOID(doSprayPumpStop, void(void));
REG_EXTFN_VOID(doAddLiquid, void(void));
REG_EXTFN_VOID(doDrainLiquid, void(void));
REG_EXTFN_VOID(doStopAddLiquid, void(void));
REG_EXTFN_VOID(doPrinterTest, void(void));
}
void TestPageServiceV2::doSprayPumpFroward(shared_ptr<MsgProcessContext> cxt, int gpm) { dcs->SprayPump_start(gpm); }
void TestPageServiceV2::doSprayPumpBackward(shared_ptr<MsgProcessContext> cxt, int gpm) { dcs->SprayPump_start(-gpm); }
void TestPageServiceV2::doSprayPumpStop(shared_ptr<MsgProcessContext> cxt) { dcs->SprayPump_stop(); }
void TestPageServiceV2::doAddLiquid(shared_ptr<MsgProcessContext> cxt) {
dcs->setAddFluidChannelSelectorValve(true);
dcs->AddLiquidPump_stop();
usleep(500 * 1000);
dcs->AddLiquidPump_addLiquid();
}
void TestPageServiceV2::doDrainLiquid(shared_ptr<MsgProcessContext> cxt) {
dcs->setAddFluidChannelSelectorValve(true);
dcs->AddLiquidPump_stop();
usleep(500 * 1000);
dcs->AddLiquidPump_drainLiquid();
}
void TestPageServiceV2::doStopAddLiquid(shared_ptr<MsgProcessContext> cxt) {
dcs->AddLiquidPump_stop();
usleep(1500 * 1000);
dcs->setAddFluidChannelSelectorValve(false);
}
int TestPageServiceV2::doPrinterTest(shared_ptr<MsgProcessContext> cxt) {
GET_SERVICE(UartPrinter)->print("abcdefghijklmn\n");
usleep(100 * 1000);
GET_SERVICE(UartPrinter)->print("opqrstuvwxyz\n");
usleep(100 * 1000);
GET_SERVICE(UartPrinter)->print("1234567890\n");
usleep(100 * 1000);
GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312("打印机中文测试\n"));
usleep(100 * 1000);
GET_SERVICE(UartPrinter)->print("\n");
GET_SERVICE(UartPrinter)->print("\n");
GET_SERVICE(UartPrinter)->print("\n");
GET_SERVICE(UartPrinter)->print("\n");
return 0;
}

54
appsrc/service/test_page_service_v2.hpp

@ -0,0 +1,54 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "appbase/appbean/test_page_iterm.hpp"
#include "baseservice/baseservice.hpp"
#include "service/hardware/device_io_ctrl_service.hpp"
#include "testpage/test_page_processer.hpp"
namespace iflytop {
using namespace testpage;
/**
* @brief
*
*
* WARNING:
* Date: 2024-12-05
*
*/
class TestPageServiceV2 : public enable_shared_from_this<TestPageServiceV2> {
THISCLASS(TestPageServiceV2);
shared_ptr<DeviceStateService> m_ds;
shared_ptr<DeviceIoControlService> dcs;
unique_ptr<Thread> m_thread;
TestPageItemMgr m_testPageItemMgr;
public:
void initialize();
private:
int doPrinterTest(shared_ptr<MsgProcessContext> cxt);
void doSprayPumpFroward(shared_ptr<MsgProcessContext> cxt, int gpm);
void doSprayPumpBackward(shared_ptr<MsgProcessContext> cxt, int gpm);
void doSprayPumpStop(shared_ptr<MsgProcessContext> cxt);
void doAddLiquid(shared_ptr<MsgProcessContext> cxt);
void doDrainLiquid(shared_ptr<MsgProcessContext> cxt);
void doStopAddLiquid(shared_ptr<MsgProcessContext> cxt);
};
} // namespace iflytop
Loading…
Cancel
Save