Browse Source

添加气体压力测试

storage-in-realtime
zhaohe 12 months ago
parent
commit
4b1c8bcb6f
  1. 17
      README.md
  2. 48
      appsrc/service/app/air_leak_detect_test.cpp
  3. 24
      appsrc/service/disinfection_logs_service.cpp
  4. 2
      appsrc/service/disinfection_logs_service.hpp
  5. 1
      doc/后端测试.md

17
README.md

@ -67,24 +67,22 @@ TODO:
4. 指令重发代码功能。OK 4. 指令重发代码功能。OK
5. 硬件测试 OK 5. 硬件测试 OK
6. 所有后台程序添加异常检查,当异常发生过,则设置全局标志位(硬件异常)。此时后台程序相应的线程将不再继续工作。(直到设备重启) OK 6. 所有后台程序添加异常检查,当异常发生过,则设置全局标志位(硬件异常)。此时后台程序相应的线程将不再继续工作。(直到设备重启) OK
--------------------------------------------------------------------- ---------------------------------------------------------------------
10.添加异常上报前端程序,添加异常状态读取程序
10.添加异常上报前端程序,添加异常状态读取程序 OK
----------------------------------------------------------------- -----------------------------------------------------------------
9. 对接消毒服务
11.针对关键接口添加异常标志位检测程序。(消毒,加液,排液体,气密性测试)
8. 添加消毒日志打印程序
9. 对接消毒服务 OK
11.针对关键接口添加异常标志位检测程序。(消毒,加液,排液体,气密性测试) OK
8. 添加消毒日志打印程序 OK
8. 消毒测试 8. 消毒测试
9. 添加气密封性测试逻辑代码。
9. 添加气密封性测试逻辑代码。OK
----------------------------------------------------------------- -----------------------------------------------------------------
9. 处理硬件异常上报 (OK) 9. 处理硬件异常上报 (OK)
8. 添加一个程序根据全局异常标志位,对设备进行相应的检查,如果检查通过则清空标志位。同时如果发生异常,则发送板子复位指令,对板子进行复位。 8. 添加一个程序根据全局异常标志位,对设备进行相应的检查,如果检查通过则清空标志位。同时如果发生异常,则发送板子复位指令,对板子进行复位。
整理错误码,为所有错误吗添加中文示意 整理错误码,为所有错误吗添加中文示意
消毒过程中检测水禁传感器,
添加日志自动删除逻辑
消毒过程中检测水禁传感器,OK
添加日志自动删除逻辑 OK
... ...
5. 单片机支持自动过滤掉重发的指令。 5. 单片机支持自动过滤掉重发的指令。
@ -96,4 +94,5 @@ TODO:
TODO文档: TODO文档:
getLoginUser getLoginUser
getState getState
fn_printRecord
``` ```

48
appsrc/service/app/air_leak_detect_test.cpp

@ -45,28 +45,6 @@ void AirLeakDetectTest::stop() {
} }
AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; } AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; }
void AirLeakDetectTest::fn_start(shared_ptr<MsgProcessContext> cxt) { //
start();
}
void AirLeakDetectTest::fn_stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AirLeakDetectTest::fn_getState(shared_ptr<MsgProcessContext> cxt) { //
if (PORT.isPipeDM()) {
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["pressure"] = pressurePa / 1000.0;
}
}
void AirLeakDetectTest::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
if (PORT.isPipeDM()) {
json cfg;
cfg["pressureUint"] = "kPa";
cfg["pressureMax"] = 8.0;
cfg["show"] = true;
cfg["updatePeriod"] = 300;
cxt->content = cfg;
}
}
void AirLeakDetectTest::airLeakDetectTestThread() { void AirLeakDetectTest::airLeakDetectTestThread() {
if (PORT.isPipeDM()) { if (PORT.isPipeDM()) {
m_workstate = kinitDevice; m_workstate = kinitDevice;
@ -103,3 +81,29 @@ void AirLeakDetectTest::airLeakDetectTestThread() {
} }
} }
} }
/*******************************************************************************
* EXT *
*******************************************************************************/
void AirLeakDetectTest::fn_start(shared_ptr<MsgProcessContext> cxt) { //
start();
}
void AirLeakDetectTest::fn_stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AirLeakDetectTest::fn_getState(shared_ptr<MsgProcessContext> cxt) { //
if (PORT.isPipeDM()) {
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["pressure"] = pressurePa / 1000.0;
}
}
void AirLeakDetectTest::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
if (PORT.isPipeDM()) {
json cfg;
cfg["pressureUint"] = "kPa";
cfg["pressureMax"] = 8.0;
cfg["show"] = true;
cfg["updatePeriod"] = 300;
cxt->content = cfg;
}
}

24
appsrc/service/disinfection_logs_service.cpp

@ -16,6 +16,7 @@
#include "appbase/appbean/disinfection_record_csv_header.hpp" #include "appbase/appbean/disinfection_record_csv_header.hpp"
#include "appbase/utils/zsimplepdf.hpp" #include "appbase/utils/zsimplepdf.hpp"
#include "appdep/components/ziconv.hpp"
using namespace std; using namespace std;
using namespace iflytop; using namespace iflytop;
typedef DisinfectionRecordCSVHeader CSVHeader; typedef DisinfectionRecordCSVHeader CSVHeader;
@ -251,6 +252,7 @@ void DisinfectionLogsService::onAppDisinfectionFinishedEvent(shared_ptr<Disinfec
* 1. * 1.
* 2.PDF文件缓存 * 2.PDF文件缓存
*/ */
printRecordFile(m_sessionId);
} }
/** /**
@ -470,6 +472,26 @@ void DisinfectionLogsService::deleteRecordFile(string file) {
dosystem(fmt::format("rm -rf {}", filepath)); dosystem(fmt::format("rm -rf {}", filepath));
m_recordFiles.remove_if([file](const string& s) { return s == file; }); m_recordFiles.remove_if([file](const string& s) { return s == file; });
} }
void DisinfectionLogsService::printRecordFile(string file) {
string filepath = fmt::format("{}{}.log", LOG_STORGE_PATH, file);
string content = FileUtils().readFileAsString(filepath);
// 对dump进行分行处理
vector<string> textlist;
istringstream stream(content);
string line;
while (getline(stream, line)) {
textlist.push_back(line);
}
ZASSERT(GET_SERVICE(UartPrinter));
for (auto& text : textlist) {
GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312(text + "\n"));
logger->info("print: {}", text);
this_thread::sleep_for(chrono::milliseconds(200));
}
}
int32_t DisinfectionLogsService::exportDisinfectionData(vector<string> files) { int32_t DisinfectionLogsService::exportDisinfectionData(vector<string> files) {
string diskpath; string diskpath;
@ -567,6 +589,8 @@ void DisinfectionLogsService::fn_exportRecord(shared_ptr<MsgProcessContext> cxt)
} }
void DisinfectionLogsService::fn_printRecord(shared_ptr<MsgProcessContext> cxt) { void DisinfectionLogsService::fn_printRecord(shared_ptr<MsgProcessContext> cxt) {
// //
string logName = cxt->params["logName"];
printRecordFile(logName);
} }
chrono::system_clock::time_point time_point_increment(chrono::system_clock::time_point& tp, int seconds) { chrono::system_clock::time_point time_point_increment(chrono::system_clock::time_point& tp, int seconds) {

2
appsrc/service/disinfection_logs_service.hpp

@ -63,6 +63,8 @@ class DisinfectionLogsService : public enable_shared_from_this<DisinfectionLogsS
int32_t exportDisinfectionData(vector<string> files); int32_t exportDisinfectionData(vector<string> files);
void clearRecordFiles(); void clearRecordFiles();
void deleteRecordFile(string file); void deleteRecordFile(string file);
void printRecordFile(string file);
bool dosystem(string cmd); bool dosystem(string cmd);
shared_ptr<DisinfectionStateSnapshot> selftest_createFakeSnapshot(zsystem_tp time, DisinfectionState state, int sensorNum, bool forceLog); shared_ptr<DisinfectionStateSnapshot> selftest_createFakeSnapshot(zsystem_tp time, DisinfectionState state, int sensorNum, bool forceLog);

1
doc/后端测试.md

@ -7,5 +7,4 @@
``` ```
Loading…
Cancel
Save