19 changed files with 386 additions and 477 deletions
-
35appdep/components/zservice_container/zservice_container.hpp
-
2appsrc/appconfig/basic/zappversion.hpp
-
22appsrc/baseservice/port/project_port.cpp
-
2appsrc/baseservice/port/project_port.hpp
-
1appsrc/main.cpp
-
4appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
-
27appsrc/service/app_core.cpp
-
1appsrc/service/app_core.hpp
-
6appsrc/service/hardware/device_io_ctrl_service.cpp
-
4appsrc/service/hardware/disinfectant_weight_update_service.cpp
-
57appsrc/service/hardware/sensor_state_sync_service.cpp
-
79appsrc/service/hardware/sensor_state_sync_service.hpp
-
4appsrc/service/hardware/warning_light_controler.cpp
-
114appsrc/service/test_page_ctrl_service.cpp
-
67appsrc/service/test_page_ctrl_service.hpp
-
267appsrc/service/test_page_mgr_service.cpp
-
57appsrc/service/test_page_mgr_service.hpp
-
60appsrc/service/test_page_service_v2.cpp
-
54appsrc/service/test_page_service_v2.hpp
@ -1,3 +1,3 @@ |
|||
#pragma once
|
|||
#define VERSION "2.3.4"
|
|||
#define VERSION "2.3.5"
|
|||
#define PROJECT_NAME "TRANSMIT_DM"
|
@ -0,0 +1,57 @@ |
|||
#include "sensor_state_sync_service.hpp"
|
|||
using namespace iflytop; |
|||
using namespace std; |
|||
using namespace core; |
|||
|
|||
void SensorStateSyncService::initialize() { GET_TO_SERVICE(deviceIoControlService); } |
|||
|
|||
void SensorStateSyncService::startSync() { |
|||
if (updateThread && !updateThread->isWaitingForJoin()) { |
|||
logger->error("SensorStateSyncService update thread is already running"); |
|||
exit(-1); |
|||
} |
|||
updateThread.reset(new Thread("SensorStateSyncServiceUpdateThread", [this]() { //
|
|||
updateThreadLoop(); |
|||
})); |
|||
} |
|||
|
|||
void SensorStateSyncService::updateThreadLoop() { |
|||
ThisThread thisThread; |
|||
while (true) { |
|||
try { |
|||
float airCompressorCurrent = 0; |
|||
float blowerCurrent = 0; |
|||
float heaterCurrent = 0; |
|||
float heaterTemperature = 0; |
|||
|
|||
if (PORT.isDT600N() || PORT.isDT300N() || PORT.isDT300W() || PORT.isDT600B()) { |
|||
airCompressorCurrent = deviceIoControlService->AC_readEI(); |
|||
thisThread.sleepForMs(10); |
|||
blowerCurrent = deviceIoControlService->Blower_readEI(); |
|||
thisThread.sleepForMs(10); |
|||
heaterCurrent = deviceIoControlService->Heater_readEI(); |
|||
thisThread.sleepForMs(10); |
|||
heaterTemperature = deviceIoControlService->Heater_readTemperature(); |
|||
thisThread.sleepForMs(10); |
|||
} |
|||
|
|||
{ |
|||
lock_guard<recursive_mutex> lock(m_mutex); |
|||
m_airCompressorCurrent = airCompressorCurrent; |
|||
m_blowerCurrent = blowerCurrent; |
|||
m_heaterCurrent = heaterCurrent; |
|||
m_heaterTemperature = heaterTemperature; |
|||
} |
|||
|
|||
} catch (const appexception& e) { |
|||
logger->error("SensorStateSyncService update thread error: {}", e.what()); |
|||
triggerError = true; |
|||
} |
|||
|
|||
if (triggerError) { |
|||
thisThread.sleepForMs(20 * 1000); |
|||
} else { |
|||
thisThread.sleepForMs(1 * 1000); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
#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 "device_io_ctrl_service.hpp"
|
|||
//
|
|||
#include "base/can_packet_dumper.hpp"
|
|||
#include "base/h2o2_sensor_data_mgr.hpp"
|
|||
//
|
|||
#include "appcomponents/algo/moving_average_filter.hpp"
|
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* service: SensorStateSyncService |
|||
* |
|||
* 监听事件: |
|||
* 依赖状态: |
|||
* 依赖服务: |
|||
* 作用: |
|||
* |
|||
*/ |
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
using namespace core; |
|||
|
|||
class SensorStateSyncService : public enable_shared_from_this<SensorStateSyncService> { |
|||
THISCLASS(SensorStateSyncService); |
|||
|
|||
unique_ptr<Thread> updateThread; |
|||
shared_ptr<DeviceIoControlService> deviceIoControlService; |
|||
shared_ptr<H2O2SensorDataMgr> h2o2SensorDataMgr; |
|||
|
|||
float m_airCompressorCurrent = 0; |
|||
float m_blowerCurrent = 0; |
|||
float m_heaterCurrent = 0; |
|||
float m_heaterTemperature = 0; |
|||
|
|||
recursive_mutex m_mutex; |
|||
bool triggerError = false; |
|||
|
|||
public: |
|||
void initialize(); |
|||
void startSync(); |
|||
|
|||
float getAirCompressorCurrent() { |
|||
lock_guard<recursive_mutex> lock(m_mutex); |
|||
return m_airCompressorCurrent; |
|||
} |
|||
|
|||
float getBlowerCurrent() { |
|||
lock_guard<recursive_mutex> lock(m_mutex); |
|||
return m_blowerCurrent; |
|||
} |
|||
|
|||
float getHeaterCurrent() { |
|||
lock_guard<recursive_mutex> lock(m_mutex); |
|||
return m_heaterCurrent; |
|||
} |
|||
|
|||
float getHeaterTemperature() { |
|||
lock_guard<recursive_mutex> lock(m_mutex); |
|||
return m_heaterTemperature; |
|||
} |
|||
|
|||
public: |
|||
void updateThreadLoop(); |
|||
}; |
|||
|
|||
}; // namespace iflytop
|
@ -0,0 +1,114 @@ |
|||
#include "test_page_ctrl_service.hpp"
|
|||
|
|||
#include "appdep/components/ziconv.hpp"
|
|||
using namespace iflytop; |
|||
using namespace testpage; |
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* |
|||
* WARNING: 这个页面接口的接口已经废弃,仅为了兼容老版本,接口不会再更新 |
|||
* Date: 2024-12-05 |
|||
* |
|||
*/ |
|||
|
|||
void TestPageCtrlService::initialize() { |
|||
REG_EXTFN(sprayPumpDoForward, void(int32_t), gpm); |
|||
REG_EXTFN(sprayPumpDoBackward, void(int32_t), gpm); |
|||
REG_EXTFN_VOID(sprayPumpDoStop, void()); |
|||
REG_EXTFN_VOID(liquidFillingPumpDoLiquidFilling, void()); |
|||
REG_EXTFN_VOID(liquidFillingPumpDoLiquidDischarge, void()); |
|||
REG_EXTFN_VOID(liquidFillingPumpDoStop, void()); |
|||
REG_EXTFN_VOID(airCompressorDoOpen, void()); |
|||
REG_EXTFN_VOID(airCompressorDoClose, void()); |
|||
REG_EXTFN_VOID(blowerDoOpen, void()); |
|||
REG_EXTFN_VOID(blowerDoClose, void()); |
|||
REG_EXTFN_VOID(heatingDoOpen, void()); |
|||
REG_EXTFN_VOID(heatingDoClose, void()); |
|||
REG_EXTFN_VOID(printerDoTest, void()); |
|||
REG_EXTFN(airLeakDetectTestModeDoSetMode, void(string mode), mode); |
|||
REG_FN_VOID(readState, void()); |
|||
|
|||
m_thread.reset(new Thread("TestPageCtrlServiceReportThread", [this]() { |
|||
while (!ThisThread().getExitFlag()) { |
|||
ThisThread().sleepForMs(1000); |
|||
SEND_CLASS_REPORT(thisClass.className, "readState", readState()); |
|||
} |
|||
})); |
|||
} |
|||
|
|||
void TestPageCtrlService::sprayPumpDoForward(shared_ptr<MsgProcessContext> cxt, int32_t gpm) { |
|||
logger->info("sprayPumpDoForward gpm: {}", gpm); |
|||
deviceIoControlService->SprayPump_start(gpm); |
|||
} |
|||
void TestPageCtrlService::sprayPumpDoBackward(shared_ptr<MsgProcessContext> cxt, int32_t gpm) { |
|||
logger->info("sprayPumpDoBackward gpm: {}", gpm); |
|||
deviceIoControlService->SprayPump_start(-gpm); |
|||
} |
|||
void TestPageCtrlService::sprayPumpDoStop(shared_ptr<MsgProcessContext> cxt) { |
|||
logger->info("sprayPumpDoStop"); |
|||
deviceIoControlService->SprayPump_stop(); |
|||
} |
|||
|
|||
void TestPageCtrlService::liquidFillingPumpDoLiquidFilling(shared_ptr<MsgProcessContext> cxt) { |
|||
deviceIoControlService->setAddFluidChannelSelectorValve(true); |
|||
deviceIoControlService->AddLiquidPump_stop(); |
|||
usleep(500 * 1000); |
|||
deviceIoControlService->AddLiquidPump_addLiquid(); |
|||
} |
|||
void TestPageCtrlService::liquidFillingPumpDoLiquidDischarge(shared_ptr<MsgProcessContext> cxt) { |
|||
deviceIoControlService->setAddFluidChannelSelectorValve(true); |
|||
deviceIoControlService->AddLiquidPump_stop(); |
|||
usleep(500 * 1000); |
|||
deviceIoControlService->AddLiquidPump_drainLiquid(); |
|||
} |
|||
void TestPageCtrlService::liquidFillingPumpDoStop(shared_ptr<MsgProcessContext> cxt) { |
|||
deviceIoControlService->AddLiquidPump_stop(); |
|||
usleep(1500 * 1000); |
|||
deviceIoControlService->setAddFluidChannelSelectorValve(false); |
|||
} |
|||
|
|||
void TestPageCtrlService::airCompressorDoOpen(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->AC_ctrl(1); } |
|||
void TestPageCtrlService::airCompressorDoClose(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->AC_ctrl(0); } |
|||
|
|||
void TestPageCtrlService::blowerDoOpen(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->Blower_ctrl(90); } |
|||
void TestPageCtrlService::blowerDoClose(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->Blower_close(); } |
|||
|
|||
void TestPageCtrlService::heatingDoOpen(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->Heater_ctrl(1); } |
|||
void TestPageCtrlService::heatingDoClose(shared_ptr<MsgProcessContext> cxt) { deviceIoControlService->Heater_ctrl(0); } |
|||
|
|||
void TestPageCtrlService::printerDoTest(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"); |
|||
} |
|||
void TestPageCtrlService::airLeakDetectTestModeDoSetMode(shared_ptr<MsgProcessContext> cxt, string mode) { |
|||
logger->info("airLeakDetectTestModeDoSetMode mode: {}", mode); |
|||
|
|||
if (mode == "disinfection") { // 消毒模式
|
|||
deviceIoControlService->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_disinfection}); |
|||
} else if (mode == "inflation") { // 充气模式
|
|||
deviceIoControlService->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_inflation}); |
|||
} else if (mode == "leakTest") { // 漏气检测模式
|
|||
deviceIoControlService->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_leakTest}); |
|||
} |
|||
} |
|||
|
|||
json TestPageCtrlService::readState() { |
|||
json state; |
|||
state["airCompressorCurrent"] = sensorStateSyncService->getAirCompressorCurrent(); |
|||
state["blowerCurrent"] = sensorStateSyncService->getBlowerCurrent(); |
|||
state["heaterCurrent"] = sensorStateSyncService->getHeaterCurrent(); |
|||
state["heaterTemperature"] = sensorStateSyncService->getHeaterTemperature(); |
|||
return state; |
|||
} |
@ -0,0 +1,67 @@ |
|||
#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 "service/hardware/sensor_state_sync_service.hpp"
|
|||
#include "testpage/test_page_processer.hpp"
|
|||
namespace iflytop { |
|||
using namespace testpage; |
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* |
|||
* WARNING: 这个页面接口的接口已经废弃,仅为了兼容老版本,接口不会再更新 |
|||
* Date: 2024-12-05 |
|||
* |
|||
*/ |
|||
|
|||
class TestPageCtrlService : public enable_shared_from_this<TestPageCtrlService> { |
|||
THISCLASS(TestPageCtrlService); |
|||
|
|||
SERVICE(SensorStateSyncService, sensorStateSyncService); |
|||
SERVICE(DeviceStateService, deviceStateService); |
|||
SERVICE(DeviceIoControlService, deviceIoControlService); |
|||
|
|||
unique_ptr<Thread> m_thread; |
|||
|
|||
public: |
|||
void initialize(); |
|||
|
|||
private: |
|||
void sprayPumpDoForward(shared_ptr<MsgProcessContext> cxt, int32_t gpm); |
|||
void sprayPumpDoBackward(shared_ptr<MsgProcessContext> cxt, int32_t gpm); |
|||
void sprayPumpDoStop(shared_ptr<MsgProcessContext> cxt); |
|||
|
|||
void liquidFillingPumpDoLiquidFilling(shared_ptr<MsgProcessContext> cxt); |
|||
void liquidFillingPumpDoLiquidDischarge(shared_ptr<MsgProcessContext> cxt); |
|||
void liquidFillingPumpDoStop(shared_ptr<MsgProcessContext> cxt); |
|||
|
|||
void airCompressorDoOpen(shared_ptr<MsgProcessContext> cxt); |
|||
void airCompressorDoClose(shared_ptr<MsgProcessContext> cxt); |
|||
|
|||
void blowerDoOpen(shared_ptr<MsgProcessContext> cxt); |
|||
void blowerDoClose(shared_ptr<MsgProcessContext> cxt); |
|||
|
|||
void heatingDoOpen(shared_ptr<MsgProcessContext> cxt); |
|||
void heatingDoClose(shared_ptr<MsgProcessContext> cxt); |
|||
|
|||
void printerDoTest(shared_ptr<MsgProcessContext> cxt); |
|||
void airLeakDetectTestModeDoSetMode(shared_ptr<MsgProcessContext> cxt, string mode); |
|||
|
|||
private: |
|||
json readState(); |
|||
}; |
|||
|
|||
} // namespace iflytop
|
@ -1,267 +0,0 @@ |
|||
#include "test_page_mgr_service.hpp"
|
|||
|
|||
#include "appdep/components/ziconv.hpp"
|
|||
using namespace iflytop; |
|||
using namespace testpage; |
|||
|
|||
/**
|
|||
* @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(); } |
|||
void TestPageMgrService::startReportState(shared_ptr<MsgProcessContext> cxt) { m_testPageItemMgr.startReportState(1000); } |
|||
void TestPageMgrService::stopReportState(shared_ptr<MsgProcessContext> cxt) { m_testPageItemMgr.stopReportState(); } |
|||
int TestPageMgrService::PrinterTest_test() { |
|||
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; |
|||
} |
|||
|
|||
void TestPageMgrService::initialize() { |
|||
GET_TO_SERVICE(m_ds); |
|||
GET_TO_SERVICE(dcs); |
|||
|
|||
REG_EXTFN_VOID(getTestPageCfgInfo, void()); |
|||
REG_EXTFN(onButton, void(string, string, json), goupName, buttonName, params); |
|||
REG_EXTFN_VOID(readState, void()); |
|||
REG_EXTFN_VOID(startReportState, void()); |
|||
REG_EXTFN_VOID(stopReportState, void()); |
|||
|
|||
REG_FN_VOID(PrinterTest_test, void()); |
|||
|
|||
auto SprayPumpCtrl = m_testPageItemMgr.createButtons({"SprayPumpCtrl", "喷液泵控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
{{"pumpVel", "速度"}, "g/min", {{"5"}, {"10"}, {"15"}}}, //
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"forward", "正转"}, |
|||
{"backward", "反转"}, |
|||
{"stop", "停止"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("SprayPumpCtrl on button.{} ({})", buttonName, param[0]); |
|||
if (buttonName == "forward") { |
|||
dcs->SprayPump_start(atoi(param[0].c_str())); |
|||
} else if (buttonName == "backward") { |
|||
dcs->SprayPump_start(-atoi(param[0].c_str())); |
|||
} else if (buttonName == "stop") { |
|||
dcs->SprayPump_stop(); |
|||
} |
|||
}); |
|||
auto AddDischargePumpCtrl = m_testPageItemMgr.createButtons({"AddDischargePumpCtrl", "加液泵控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"addingLiquid", "加液"}, |
|||
{"drainLiquid", "排液"}, |
|||
{"stop", "停止"}, |
|||
}, |
|||
[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); |
|||
} |
|||
}); |
|||
|
|||
auto AirCompressorCtrl = m_testPageItemMgr.createButtons({"AirCompressorCtrl", "空压机控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"on", "打开"}, |
|||
{"off", "关闭"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("on AirCompressorCtrl.{}", buttonName); |
|||
if (buttonName == "on") { |
|||
dcs->AC_ctrl(1); |
|||
} else if (buttonName == "off") { |
|||
dcs->AC_close(); |
|||
} |
|||
}); |
|||
|
|||
auto ACState = m_testPageItemMgr.createStates({"ACState", "空压机状态"}, {{"current", "电流"}}, [this](string stateName) { //
|
|||
return fmt::format("{:.2f}A", dcs->AC_readEI()); |
|||
}); |
|||
|
|||
auto BlowerCtrl = m_testPageItemMgr.createButtons({"BlowerCtrl", "风机控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"on", "打开"}, |
|||
{"off", "关闭"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("on BlowerCtrl.{}", buttonName); |
|||
if (buttonName == "on") { |
|||
dcs->Blower_ctrl(90); |
|||
} else if (buttonName == "off") { |
|||
dcs->Blower_close(); |
|||
} |
|||
}); |
|||
|
|||
auto Blower = m_testPageItemMgr.createStates({"Blower", "风机状态"}, {{"current", "电流"}}, [this](string stateName) { //
|
|||
return fmt::format("{:.2f}A", dcs->Blower_readEI()); |
|||
}); |
|||
|
|||
auto HeatingCtrl = m_testPageItemMgr.createButtons({"HeatingCtrl", "加热片控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"on", "打开"}, |
|||
{"off", "关闭"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("on HeatingCtrl.{}", buttonName); |
|||
if (buttonName == "on") { |
|||
dcs->Heater_ctrl(1); |
|||
} else if (buttonName == "off") { |
|||
dcs->Heater_close(); |
|||
} |
|||
}); |
|||
|
|||
auto HeatingState = m_testPageItemMgr.createStates({"HeatingState", "加热片状态"}, {{"temperature", "温度"}, {"current", "电流"}}, [this](string stateName) { //
|
|||
if (stateName == "temperature") { |
|||
return fmt::format("{:.2f}℃", dcs->Heater_readTemperature()); |
|||
} else if (stateName == "current") { |
|||
return fmt::format("{:.2f}A", dcs->Heater_readEI()); |
|||
} |
|||
return string("error"); |
|||
}); |
|||
|
|||
// 9
|
|||
|
|||
auto PrinterTest = m_testPageItemMgr.createButtons({"PrinterTest", "打印机测试"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"test", "测试"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { PrinterTest_test(); }); |
|||
|
|||
// 10
|
|||
|
|||
/*******************************************************************************
|
|||
* 正负压力控制 * |
|||
*******************************************************************************/ |
|||
|
|||
auto AirLeakDetectTestModeCtrl = m_testPageItemMgr.createButtons({"AirLeakDetectTestModeCtrl", "气密性检测通道控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"disinfection", "正常模式"}, |
|||
{"inflation", "充气模式"}, |
|||
{"leakTest", "漏气检测模式"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("AirLeakDetectTestModeCtrl buttonName:{} param:{}", buttonName, param); |
|||
if (buttonName == "disinfection") { |
|||
dcs->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_disinfection}); |
|||
} else if (buttonName == "inflation") { |
|||
dcs->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_inflation}); |
|||
} else if (buttonName == "leakTest") { |
|||
dcs->AirLeakDetectTestModeCtrl_setMode({kAirLeakTestMode_leakTest}); |
|||
} |
|||
}); |
|||
|
|||
auto PosiPressurePropCtrl = m_testPageItemMgr.createButtons({"PosiPressurePropCtrl", "正压比例阀控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
{{"pumpVel", "百分比"}, "%", {{"0"}, {"10"}, {"20"}, {"30"}, {"40"}, {"50"}, {"60"}, {"70"}, {"80"}, {"90"}, {"100"}}}, //
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"set", "设置"}, |
|||
{"close", "关闭"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("PosiPressurePropCtrl buttonName:{} params:{}", buttonName, param); |
|||
if (buttonName == "set") { |
|||
dcs->PosiPressureProp_setValve(atoi(param[0].c_str())); |
|||
} else if (buttonName == "close") { |
|||
dcs->PosiPressureProp_setValve(0); |
|||
} |
|||
}); |
|||
|
|||
auto NegaPressurePropCtrl = m_testPageItemMgr.createButtons({"NegaPressurePropCtrl", "负压比例阀控制"}, // 模组名
|
|||
{ |
|||
// 参数
|
|||
{{"pumpVel", "百分比"}, "%", {{"0"}, {"10"}, {"20"}, {"30"}, {"40"}, {"50"}, {"60"}, {"70"}, {"80"}, {"90"}, {"100"}}}, //
|
|||
}, |
|||
{ |
|||
// 按键
|
|||
{"set", "设置"}, |
|||
{"close", "关闭"}, |
|||
}, |
|||
[this](string buttonName, vector<string> param) { //
|
|||
logger->info("NegaPressurePropCtrl buttonName:{} params:{}", buttonName, param); |
|||
if (buttonName == "set") { |
|||
dcs->NegaPressureProp_setValve(atoi(param[0].c_str())); |
|||
} else if (buttonName == "close") { |
|||
dcs->NegaPressureProp_setValve(0); |
|||
} |
|||
}); |
|||
|
|||
m_testPageItemMgr.insert(SprayPumpCtrl); // 1
|
|||
m_testPageItemMgr.insert(AddDischargePumpCtrl); // 2
|
|||
m_testPageItemMgr.insert(AirCompressorCtrl); // 3
|
|||
m_testPageItemMgr.insert(ACState); // 4
|
|||
m_testPageItemMgr.insert(BlowerCtrl); // 5
|
|||
m_testPageItemMgr.insert(Blower); // 6
|
|||
m_testPageItemMgr.insert(HeatingCtrl); // 7
|
|||
m_testPageItemMgr.insert(HeatingState); // 8
|
|||
m_testPageItemMgr.insert(PrinterTest); // 9
|
|||
m_testPageItemMgr.insert(make_shared<PlaceHolder>()); // 10
|
|||
|
|||
if (PORT.isDT300W()) { |
|||
m_testPageItemMgr.insert(AirLeakDetectTestModeCtrl); // 11
|
|||
m_testPageItemMgr.insert(PosiPressurePropCtrl); // 12
|
|||
m_testPageItemMgr.insert(NegaPressurePropCtrl); // 13
|
|||
} |
|||
|
|||
m_testPageItemMgr.onState.connect([this](json state) { //
|
|||
GET_SERVICE(IflytopFrontEndService)->sendClassReport(thisClass.className, "onState", state); |
|||
}); |
|||
} |
@ -1,57 +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; |
|||
|
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* |
|||
* WARNING: 这个页面接口的接口已经废弃,仅为了兼容老版本,接口不会再更新 |
|||
* Date: 2024-12-05 |
|||
* |
|||
*/ |
|||
|
|||
class TestPageMgrService : public enable_shared_from_this<TestPageMgrService> { |
|||
THISCLASS(TestPageMgrService); |
|||
|
|||
shared_ptr<DeviceStateService> m_ds; |
|||
shared_ptr<DeviceIoControlService> dcs; |
|||
|
|||
unique_ptr<Thread> m_thread; |
|||
|
|||
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
|
@ -1,60 +0,0 @@ |
|||
#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; |
|||
} |
@ -1,54 +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; |
|||
|
|||
/**
|
|||
* @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
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue