|
|
@ -133,29 +133,48 @@ void MainControlService::initialize() { |
|
|
|
ThisThread thisThread; |
|
|
|
while (!thisThread.getExitFlag()) { |
|
|
|
json report; |
|
|
|
report["command"] = "RealtimeSensorDataReport"; |
|
|
|
report["sensor_data"]["heating_strip"] = 1; |
|
|
|
report["sensor_data"]["air_compressor"] = 0; |
|
|
|
report["sensor_data"]["sprinkler_pump"] = 1; |
|
|
|
report["sensor_data"]["disinfectant_volume"] = 99; |
|
|
|
report["sensor_data"]["h2o2_1"] = 10; |
|
|
|
report["sensor_data"]["temp_1"] = 11; |
|
|
|
report["sensor_data"]["humid_1"] = 12; |
|
|
|
report["sensor_data"]["saturation_1"] = 13; |
|
|
|
report["sensor_data"]["h2o2_2"] = 14; |
|
|
|
report["sensor_data"]["temp_2"] = 15; |
|
|
|
report["sensor_data"]["humid_2"] = 16; |
|
|
|
report["sensor_data"]["saturation_2"] = 17; |
|
|
|
report["sensor_data"]["h2o2_3"] = 18; |
|
|
|
report["sensor_data"]["temp_3"] = 19; |
|
|
|
report["sensor_data"]["humid_3"] = 20; |
|
|
|
report["sensor_data"]["saturation_3"] = 21; |
|
|
|
report["command"] = "RealtimeSensorDataReport"; |
|
|
|
report["sensor_data"] = createSensorDataJson(); |
|
|
|
m_iflytopwsService->sendReport(report); |
|
|
|
thisThread.sleepForMs(1000); |
|
|
|
} |
|
|
|
})); |
|
|
|
}; |
|
|
|
|
|
|
|
json MainControlService::createSensorDataJson() { |
|
|
|
json report; |
|
|
|
|
|
|
|
report["airCompressor"]["io1"] = 1; |
|
|
|
report["airCompressor"]["io2"] = 0; |
|
|
|
report["airCompressor"]["currentVal"] = 2.2; |
|
|
|
|
|
|
|
report["airBlower"]["io1"] = 1; |
|
|
|
report["airBlower"]["io2"] = 0; |
|
|
|
report["airBlower"]["currentVal"] = 2.2; |
|
|
|
|
|
|
|
report["heatingStrip"]["io1"] = 1; |
|
|
|
report["heatingStrip"]["io2"] = 0; |
|
|
|
report["heatingStrip"]["currentVal"] = 2.2; |
|
|
|
|
|
|
|
report["sprinklerPump"] = 1000; |
|
|
|
report["chargingPump"] = 999; |
|
|
|
|
|
|
|
report["disinfectant_volume"] = 99; |
|
|
|
report["h2o2_1"] = 10; |
|
|
|
report["temp_1"] = 11; |
|
|
|
report["humid_1"] = 12; |
|
|
|
report["saturation_1"] = 13; |
|
|
|
report["h2o2_2"] = 14; |
|
|
|
report["temp_2"] = 15; |
|
|
|
report["humid_2"] = 16; |
|
|
|
report["saturation_2"] = 17; |
|
|
|
report["h2o2_3"] = 18; |
|
|
|
report["temp_3"] = 19; |
|
|
|
report["humid_3"] = 20; |
|
|
|
report["saturation_3"] = 21; |
|
|
|
return report; |
|
|
|
} |
|
|
|
|
|
|
|
void MainControlService::processFrontEndMessage(weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) { |
|
|
|
#if 0
|
|
|
|
//login
|
|
|
@ -281,6 +300,49 @@ void MainControlService::processFrontEndMessage(weak_ptr<WebSocket> webSocket, j |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
#if 0
|
|
|
|
//开始加液
|
|
|
|
{ |
|
|
|
"command":"startReplenishingFluids", |
|
|
|
} |
|
|
|
//停止加液
|
|
|
|
{ |
|
|
|
"command":"stopReplenishingFluids", |
|
|
|
} |
|
|
|
//开始排液
|
|
|
|
{ |
|
|
|
"command":"startDraining", |
|
|
|
} |
|
|
|
//停止排液
|
|
|
|
{ |
|
|
|
"command":"stopDraining", |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
if (cmdstr == "startReplenishingFluids") { |
|
|
|
logger->info("startReplenishingFluids"); |
|
|
|
m_disinfectionCtrlService->startReplenishingFluids(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (cmdstr == "stopReplenishingFluids") { |
|
|
|
logger->info("stopReplenishingFluids"); |
|
|
|
m_disinfectionCtrlService->stopReplenishingFluids(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (cmdstr == "startDraining") { |
|
|
|
logger->info("startDraining"); |
|
|
|
m_disinfectionCtrlService->startDraining(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (cmdstr == "stopDraining") { |
|
|
|
logger->info("stopDraining"); |
|
|
|
m_disinfectionCtrlService->stopDraining(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* getState * |
|
|
|
*******************************************************************************/ |
|
|
@ -291,6 +353,7 @@ void MainControlService::processFrontEndMessage(weak_ptr<WebSocket> webSocket, j |
|
|
|
receipt["state"]["workState"] = m_disinfectionCtrlService->isDisinfectionRunning(); |
|
|
|
receipt["state"]["estimatedRemainingTimeS"] = m_disinfectionCtrlService->getEstimatedRemainingTimeS(); |
|
|
|
receipt["state"]["disinfection_id"] = m_disinfectionCtrlService->getDisinfectionID(); |
|
|
|
receipt["state"]["sensor_data"] = createSensorDataJson(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|