Browse Source

update

storage-in-realtime
zhaohe 12 months ago
parent
commit
0cf743a850
  1. 6
      appsrc/baseservice/front_msg_processer/front_msg_processer.cpp
  2. 6
      appsrc/baseservice/front_msg_processer/front_msg_processer.hpp
  3. 6
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
  4. 2
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp
  5. 8
      appsrc/service/app/add_liquid_service.cpp
  6. 8
      appsrc/service/app/air_leak_detect_test.cpp
  7. 6
      appsrc/service/app/disinfection_ctrl_service_ext.cpp
  8. 8
      appsrc/service/app/drain_liquid_service.cpp
  9. 10
      appsrc/service/app/pipeline_pressure_control.cpp
  10. 6
      appsrc/service/app_core.cpp
  11. 2
      appsrc/service/audit_mgr_service.cpp
  12. 2
      appsrc/service/device_info_mgr_service.cpp
  13. 4
      appsrc/service/disinfection_logs_service.cpp
  14. 4
      appsrc/service/front_end_realtime_display_content_mgr.cpp
  15. 2
      appsrc/service/hardware/device_io_ctrl_service.cpp
  16. 8
      appsrc/service/setting_mgr_service.cpp
  17. 4
      appsrc/service/test_page_mgr_service.cpp
  18. 8
      appsrc/service/user_mgr_service.cpp

6
appsrc/baseservice/front_msg_processer/front_msg_processer.cpp

@ -75,7 +75,7 @@ void FrontMsgProcesser::processMsg(shared_ptr<MsgProcessContext> cxt) {
if (fn == "FNScheduler.geFnList") {
cxt->receipt["ackcode"] = 0;
cxt->receipt["content"] = geFnList();
cxt->receipt["rely"] = geFnList();
return;
}
@ -90,8 +90,8 @@ void FrontMsgProcesser::processMsg(shared_ptr<MsgProcessContext> cxt) {
if (int(cxt->receipt["ackcode"]) != 0) {
cxt->receipt["message"] = fmt::format("[{}],{}", ecode2str(cxt->receipt["ackcode"]), cxt->ackcodeExtMessage);
}
if (cxt->content.empty() == false) {
cxt->receipt["content"] = cxt->content;
if (cxt->rely.empty() == false) {
cxt->receipt["rely"] = cxt->rely;
}
} catch (const appexception& e) {

6
appsrc/baseservice/front_msg_processer/front_msg_processer.hpp

@ -38,7 +38,7 @@ class MsgProcessContext {
json params;
json receipt;
int ackcode = 0;
json content;
json rely;
string ackcodeExtMessage;
};
@ -169,14 +169,14 @@ static inline T jsonGet(json j) {
function<type> __fun; \
FrontMsgProcesser::ins().regProcesser(__fun, thisClass.className, #fn, {MARCO_LIST(REGFNV_EACH_EXPTR2, _1, _2, _3, _4, _5, __VA_ARGS__)}, [this](shared_ptr<MsgProcessContext> cxt) { \
json& params = cxt->params; \
cxt->content = fn(MARCO_LIST(REGFNV_EACH_EXPTR1, _1, _2, _3, _4, _5, __VA_ARGS__)); \
cxt->rely = fn(MARCO_LIST(REGFNV_EACH_EXPTR1, _1, _2, _3, _4, _5, __VA_ARGS__)); \
}); \
}
#define REG_FN_VOID(fn, type) \
{ \
function<type> __fun; \
FrontMsgProcesser::ins().regProcesser(__fun, thisClass.className, #fn, {}, [this](shared_ptr<MsgProcessContext> cxt) { cxt->content = fn(); }); \
FrontMsgProcesser::ins().regProcesser(__fun, thisClass.className, #fn, {}, [this](shared_ptr<MsgProcessContext> cxt) { cxt->rely = fn(); }); \
}
#define REG_EXTFN(fn, type, ...) \

6
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp

@ -90,17 +90,17 @@ void IflytopFrontEndService::sendReport(json reportType, json report) {
}
}
void IflytopFrontEndService::sendClassReport(string fromclass, string fromfn, const json& content) {
void IflytopFrontEndService::sendClassReport(string fromclass, string fromfn, const json& rely) {
json report;
report["fromClass"] = fromclass;
report["fromFn"] = fromfn;
report["content"] = content;
report["rely"] = rely;
sendReport("classReport", report);
}
void IflytopFrontEndService::sendPrompt(string message) {
json report;
report["content"]["message"] = message;
report["rely"]["message"] = message;
sendReport("prompt", report);
}

2
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp

@ -54,7 +54,7 @@ class IflytopFrontEndService : public enable_shared_from_this<IflytopFrontEndSer
void initialize(string ip = "0.0.0.0");
void startListen();
void sendReport(json reportType, json report);
void sendClassReport(string fromclass, string fromfn, const json& content);
void sendClassReport(string fromclass, string fromfn, const json& rely);
void sendPrompt(string message);
private:

8
appsrc/service/app/add_liquid_service.cpp

@ -142,14 +142,14 @@ AddLiquidService::state_t AddLiquidService::getWorkstate() { return m_workstate;
void AddLiquidService::start(shared_ptr<MsgProcessContext> cxt, int stopatg) { start(stopatg); }
void AddLiquidService::stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AddLiquidService::getState(shared_ptr<MsgProcessContext> cxt) { //
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["nowLiquid"] = m_dwus->getWeight();
cxt->rely["workState"] = state2str(getWorkstate());
cxt->rely["workStateDisplay"] = state2chstr(getWorkstate());
cxt->rely["nowLiquid"] = m_dwus->getWeight();
}
void AddLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
json cfg;
cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity();
cfg["show"] = true;
cfg["updatePeriod"] = 300;
cxt->content = cfg;
cxt->rely = cfg;
}

8
appsrc/service/app/air_leak_detect_test.cpp

@ -93,9 +93,9 @@ void AirLeakDetectTest::stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AirLeakDetectTest::getState(shared_ptr<MsgProcessContext> cxt) { //
if (PORT.isPipeDM()) {
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["pressure"] = pressurePa / 1000.0;
cxt->rely["workState"] = state2str(getWorkstate());
cxt->rely["workStateDisplay"] = state2chstr(getWorkstate());
cxt->rely["pressure"] = pressurePa / 1000.0;
}
}
void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
@ -105,6 +105,6 @@ void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
cfg["pressureMax"] = 8.0;
cfg["show"] = true;
cfg["updatePeriod"] = 300;
cxt->content = cfg;
cxt->rely = cfg;
}
}

6
appsrc/service/app/disinfection_ctrl_service_ext.cpp

@ -63,7 +63,7 @@ void DisinfectionCtrlServiceExt::startWithFormula(shared_ptr<MsgProcessContext>
void DisinfectionCtrlServiceExt::stop(shared_ptr<MsgProcessContext> cxt) { dcs->stop(); }
void DisinfectionCtrlServiceExt::getRealtimeConfig(shared_ptr<MsgProcessContext> cxt) {
json& rely = cxt->content;
json& rely = cxt->rely;
for (auto& cfg : dcs->getRealtimeCfg()) {
rely[cfg.first] = cfg.second;
}
@ -74,7 +74,7 @@ void DisinfectionCtrlServiceExt::setRealtimeConfig(shared_ptr<MsgProcessContext>
}
void DisinfectionCtrlServiceExt::getState(shared_ptr<MsgProcessContext> cxt) {
json& rely = cxt->content;
json& rely = cxt->rely;
rely["statedisplayName"] = toDisplayName(string(dcs->getState()));
rely["state"] = string(dcs->getState());
rely["curStateRemainTimeS"] = dcs->getCurStateRemainTimeS();
@ -97,7 +97,7 @@ void DisinfectionCtrlServiceExt::getState(shared_ptr<MsgProcessContext> cxt) {
}
void DisinfectionCtrlServiceExt::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
json& rely = cxt->content;
json& rely = cxt->rely;
rely["curveNum"] = PORT.getExtH2O2SensorNum() + 1;
rely["curveUpdatePeriodMs"] = 10000;
}

8
appsrc/service/app/drain_liquid_service.cpp

@ -63,9 +63,9 @@ void DrainLiquidService::start(shared_ptr<MsgProcessContext> cxt) { //
}
void DrainLiquidService::stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void DrainLiquidService::getState(shared_ptr<MsgProcessContext> cxt) { //
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["nowLiquid"] = m_dwus->getWeight();
cxt->rely["workState"] = state2str(getWorkstate());
cxt->rely["workStateDisplay"] = state2chstr(getWorkstate());
cxt->rely["nowLiquid"] = m_dwus->getWeight();
}
void DrainLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
@ -73,7 +73,7 @@ void DrainLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
cfg["maxLiquid"] = PORT.getDisinfectantBucketCapacity();
cfg["show"] = true;
cfg["updatePeriod"] = 300;
cxt->content = cfg;
cxt->rely = cfg;
}
void DrainLiquidService::workThread() {

10
appsrc/service/app/pipeline_pressure_control.cpp

@ -53,7 +53,7 @@ void PipelinePressureControl::getConfig(shared_ptr<MsgProcessContext> cxt) {
cfg["intensitys"]["constantPressure"] = {};
cfg["intensitys"]["positivePressure"] = {"10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"};
cfg["intensitys"]["negativePressure"] = {"10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"};
cxt->content = cfg;
cxt->rely = cfg;
}
void PipelinePressureControl::setType(shared_ptr<MsgProcessContext> cxt, string type) {
m_type = cxt->params["type"];
@ -73,8 +73,8 @@ void PipelinePressureControl::setType(shared_ptr<MsgProcessContext> cxt, string
}
syncPressureValueState();
cxt->content["type"] = m_type;
cxt->content["intensity"] = fmt::format("{}%", m_intensity);
cxt->rely["type"] = m_type;
cxt->rely["intensity"] = fmt::format("{}%", m_intensity);
}
void PipelinePressureControl::setIntensity(shared_ptr<MsgProcessContext> cxt, string intensity) {
@ -89,7 +89,7 @@ void PipelinePressureControl::setIntensity(shared_ptr<MsgProcessContext> cxt, st
syncPressureValueState();
}
void PipelinePressureControl::getState(shared_ptr<MsgProcessContext> cxt) {
cxt->content["type"] = m_type;
cxt->content["intensity"] = fmt::format("{}%", m_intensity);
cxt->rely["type"] = m_type;
cxt->rely["intensity"] = fmt::format("{}%", m_intensity);
;
}

6
appsrc/service/app_core.cpp

@ -140,7 +140,7 @@ int AppCore::demofn(int a, int b) { return 0; }
void AppCore::getState(shared_ptr<MsgProcessContext> cxt) {
lock_guard<recursive_mutex> lock(warningPromptListMutex);
cxt->content = getState();
cxt->rely = getState();
}
void AppCore::promptConfirm(shared_ptr<MsgProcessContext> cxt, string promptId) {
@ -156,7 +156,7 @@ void AppCore::promptConfirm(shared_ptr<MsgProcessContext> cxt, string promptId)
void AppCore::promptGetAll(shared_ptr<MsgProcessContext> cxt) {
lock_guard<recursive_mutex> lock(warningPromptListMutex);
auto content = cxt->content;
auto content = cxt->rely;
content["prompts"] = json::array();
for (auto& p : warningPromptList) {
content["warningPromptList"].push_back(*p);
@ -165,7 +165,7 @@ void AppCore::promptGetAll(shared_ptr<MsgProcessContext> cxt) {
void AppCore::promptGetNext(shared_ptr<MsgProcessContext> cxt) {
lock_guard<recursive_mutex> lock(warningPromptListMutex);
auto content = cxt->content;
auto content = cxt->rely;
if (warningPromptList.size() > 0) {
content["warningPrompt"] = *warningPromptList.front();
}

2
appsrc/service/audit_mgr_service.cpp

@ -86,7 +86,7 @@ void AuditMgrService::exportData(shared_ptr<MsgProcessContext> cxt) {
void AuditMgrService::getRecords(shared_ptr<MsgProcessContext> cxt) {
json& params = cxt->params;
cxt->content = m_db->getUserBehaviorRecordDescJson(jsonGet<int>(params["page"]), jsonGet<int>(params["page_size"]));
cxt->rely = m_db->getUserBehaviorRecordDescJson(jsonGet<int>(params["page"]), jsonGet<int>(params["page_size"]));
}
void AuditMgrService::pushTestData(shared_ptr<MsgProcessContext> cxt) {
ADD_USER_BEHAVIOR("123", kbehavior_login, "");

2
appsrc/service/device_info_mgr_service.cpp

@ -15,7 +15,7 @@ void DeviceInfoMgrService::initialize() {
void DeviceInfoMgrService::getDeviceInfo(shared_ptr<MsgProcessContext> cxt) { //
auto& content = cxt->content;
auto& content = cxt->rely;
content["projectType"] = PORT.getProjTypeString();
content["appVersion"] = VERSION;
content["mircoVersion"] = "3.0.0"; // TODO:换成真实的版本信息

4
appsrc/service/disinfection_logs_service.cpp

@ -558,7 +558,7 @@ void DisinfectionLogsService::getRecordList(shared_ptr<MsgProcessContext> cxt) {
*/
vector<string> record;
for (auto& file : m_recordFiles) record.push_back(file);
cxt->content = record;
cxt->rely = record;
return;
}
void DisinfectionLogsService::getRecord(shared_ptr<MsgProcessContext> cxt) {
@ -567,7 +567,7 @@ void DisinfectionLogsService::getRecord(shared_ptr<MsgProcessContext> cxt) {
vector<string> lines;
split(content, lines, '\n');
for (auto& line : lines) {
cxt->content.push_back(line);
cxt->rely.push_back(line);
}
}

4
appsrc/service/front_end_realtime_display_content_mgr.cpp

@ -8,7 +8,7 @@ void FrontEndRealtimeDisplayContentMgr::initialize() { //
}
void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcessContext> cxt) {
auto& content = cxt->content;
auto& content = cxt->rely;
auto h2o2Mgr = GET_SERVICE(DeviceIoControlService)->getH2O2SensorMgr();
@ -35,5 +35,5 @@ void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcess
sensordata[2]["rs"] = !h2o2Mgr->isDataExpired(2) ? h2o2Mgr->getCacheData(2)->saturation : -1;
}
cxt->content["val"] = sensordata;
cxt->rely["val"] = sensordata;
}

2
appsrc/service/hardware/device_io_ctrl_service.cpp

@ -473,7 +473,7 @@ int DeviceIoControlService::AddLiquidPumpPostPS_readPa() { //
#define PROCESS_CMD_WITH_RET(fnName, ...) \
if (testFnName == #fnName) { \
auto ret = fnName(__VA_ARGS__); \
cxt->content = ret; \
cxt->rely = ret; \
return; \
}

8
appsrc/service/setting_mgr_service.cpp

@ -24,17 +24,17 @@ void SettingMgrService::initialize() {
void SettingMgrService::getAllSetting(shared_ptr<MsgProcessContext> cxt) {
auto settings = SETTING_DB->getAllSetting();
cxt->content = settings;
cxt->rely = settings;
}
void SettingMgrService::setSettingVal(shared_ptr<MsgProcessContext> cxt, string settingName, string settingVal) {
bool suc = SETTING_DB->setSettingVal(settingName, settingVal);
APPCHECK(suc, err::kappe_db_operate_error, "setSettingVal failed");
}
void SettingMgrService::getAllFormula(shared_ptr<MsgProcessContext> cxt) { cxt->content = FORMULA_DB->getAllFormula(); }
void SettingMgrService::getAllFormula(shared_ptr<MsgProcessContext> cxt) { cxt->rely = FORMULA_DB->getAllFormula(); }
void SettingMgrService::addNewFormula(shared_ptr<MsgProcessContext> cxt) {
auto formula = FORMULA_DB->newFormula();
cxt->content = formula;
cxt->rely = formula;
}
void SettingMgrService::delFormula(shared_ptr<MsgProcessContext> cxt, string formula_id) {
@ -54,5 +54,5 @@ void SettingMgrService::updateFormulaIterm(shared_ptr<MsgProcessContext> cxt, st
}
void SettingMgrService::factoryResetSettings(shared_ptr<MsgProcessContext> cxt) {
SETTING_DB->factoryReset();
cxt->content = SETTING_DB->getAllSetting();
cxt->rely = SETTING_DB->getAllSetting();
}

4
appsrc/service/test_page_mgr_service.cpp

@ -1,9 +1,9 @@
#include "test_page_mgr_service.hpp"
using namespace iflytop;
void TestPageMgrService::getTestPageCfgInfo(shared_ptr<MsgProcessContext> cxt) { cxt->content["items"] = m_testPageItemMgr.getPageCfgInfo(); }
void TestPageMgrService::getTestPageCfgInfo(shared_ptr<MsgProcessContext> cxt) { cxt->rely["items"] = m_testPageItemMgr.getPageCfgInfo(); }
void TestPageMgrService::onButton(shared_ptr<MsgProcessContext> cxt) { m_testPageItemMgr.processOnButton(cxt->params); }
void TestPageMgrService::readState(shared_ptr<MsgProcessContext> cxt) { cxt->content = m_testPageItemMgr.readState(); }
void TestPageMgrService::readState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = m_testPageItemMgr.readState(); }
void TestPageMgrService::triggerOnePrompt(shared_ptr<MsgProcessContext> cxt) { GET_SERVICE(IflytopFrontEndService)->sendPrompt("测试Prompt"); }
void TestPageMgrService::startReportState(shared_ptr<MsgProcessContext> cxt) { m_testPageItemMgr.startReportState(1000); }
void TestPageMgrService::stopReportState(shared_ptr<MsgProcessContext> cxt) { m_testPageItemMgr.stopReportState(); }

8
appsrc/service/user_mgr_service.cpp

@ -67,7 +67,7 @@ void UserMgrService::updateUserUid(shared_ptr<MsgProcessContext> cxt, int id, st
}
void UserMgrService::getAllUser(shared_ptr<MsgProcessContext> cxt) {
auto users = m_db->getAllUserJson();
cxt->receipt["content"] = users;
cxt->receipt["rely"] = users;
return;
}
@ -75,11 +75,11 @@ void UserMgrService::getLoginUser(shared_ptr<MsgProcessContext> cxt) {
string loginuid = m_deviceStateService->getLoginUid();
bool isLogin = m_deviceStateService->isLogin();
cxt->receipt["content"]["isLogin"] = isLogin;
cxt->receipt["rely"]["isLogin"] = isLogin;
if (isLogin) {
cxt->receipt["content"]["loginUser"] = m_db->getUserJson(loginuid);
cxt->receipt["rely"]["loginUser"] = m_db->getUserJson(loginuid);
} else {
cxt->receipt["content"]["loginUser"] = {};
cxt->receipt["rely"]["loginUser"] = {};
}
return;
}
Loading…
Cancel
Save