|
@ -31,22 +31,26 @@ void DisinfectionCtrlService::initialize() { |
|
|
REGFNV2(DisinfectionCtrlService, startWithFormula); |
|
|
REGFNV2(DisinfectionCtrlService, startWithFormula); |
|
|
REGFNV2(DisinfectionCtrlService, stop); |
|
|
REGFNV2(DisinfectionCtrlService, stop); |
|
|
REGFNV2(DisinfectionCtrlService, getState); |
|
|
REGFNV2(DisinfectionCtrlService, getState); |
|
|
REGFNV2(DisinfectionCtrlService, getServiceConfig); |
|
|
|
|
|
REGFNV2(DisinfectionCtrlService, getRealtimeConfig); |
|
|
REGFNV2(DisinfectionCtrlService, getRealtimeConfig); |
|
|
|
|
|
REGFNV2(DisinfectionCtrlService, setRealtimeConfig); |
|
|
|
|
|
REGFNV2(DisinfectionCtrlService, getServiceConfig); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::fn_start(shared_ptr<MsgProcessContext> cxt) { |
|
|
void DisinfectionCtrlService::fn_start(shared_ptr<MsgProcessContext> cxt) { |
|
|
// 从setting中获取实时参数
|
|
|
// 从setting中获取实时参数
|
|
|
m_formulaid = ""; |
|
|
m_formulaid = ""; |
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
|
|
|
m_realtimeCfg.clear(); |
|
|
for (auto& setting : allrealtimesetting) { |
|
|
for (auto& setting : allrealtimesetting) { |
|
|
m_realtimeCfg[string(setting->setting_id)] = setting->val; |
|
|
m_realtimeCfg[string(setting->setting_id)] = setting->val; |
|
|
} |
|
|
} |
|
|
m_state = kstate_preheat; |
|
|
m_state = kstate_preheat; |
|
|
} |
|
|
} |
|
|
void DisinfectionCtrlService::fn_startWithFormula(shared_ptr<MsgProcessContext> cxt) { //
|
|
|
void DisinfectionCtrlService::fn_startWithFormula(shared_ptr<MsgProcessContext> cxt) { //
|
|
|
m_formulaid = cxt->params["formula_id"]; |
|
|
|
|
|
m_defaultFormulaJson = FORMULA_DB->getFormula(m_formulaid); |
|
|
|
|
|
|
|
|
m_formulaid = cxt->params["formula_id"]; |
|
|
|
|
|
m_defaultFormulaJson = FORMULA_DB->getFormula(m_formulaid); |
|
|
|
|
|
m_realtimeCfg.clear(); |
|
|
|
|
|
|
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
auto allrealtimesetting = SETTING_DB->getRealtimeSetting(); |
|
|
for (auto& setting : allrealtimesetting) { |
|
|
for (auto& setting : allrealtimesetting) { |
|
|
m_realtimeCfg[string(setting->setting_id)] = m_defaultFormulaJson[string(setting->setting_id)]; |
|
|
m_realtimeCfg[string(setting->setting_id)] = m_defaultFormulaJson[string(setting->setting_id)]; |
|
@ -66,12 +70,38 @@ void DisinfectionCtrlService::fn_getRealtimeConfig(shared_ptr<MsgProcessContext> |
|
|
} |
|
|
} |
|
|
void DisinfectionCtrlService::fn_setRealtimeConfig(shared_ptr<MsgProcessContext> cxt) { |
|
|
void DisinfectionCtrlService::fn_setRealtimeConfig(shared_ptr<MsgProcessContext> cxt) { |
|
|
string key = cxt->params["key"]; |
|
|
string key = cxt->params["key"]; |
|
|
string val = cxt->params["val"]; |
|
|
|
|
|
|
|
|
string val = cxt->params; |
|
|
m_realtimeCfg[key] = val; |
|
|
m_realtimeCfg[key] = val; |
|
|
} |
|
|
} |
|
|
void DisinfectionCtrlService::fn_getState(shared_ptr<MsgProcessContext> cxt) { |
|
|
void DisinfectionCtrlService::fn_getState(shared_ptr<MsgProcessContext> cxt) { |
|
|
json& rely = cxt->content; |
|
|
|
|
|
rely["statedisplayName"] = disinfectionState2DisplayName(m_state); |
|
|
|
|
|
rely["state"] = toString(m_state); |
|
|
|
|
|
|
|
|
json& rely = cxt->content; |
|
|
|
|
|
rely["statedisplayName"] = disinfectionState2DisplayName(m_state); |
|
|
|
|
|
rely["state"] = toString(m_state); |
|
|
|
|
|
rely["curStateRemainTimeS"] = 60; |
|
|
|
|
|
rely["tlog"] = "12.0"; |
|
|
|
|
|
rely["nlog"] = "3.0"; |
|
|
|
|
|
|
|
|
|
|
|
json sensordata; |
|
|
|
|
|
sensordata[0]["h2o2"] = 11.1; |
|
|
|
|
|
sensordata[0]["temp"] = 12.2; |
|
|
|
|
|
sensordata[0]["rh"] = 13.3; |
|
|
|
|
|
sensordata[0]["rs"] = 14.4; |
|
|
|
|
|
|
|
|
|
|
|
sensordata[1]["h2o2"] = 21.1; |
|
|
|
|
|
sensordata[1]["temp"] = 22.2; |
|
|
|
|
|
sensordata[1]["rh"] = 23.3; |
|
|
|
|
|
sensordata[1]["rs"] = 24.4; |
|
|
|
|
|
|
|
|
|
|
|
sensordata[2]["h2o2"] = 31.1; |
|
|
|
|
|
sensordata[2]["temp"] = 32.2; |
|
|
|
|
|
sensordata[2]["rh"] = 33.3; |
|
|
|
|
|
sensordata[2]["rs"] = 34.4; |
|
|
|
|
|
|
|
|
|
|
|
rely["h2o2SensorData"] = sensordata; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
|
|
json& rely = cxt->content; |
|
|
|
|
|
rely["curveNum"] = 3; |
|
|
|
|
|
rely["updatePeriodMs"] = 5000; |
|
|
} |
|
|
} |
|
|
void DisinfectionCtrlService::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) { json& rely = cxt->content; } |
|
|
|