Browse Source

v3.2.3

try_support_dt100n
zhaohe 4 weeks ago
parent
commit
9fe61f6bb0
  1. 2
      appsrc/appbase/appbean/dm_gas_path.cpp
  2. 11
      appsrc/appbase/appbean/dm_gas_path.hpp
  3. 2
      appsrc/appconfig/basic/zappversion.hpp
  4. 29
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
  5. 2
      appsrc/service/app_core.cpp
  6. 1
      appsrc/service/app_core.hpp
  7. 58
      appsrc/service/dm_gas_path_mgr_service.cpp
  8. 34
      appsrc/service/dm_gas_path_mgr_service.hpp
  9. 0
      appsrc/service/hardware/dm_exch_selector_driver.cpp
  10. 31
      appsrc/service/hardware/dm_exch_selector_driver.hpp

2
appsrc/appbase/appbean/dm_gas_path.cpp

@ -0,0 +1,2 @@
#include "dm_gas_path.hpp"
DMGasPath_ZENUM_IMPL

11
appsrc/appbase/appbean/dm_gas_path.hpp

@ -0,0 +1,11 @@
#pragma once
#include "iflytop/core/components/zenum_template/zenum_template.hpp"
#define DMGasPath_ZENUM_IMPL ZENUM_IMPL(DMGasPath, DMGasPath_LIST)
#define DMGasPath_LIST(type, marco) /**/ \
marco(type, disinfection) /*消毒*/ \
marco(type, degradation) /*降解*/ \
marco(type, dehumidification) /*除湿*/
ZENUM_DECLAR(DMGasPath, DMGasPath_LIST);

2
appsrc/appconfig/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once
#define VERSION "3.2.2"
#define VERSION "3.2.3"
#define PROJECT_NAME "TRANSMIT_DM"

29
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp

@ -154,9 +154,9 @@ void IflytopFrontEndService::onMessageCallback(weak_ptr<WebSocket> webSocket, sh
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");
logger->info("WebSocket ping received");
} else if (msg->type == ix::WebSocketMessageType::Pong) {
logger->debug("WebSocket pong received");
logger->info("WebSocket pong received");
} else {
logger->warn("Unknown WebSocket message type: {}", static_cast<int>(msg->type));
}
@ -165,6 +165,10 @@ void IflytopFrontEndService::processRxMessage(weak_ptr<WebSocket> webSocket, str
string msgtext = rxmsg;
json message;
if (rxmsg == "{\"type\":\"ping\"}") {
return;
}
try {
shared_ptr<WebSocket> ws = webSocket.lock();
if (!ws) {
@ -174,13 +178,22 @@ void IflytopFrontEndService::processRxMessage(weak_ptr<WebSocket> webSocket, str
json command = json::parse(msgtext);
json receipt;
receipt["messageId"] = command["messageId"];
receipt["ackcode"] = 0;
receipt["messageType"] = "Ack";
receipt["timeStamp"] = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
try {
onMessage(webSocket, command, receipt);
ws->sendText(receipt.dump(1));
if (command["messageType"] == "Ping") {
receipt["messageType"] = "Pong";
receipt["messageId"] = command["messageId"];
receipt["timeStamp"] = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
ws->sendText(receipt.dump());
} else {
receipt["messageId"] = command["messageId"];
receipt["ackcode"] = 0;
receipt["messageType"] = "Ack";
receipt["timeStamp"] = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
onMessage(webSocket, command, receipt);
ws->sendText(receipt.dump(1));
}
} catch (const detail::parse_error& e) {
// json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);

2
appsrc/service/app_core.cpp

@ -56,6 +56,7 @@ void AppCore::initialize() {
REG_ENUM_TYPE(ProjectTypeEnum, ProjectTypeEnum::getEnumStrList());
REG_ENUM_TYPE(H2O2SensorType, H2O2SensorType::getEnumStrList());
REG_ENUM_TYPE(PressureUint, PressureUint::getEnumStrList());
REG_ENUM_TYPE(DMGasPath, DMGasPath::getEnumStrList());
installEcodeInfo();
@ -100,6 +101,7 @@ void AppCore::initialize() {
BUILD_AND_REG_SERRVICE(H2O2SensorMgr);
//
BUILD_AND_REG_SERRVICE(DMGasPathMgrService);
BUILD_AND_REG_SERRVICE(PipelinePressureControl);
BUILD_AND_REG_SERRVICE(UDiskMgrService);
//

1
appsrc/service/app_core.hpp

@ -17,6 +17,7 @@
#include "appconfig/appconfig.hpp"
#include "baseservice/front_msg_processer/front_msg_processer.hpp"
#include "service/hardware/device_io_ctrl_service.hpp"
#include "service/dm_gas_path_mgr_service.hpp"
/**
* @brief

58
appsrc/service/dm_gas_path_mgr_service.cpp

@ -0,0 +1,58 @@
#include "dm_gas_path_mgr_service.hpp"
using namespace iflytop;
#define RECORD_PERIOD 3000 // 1 second
void DMGasPathMgrService::initialize() {
// 注册所有的H2O2传感器
//
stateUpdateThread.reset(new Thread("FERDC-stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
stateUpdateThreadFunc();
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
}
ThisThread().sleepForMs(RECORD_PERIOD);
}
}));
AppEventBus::ins()->onEvent.connect([this](shared_ptr<IAppEvent> event) {
if (dynamic_pointer_cast<AppLoginEvent>(event)) {
stateUpdateThread->wake();
}
});
REG_CLASS("气路通道控制服务");
REG_EXTFN(selectChannel, void(DMGasPath), dmGasPath);
REG_EXTFN_DISPNAME(selectChannel, "选择通道");
}
/**
* @brief
*/
void DMGasPathMgrService::stateUpdateThreadFunc() {
ThisThread thisThread;
std::lock_guard<std::recursive_mutex> lock(lock_);
json report;
report["gasPathSwitcher"]["isOnline"] = isOnline;
report["path"] = dmGasPath;
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", report);
}
void DMGasPathMgrService::setOnlineState(shared_ptr<MsgProcessContext> cxt, bool isOnline) {
std::lock_guard<std::recursive_mutex> lock(lock_);
logger->info("setOnlineState:{}", isOnline);
this->isOnline = isOnline;
}
void DMGasPathMgrService::selectChannel(shared_ptr<MsgProcessContext> cxt, DMGasPath dmGasPath) {
std::lock_guard<std::recursive_mutex> lock(lock_);
logger->info("selectChannel:{}", dmGasPath.toString());
this->dmGasPath = dmGasPath;
stateUpdateThread->wake();
}

34
appsrc/service/dm_gas_path_mgr_service.hpp

@ -0,0 +1,34 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "appbase/appbean/dm_gas_path.hpp"
#include "baseservice/baseservice.hpp"
#include "service/hardware/disinfectant_weight_update_service.hpp"
namespace iflytop {
class DMGasPathMgrService : public enable_shared_from_this<DMGasPathMgrService> {
THISCLASS(DMGasPathMgrService);
unique_ptr<Thread> stateUpdateThread;
DMGasPath dmGasPath = DMGasPath::disinfection;
bool isOnline = false;
std::recursive_mutex lock_;
public:
void initialize();
private:
void selectChannel(shared_ptr<MsgProcessContext> cxt, DMGasPath dmGasPath);
void setOnlineState(shared_ptr<MsgProcessContext> cxt, bool isOnline);
void stateUpdateThreadFunc();
};
} // namespace iflytop

0
appsrc/service/hardware/dm_exch_selector_driver.cpp

31
appsrc/service/hardware/dm_exch_selector_driver.hpp

@ -0,0 +1,31 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "baseservice/baseservice.hpp"
#include "baseservice/db/device_ext_setting_dao.hpp"
#include "device_io_ctrl_service.hpp"
namespace iflytop {
using namespace std;
class ExChSelectorCtrlService {
private:
/* data */
public:
ExChSelectorCtrlService(/* args */);
~ExChSelectorCtrlService();
void initialize();
};
} // namespace iflytop
Loading…
Cancel
Save