Browse Source

fix some bug

storage-in-realtime
zhaohe 12 months ago
parent
commit
0bb575edde
  1. 2
      appdep/components/uart_printer/uart_printer.cpp
  2. 10
      appsrc/service/disinfection_logs_service.cpp
  3. 4
      appsrc/service/disinfection_logs_service.hpp

2
appdep/components/uart_printer/uart_printer.cpp

@ -23,7 +23,7 @@ void UartPrinter::print(string str) {
logger->error("uart {} is not open", m_path);
return;
}
logger->info("print:{}", str);
// logger->info("print:{}", str);
m_uart->send((char *)str.c_str(), str.size());
return;
}

10
appsrc/service/disinfection_logs_service.cpp

@ -157,10 +157,10 @@ void DisinfectionLogsService::initialize() {
GET_TO_SERVICE(m_udiskMgrService);
REG_EXTFN_VOID(getRecordList, void());
REG_EXTFN_VOID(getRecord, void());
REG_EXTFN(getRecord, void(string), logName);
REG_EXTFN(deleteReport, void(string), logName);
REG_EXTFN(exportRecord, void(vector<string>), logNames);
REG_EXTFN_VOID(printRecord, void());
REG_EXTFN(printRecord, void(string), logName);
REG_EXTFN_VOID(selftest, void());
m_csvHeaderDict.insert(CSVHeader::time, "时间");
@ -561,8 +561,7 @@ void DisinfectionLogsService::getRecordList(shared_ptr<MsgProcessContext> cxt) {
cxt->rely = record;
return;
}
void DisinfectionLogsService::getRecord(shared_ptr<MsgProcessContext> cxt) {
string logName = cxt->params["logName"];
void DisinfectionLogsService::getRecord(shared_ptr<MsgProcessContext> cxt, string logName) {
string content = FileUtils().readFileAsString(fmt::format("{}{}.csv", LOG_STORGE_PATH, logName));
vector<string> lines;
split(content, lines, '\n');
@ -586,9 +585,8 @@ void DisinfectionLogsService::exportRecord(shared_ptr<MsgProcessContext> cxt, ve
return;
}
}
void DisinfectionLogsService::printRecord(shared_ptr<MsgProcessContext> cxt) {
void DisinfectionLogsService::printRecord(shared_ptr<MsgProcessContext> cxt,string logName) {
//
string logName = cxt->params["logName"];
printRecordFile(logName);
}

4
appsrc/service/disinfection_logs_service.hpp

@ -52,10 +52,10 @@ class DisinfectionLogsService : public enable_shared_from_this<DisinfectionLogsS
* *
*******************************************************************************/
void getRecordList(shared_ptr<MsgProcessContext> cxt);
void getRecord(shared_ptr<MsgProcessContext> cxt);
void getRecord(shared_ptr<MsgProcessContext> cxt, string logName);
void deleteReport(shared_ptr<MsgProcessContext> cxt,string logName);
void exportRecord(shared_ptr<MsgProcessContext> cxt,vector<string> logNames);
void printRecord(shared_ptr<MsgProcessContext> cxt);
void printRecord(shared_ptr<MsgProcessContext> cxt,string logName);
void selftest(shared_ptr<MsgProcessContext> cxt);
private:

Loading…
Cancel
Save