|
|
@ -126,34 +126,20 @@ void AppCore::initialize() { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
REGFN(AppCore, getState); |
|
|
|
REGFN(AppCore, promptConfirm); |
|
|
|
REGFN(AppCore, promptGetAll); |
|
|
|
REGFN(AppCore, promptGetNext); |
|
|
|
REGFN(AppCore, startGenFakeH2O2Data); |
|
|
|
REGFN(AppCore, stopGenFakeH2O2Data); |
|
|
|
REGFNV2(AppCore, getState); |
|
|
|
REGFNV2(AppCore, promptConfirm); |
|
|
|
REGFNV2(AppCore, promptGetAll); |
|
|
|
REGFNV2(AppCore, promptGetNext); |
|
|
|
REGFNV2(AppCore, startGenFakeH2O2Data); |
|
|
|
REGFNV2(AppCore, stopGenFakeH2O2Data); |
|
|
|
}; |
|
|
|
|
|
|
|
void AppCore::getState(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_getState(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
lock_guard<recursive_mutex> lock(warningPromptListMutex); |
|
|
|
auto& content = cxt->content; |
|
|
|
|
|
|
|
content["state"] = DS->getDeviceState(); |
|
|
|
|
|
|
|
content["loginInfo"]["loginFlag"] = DS->isLogin(); |
|
|
|
content["loginInfo"]["loginUid"] = DS->getLoginUid(); |
|
|
|
content["loginInfo"]["isLoginAdmin"] = DS->isLoginAdmin(); |
|
|
|
|
|
|
|
content["estate"]["ecode"] = DS->getAppExceptionCode(); |
|
|
|
content["estate"]["state"] = DS->getAppExceptionFlag(); |
|
|
|
content["estate"]["emessage"] = DS->getAppExceptionMessage(); |
|
|
|
|
|
|
|
content["testMode"]["isInTestMode"] = DS->isTestMode(); |
|
|
|
|
|
|
|
content["promptNum"] = warningPromptList.size(); |
|
|
|
cxt->content = getState(); |
|
|
|
} |
|
|
|
|
|
|
|
void AppCore::promptConfirm(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_promptConfirm(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
lock_guard<recursive_mutex> lock(warningPromptListMutex); |
|
|
|
string promptId = cxt->params["promptId"]; |
|
|
|
|
|
|
@ -166,7 +152,7 @@ void AppCore::promptConfirm(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
GET_SERVICE(WarningLightControler)->setwarningFlag(false); |
|
|
|
} |
|
|
|
|
|
|
|
void AppCore::promptGetAll(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_promptGetAll(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
lock_guard<recursive_mutex> lock(warningPromptListMutex); |
|
|
|
auto content = cxt->content; |
|
|
|
content["prompts"] = json::array(); |
|
|
@ -175,7 +161,7 @@ void AppCore::promptGetAll(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void AppCore::promptGetNext(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_promptGetNext(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
lock_guard<recursive_mutex> lock(warningPromptListMutex); |
|
|
|
auto content = cxt->content; |
|
|
|
if (warningPromptList.size() > 0) { |
|
|
@ -183,7 +169,7 @@ void AppCore::promptGetNext(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void AppCore::setInTestMode(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_setInTestMode(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
bool isInTestMode = cxt->params["isInTestMode"]; |
|
|
|
DS->setTestMode(isInTestMode); |
|
|
|
json content; |
|
|
@ -199,7 +185,7 @@ typedef struct { |
|
|
|
bool enable[3]; |
|
|
|
} fake_h2o2_data_cache_t; |
|
|
|
|
|
|
|
void AppCore::startGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_startGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
if (m_genFakeH2O2DataThread) { |
|
|
|
m_genFakeH2O2DataThread->join(); |
|
|
|
m_genFakeH2O2DataThread = nullptr; |
|
|
@ -233,7 +219,7 @@ void AppCore::startGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
} |
|
|
|
})); |
|
|
|
} |
|
|
|
void AppCore::stopGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
void AppCore::fn_stopGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
if (m_genFakeH2O2DataThread) { |
|
|
|
m_genFakeH2O2DataThread->join(); |
|
|
|
m_genFakeH2O2DataThread = nullptr; |
|
|
@ -242,11 +228,28 @@ void AppCore::stopGenFakeH2O2Data(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
|
|
|
|
void AppCore::loop() {} |
|
|
|
void AppCore::onDeviceStateChange() { |
|
|
|
json content; |
|
|
|
SEND_CLASS_REPORT("AppCore", "onDeviceStateChange", content); |
|
|
|
SEND_CLASS_REPORT("AppCore", "onDeviceStateChange", getState()); |
|
|
|
} |
|
|
|
void AppCore::insertPrompt(shared_ptr<Prompt> prompt) { |
|
|
|
lock_guard<recursive_mutex> lock(warningPromptListMutex); |
|
|
|
warningPromptList.push_back(prompt); |
|
|
|
if (prompt->isWarning) GET_SERVICE(WarningLightControler)->setwarningFlag(true); |
|
|
|
} |
|
|
|
|
|
|
|
json AppCore::getState() { |
|
|
|
json ret; |
|
|
|
ret["state"] = DS->getDeviceState(); |
|
|
|
|
|
|
|
ret["loginInfo"]["loginFlag"] = DS->isLogin(); |
|
|
|
ret["loginInfo"]["loginUid"] = DS->getLoginUid(); |
|
|
|
ret["loginInfo"]["isLoginAdmin"] = DS->isLoginAdmin(); |
|
|
|
|
|
|
|
ret["estate"]["ecode"] = DS->getAppExceptionCode(); |
|
|
|
ret["estate"]["state"] = DS->getAppExceptionFlag(); |
|
|
|
ret["estate"]["emessage"] = DS->getAppExceptionMessage(); |
|
|
|
|
|
|
|
ret["testMode"]["isInTestMode"] = DS->isTestMode(); |
|
|
|
|
|
|
|
ret["promptNum"] = warningPromptList.size(); |
|
|
|
return ret; |
|
|
|
} |