diff --git a/README.md b/README.md index 0b577f0..51c9f02 100644 --- a/README.md +++ b/README.md @@ -67,24 +67,22 @@ TODO: 4. 指令重发代码功能。OK 5. 硬件测试 OK 6. 所有后台程序添加异常检查,当异常发生过,则设置全局标志位(硬件异常)。此时后台程序相应的线程将不再继续工作。(直到设备重启) OK - --------------------------------------------------------------------- -10.添加异常上报前端程序,添加异常状态读取程序 - +10.添加异常上报前端程序,添加异常状态读取程序 OK ----------------------------------------------------------------- -9. 对接消毒服务 -11.针对关键接口添加异常标志位检测程序。(消毒,加液,排液体,气密性测试) -8. 添加消毒日志打印程序 +9. 对接消毒服务 OK +11.针对关键接口添加异常标志位检测程序。(消毒,加液,排液体,气密性测试) OK +8. 添加消毒日志打印程序 OK 8. 消毒测试 -9. 添加气密封性测试逻辑代码。 +9. 添加气密封性测试逻辑代码。OK ----------------------------------------------------------------- 9. 处理硬件异常上报 (OK) 8. 添加一个程序根据全局异常标志位,对设备进行相应的检查,如果检查通过则清空标志位。同时如果发生异常,则发送板子复位指令,对板子进行复位。 整理错误码,为所有错误吗添加中文示意 -消毒过程中检测水禁传感器, -添加日志自动删除逻辑 +消毒过程中检测水禁传感器,OK +添加日志自动删除逻辑 OK ... 5. 单片机支持自动过滤掉重发的指令。 @@ -96,4 +94,5 @@ TODO: TODO文档: getLoginUser getState + fn_printRecord ``` \ No newline at end of file diff --git a/appsrc/service/app/air_leak_detect_test.cpp b/appsrc/service/app/air_leak_detect_test.cpp index 6c40ee1..d10a0b5 100644 --- a/appsrc/service/app/air_leak_detect_test.cpp +++ b/appsrc/service/app/air_leak_detect_test.cpp @@ -45,28 +45,6 @@ void AirLeakDetectTest::stop() { } AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; } -void AirLeakDetectTest::fn_start(shared_ptr cxt) { // - start(); -} -void AirLeakDetectTest::fn_stop(shared_ptr cxt) { stop(); } -void AirLeakDetectTest::fn_getState(shared_ptr 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 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() { if (PORT.isPipeDM()) { m_workstate = kinitDevice; @@ -103,3 +81,29 @@ void AirLeakDetectTest::airLeakDetectTestThread() { } } } +/******************************************************************************* + * EXT * + *******************************************************************************/ + +void AirLeakDetectTest::fn_start(shared_ptr cxt) { // + start(); +} +void AirLeakDetectTest::fn_stop(shared_ptr cxt) { stop(); } +void AirLeakDetectTest::fn_getState(shared_ptr 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 cxt) { + if (PORT.isPipeDM()) { + json cfg; + cfg["pressureUint"] = "kPa"; + cfg["pressureMax"] = 8.0; + cfg["show"] = true; + cfg["updatePeriod"] = 300; + cxt->content = cfg; + } +} \ No newline at end of file diff --git a/appsrc/service/disinfection_logs_service.cpp b/appsrc/service/disinfection_logs_service.cpp index 7492829..d6111b8 100644 --- a/appsrc/service/disinfection_logs_service.cpp +++ b/appsrc/service/disinfection_logs_service.cpp @@ -16,6 +16,7 @@ #include "appbase/appbean/disinfection_record_csv_header.hpp" #include "appbase/utils/zsimplepdf.hpp" +#include "appdep/components/ziconv.hpp" using namespace std; using namespace iflytop; typedef DisinfectionRecordCSVHeader CSVHeader; @@ -251,6 +252,7 @@ void DisinfectionLogsService::onAppDisinfectionFinishedEvent(shared_ptr 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 files) { string diskpath; @@ -567,6 +589,8 @@ void DisinfectionLogsService::fn_exportRecord(shared_ptr cxt) } void DisinfectionLogsService::fn_printRecord(shared_ptr cxt) { // + string logName = cxt->params["logName"]; + printRecordFile(logName); } chrono::system_clock::time_point time_point_increment(chrono::system_clock::time_point& tp, int seconds) { diff --git a/appsrc/service/disinfection_logs_service.hpp b/appsrc/service/disinfection_logs_service.hpp index 8553abc..71a2ffa 100644 --- a/appsrc/service/disinfection_logs_service.hpp +++ b/appsrc/service/disinfection_logs_service.hpp @@ -63,6 +63,8 @@ class DisinfectionLogsService : public enable_shared_from_this files); void clearRecordFiles(); void deleteRecordFile(string file); + void printRecordFile(string file); + bool dosystem(string cmd); shared_ptr selftest_createFakeSnapshot(zsystem_tp time, DisinfectionState state, int sensorNum, bool forceLog); diff --git a/doc/后端测试.md b/doc/后端测试.md index 4096e8d..6c202a0 100644 --- a/doc/后端测试.md +++ b/doc/后端测试.md @@ -7,5 +7,4 @@ - ``` \ No newline at end of file