Browse Source

v2.4.0| 默认打开所有上报 无法停止上报

master
zhaohe 1 month ago
parent
commit
e59f4cd0d5
  1. 2
      appsrc/appconfig/basic/zappversion.hpp
  2. 33
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
  3. 1
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp
  4. 61
      appsrc/service/app/add_liquid_service.cpp
  5. 64
      appsrc/service/app/air_leak_detect_test.cpp
  6. 32
      appsrc/service/app/disinfection_ctrl_service_ext.cpp
  7. 59
      appsrc/service/app/drain_liquid_service.cpp
  8. 57
      appsrc/service/app/pipeline_pressure_control.cpp
  9. 56
      appsrc/service/app_core.cpp
  10. 18
      appsrc/service/front_end_realtime_display_content_mgr.cpp
  11. 1
      appsrc/service/front_end_realtime_display_content_mgr.hpp
  12. 23
      html/debug/index.html

2
appsrc/appconfig/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once
#define VERSION "2.3.5"
#define VERSION "2.4.0"
#define PROJECT_NAME "TRANSMIT_DM"

33
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp

@ -78,7 +78,7 @@ void IflytopFrontEndService::sendReport(json reportType, json report) {
auto clients = m_reportServer->getClients();
for (auto& each : clients) {
each->sendText(report.dump());
each->sendText(report.dump());
}
auto serverClients = m_server->getClients();
for (auto& each : serverClients) {
@ -92,7 +92,7 @@ void IflytopFrontEndService::sendClassReport(string fromclass, string fromfn, co
json report;
report["fromClass"] = fromclass;
report["fromFn"] = fromfn;
report["rely"] = rely;
report["rely"] = rely;
sendReport("classReport", report);
}
@ -112,8 +112,6 @@ void IflytopFrontEndService::onMessageCallback(weak_ptr<WebSocket> webSocket, sh
logger->info(" {}: {}", it.first, it.second);
}
// m_workQueue->enQueue([this, webSocket]() { onConnect(webSocket); });
} else if (msg->type == ix::WebSocketMessageType::Message) {
logger->debug("downlink msg: {}", msg->str);
string msgtext = msg->str;
@ -126,12 +124,21 @@ void IflytopFrontEndService::onMessageCallback(weak_ptr<WebSocket> webSocket, sh
logger->error("catch exception,processRxMessage error: {}", e.what());
}
logger->debug("<-------------process rx end\n");
});
} else if (msg->type == ix::WebSocketMessageType::Close) {
logger->info("{} Closed connection", msg->closeInfo.remote);
// m_workQueue->enQueue([this, webSocket]() { onDisconnect(webSocket); });
logger->info("{} Closed connection", connectionState->getRemoteIp(), msg->closeInfo.reason);
} else if (msg->type == ix::WebSocketMessageType::Error) {
logger->error("WebSocket Error : {}", msg->errorInfo.reason);
logger->error(" #retries : {}", msg->errorInfo.retries);
logger->error(" Wait time(ms) : {}", msg->errorInfo.wait_time);
logger->error(" HTTP Status : {}", msg->errorInfo.http_status);
} else if (msg->type == ix::WebSocketMessageType::Ping) {
logger->debug("WebSocket ping received");
} else if (msg->type == ix::WebSocketMessageType::Pong) {
logger->debug("WebSocket pong received");
} else {
logger->warn("Unknown WebSocket message type: {}", static_cast<int>(msg->type));
}
}
void IflytopFrontEndService::processRxMessage(weak_ptr<WebSocket> webSocket, string rxmsg) {
@ -157,36 +164,36 @@ void IflytopFrontEndService::processRxMessage(weak_ptr<WebSocket> webSocket, str
} catch (const detail::parse_error& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1));
} catch (const detail::invalid_iterator& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1));
} catch (const detail::type_error& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1));
} catch (const detail::out_of_range& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1));
} catch (const detail::other_error& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcode"] = err::kappe_parse_json_err;
receipt["message"] = ecode2str(err::kappe_parse_json_err);
ws->sendText(receipt.dump(1));
} catch (const std::exception& e) {
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_std_exception;
receipt["ackcode"] = err::kappe_std_exception;
receipt["message"] = ecode2str(err::kappe_std_exception) + "," + e.what();
ws->sendText(receipt.dump(1));
}

1
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp

@ -57,6 +57,7 @@ class IflytopFrontEndService : public enable_shared_from_this<IflytopFrontEndSer
private:
void onMessageCallback(weak_ptr<WebSocket> webSocket, shared_ptr<ConnectionState> connectionState, const ix::WebSocketMessagePtr& msg);
void processRxMessage(weak_ptr<WebSocket> webSocket, string rxmsg);
};
} // namespace iflytop

61
appsrc/service/app/add_liquid_service.cpp

@ -7,16 +7,32 @@ using namespace iflytop;
void AddLiquidService::initialize() {
logger->info("AddLiquidService initialize");
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN(start, void(int), stopatg);
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
if (PORT.isDT600N() || PORT.isDT300N() || PORT.isDT300W()) {
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN(start, void(int), stopatg);
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
} else {
logger->warn("AddLiquidService is not supported on this device type, {}", PORT.getProjTypeString());
}
}
void AddLiquidService::start(int stopatg) {
@ -175,29 +191,8 @@ void AddLiquidService::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
void AddLiquidService::getState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = getState(); }
void AddLiquidService::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
}
void AddLiquidService::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
}
void AddLiquidService::startStateReport(shared_ptr<MsgProcessContext> cxt) {}
void AddLiquidService::stopStateReport(shared_ptr<MsgProcessContext> cxt) {}
json AddLiquidService::getState() {
json state;
state["workState"] = state2str(getWorkstate());

64
appsrc/service/app/air_leak_detect_test.cpp

@ -8,19 +8,31 @@ using namespace iflytop;
void AirLeakDetectTest::initialize() {
logger->info("AirLeakDetectTest initialize");
GET_TO_SERVICE(m_ds)
GET_TO_SERVICE(m_dics)
REG_EXTFN(start, void(int), inflationTimeMs);
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
if (PORT.isDT300W()) {
GET_TO_SERVICE(m_ds)
GET_TO_SERVICE(m_dics)
REG_EXTFN(start, void(int), inflationTimeMs);
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
} else {
logger->warn("AirLeakDetectTest is not supported on this device type, {}", PORT.getProjTypeString());
}
}
#define FORCE_DO
void AirLeakDetectTest::start(int inflationTimeMs) {
logger->info("AirLeakDetectTest start");
auto nowstate = m_ds->getDeviceState();
@ -136,37 +148,13 @@ void AirLeakDetectTest::getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
//
void AirLeakDetectTest::getState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = getState(); }
void AirLeakDetectTest::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
}
void AirLeakDetectTest::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
}
void AirLeakDetectTest::startStateReport(shared_ptr<MsgProcessContext> cxt) {}
void AirLeakDetectTest::stopStateReport(shared_ptr<MsgProcessContext> cxt) {}
json AirLeakDetectTest::getState() {
json state;
if (getWorkstate() == kidle) {
pressurePa = m_dics->ACPostPS_readPa();
}
state["pressure"] = pressurePa / 1000.0;
state["workState"] = state2str(getWorkstate());
state["workStateDisplay"] = state2chstr(getWorkstate());

32
appsrc/service/app/disinfection_ctrl_service_ext.cpp

@ -50,6 +50,15 @@ void DisinfectionCtrlServiceExt::initialize() {
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
DisinfectionState state;
json report = getState(state);
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", report);
ThisThread().sleepForMs(500);
}
}));
}
void DisinfectionCtrlServiceExt::start(shared_ptr<MsgProcessContext> cxt, string loglevel) {
@ -130,24 +139,5 @@ void DisinfectionCtrlServiceExt::getServiceConfig(shared_ptr<MsgProcessContext>
rely["curveNum"] = PORT.getExtH2O2SensorNum() + 1;
rely["curveUpdatePeriodMs"] = 10000;
}
void DisinfectionCtrlServiceExt::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
DisinfectionState state;
json report = getState(state);
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", report);
ThisThread().sleepForMs(500);
}
}));
}
void DisinfectionCtrlServiceExt::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
}
void DisinfectionCtrlServiceExt::startStateReport(shared_ptr<MsgProcessContext> cxt) {}
void DisinfectionCtrlServiceExt::stopStateReport(shared_ptr<MsgProcessContext> cxt) {}

59
appsrc/service/app/drain_liquid_service.cpp

@ -5,16 +5,31 @@ using namespace iflytop;
void DrainLiquidService::initialize() {
logger->info("DrainLiquidService initialize");
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN_VOID(start, void());
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
if (PORT.isDT600N() || PORT.isDT300N() || PORT.isDT300W()) {
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
GET_TO_SERVICE(m_dwus);
REG_EXTFN_VOID(start, void());
REG_EXTFN_VOID(stop, void());
REG_EXTFN_VOID(getState, void());
REG_EXTFN_VOID(getServiceConfig, void());
REG_EXTFN_VOID(startStateReport, void());
REG_EXTFN_VOID(stopStateReport, void());
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
} else {
logger->warn("DrainLiquidService is not supported on this device");
}
}
void DrainLiquidService::start() {
@ -133,28 +148,8 @@ void DrainLiquidService::workThread() {
void DrainLiquidService::getState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = getState(); }
void DrainLiquidService::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
}
void DrainLiquidService::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread && !stateUpdateThread->getExitFlag()) {
stateUpdateThread->stopNoBlock();
}
}
void DrainLiquidService::startStateReport(shared_ptr<MsgProcessContext> cxt) {}
void DrainLiquidService::stopStateReport(shared_ptr<MsgProcessContext> cxt) {}
json DrainLiquidService::getState() {
json state;
state["workState"] = state2str(getWorkstate());

57
appsrc/service/app/pipeline_pressure_control.cpp

@ -15,23 +15,25 @@ static bool isInStrings(const string& s, const vector<string>& v) {
}
void PipelinePressureControl::initialize() {
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
REG_ENUM_TYPE(PressureType, PressureType::getEnumStrList());
if (PORT.isDT300W()) {
GET_TO_SERVICE(m_ds);
GET_TO_SERVICE(m_dics);
REG_ENUM_TYPE(PressureType, PressureType::getEnumStrList());
REG_EXTFN(setType, void(PressureType), type);
REG_EXTFN(setIntensity, void(int), intensity);
REG_EXTFN_VOID(getState, void(void));
REG_EXTFN_VOID(getConfig, void(void));
// REG_EXTFN_VOID(startStateReport, void());
// REG_EXTFN_VOID(stopStateReport, void());
REG_EXTFN(setType, void(PressureType), type);
REG_EXTFN(setIntensity, void(int), intensity);
REG_EXTFN_VOID(getState, void(void));
REG_EXTFN_VOID(getConfig, void(void));
m_type = PressureType::constantPressure;
m_intensity = 0;
try {
syncPressureValueState();
} catch (const appexception& e) {
logger->error("syncPressureValueState error:{}", e.what());
m_type = PressureType::constantPressure;
m_intensity = 0;
try {
syncPressureValueState();
} catch (const appexception& e) {
logger->error("syncPressureValueState error:{}", e.what());
}
} else {
logger->warn("PipelinePressureControl is not supported on this device type, {}", PORT.getProjTypeString());
}
}
@ -89,31 +91,6 @@ void PipelinePressureControl::setIntensity(shared_ptr<MsgProcessContext> cxt, in
syncPressureValueState();
}
void PipelinePressureControl::getState(shared_ptr<MsgProcessContext> cxt) { cxt->rely = getState(); }
#if 0
void PipelinePressureControl::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(500);
}
}));
}
void PipelinePressureControl::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
}
#endif
json PipelinePressureControl::getState() {
json state;
state["type"] = m_type;

56
appsrc/service/app_core.cpp

@ -215,6 +215,20 @@ void AppCore::initialize() {
REG_EXTFN(appEventConfirm, void(string), evenid);
REG_EXTFN_VOID(startStateReport, void(void));
REG_EXTFN_VOID(stopStateReport, void(void));
//
//
//
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(1000);
}
}));
};
int AppCore::demofn(int a, int b) { return 0; }
@ -280,43 +294,5 @@ json AppCore::getState() {
return ret;
}
void AppCore::startStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
// logger->info("start report");
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(1000);
// logger->info("end report");
// ThisThread().sleepForMs(1);
}
}));
// stateUpdateThread2.reset(new Thread("stateUpdateThread", [this]() {
// while (!ThisThread().getExitFlag()) {
// logger->info("start report");
// try {
// SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
// } catch (const std::exception& e) {
// logger->error("stateUpdateThread error:{}", e.what());
// }
// logger->info("end report");
// ThisThread().sleepForMs(1);
// }
// }));
}
void AppCore::stopStateReport(shared_ptr<MsgProcessContext> cxt) {
if (stateUpdateThread) {
stateUpdateThread->join();
stateUpdateThread = nullptr;
}
}
void AppCore::startStateReport(shared_ptr<MsgProcessContext> cxt) {}
void AppCore::stopStateReport(shared_ptr<MsgProcessContext> cxt) {}

18
appsrc/service/front_end_realtime_display_content_mgr.cpp

@ -6,9 +6,21 @@ using namespace iflytop;
void FrontEndRealtimeDisplayContentMgr::initialize() { //
REG_EXTFN_VOID(readH2O2SensorData, json());
REG_EXTFN_VOID(readH2O2SensorRawData, json());
unique_ptr<Thread> stateUpdateThread;
//
stateUpdateThread.reset(new Thread("stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", readH2O2SensorData());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(1000);
}
}));
}
void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcessContext> cxt) {
json FrontEndRealtimeDisplayContentMgr::readH2O2SensorData() {
auto h2o2Mgr = GET_SERVICE(DeviceIoControlService)->getH2O2SensorMgr();
// h2o2Mgr->getCacheData()
@ -34,9 +46,11 @@ void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcess
sensordata[2]["rs"] = !h2o2Mgr->isDataExpired(2) ? h2o2Mgr->getCacheData(2)->rs : -1;
}
cxt->rely["val"] = sensordata;
return sensordata;
}
void FrontEndRealtimeDisplayContentMgr::readH2O2SensorData(shared_ptr<MsgProcessContext> cxt) { cxt->rely["val"] = readH2O2SensorData(); }
void FrontEndRealtimeDisplayContentMgr::readH2O2SensorRawData(shared_ptr<MsgProcessContext> cxt) {
auto h2o2Mgr = GET_SERVICE(DeviceIoControlService)->getH2O2SensorMgr();

1
appsrc/service/front_end_realtime_display_content_mgr.hpp

@ -20,6 +20,7 @@ class FrontEndRealtimeDisplayContentMgr : public enable_shared_from_this<FrontEn
void initialize();
private:
json readH2O2SensorData();
void readH2O2SensorData(shared_ptr<MsgProcessContext> cxt);
void readH2O2SensorRawData(shared_ptr<MsgProcessContext> cxt);
};

23
html/debug/index.html

@ -117,6 +117,9 @@
ws: null,
wsMessageIndex: 0,
requests: {},
reportId: 0,
map: new Map(),
counter: 0
}
},
computed: {
@ -128,6 +131,17 @@
},
methods: {
// connect
getReportId(str) {
// 如果字符串已存在,返回已存储的id
if (this.map.has(str)) {
return this.map.get(str);
}
// 否则,生成一个新的ID
const id = this.counter++;
this.map.set(str, id);
return id;
},
actionConnect() {
this.ws = new WebSocket(this.wsUrl);
this.ws.onclose = () => this.ws = null;
@ -143,10 +157,10 @@
this.logs.push(responseEntry);
}
if ('Report' === data.messageType) {
this.reports.unshift(responseEntry);
if (this.reports.length > 100) {
this.reports.pop();
}
let reportuuid = data.fromClass + '.' + data.fromFn;
let reportId = this.getReportId(reportuuid);
// this.reports.unshift(reportId,responseEntry);
this.reports[reportId] = responseEntry;
}
};
@ -263,6 +277,7 @@
this.wsCall(request);
},
// ws call
wsCall(request) {
if (null === this.ws) {

Loading…
Cancel
Save