10 changed files with 161 additions and 9 deletions
-
2appsrc/appbase/appbean/dm_gas_path.cpp
-
11appsrc/appbase/appbean/dm_gas_path.hpp
-
2appsrc/appconfig/basic/zappversion.hpp
-
29appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
-
2appsrc/service/app_core.cpp
-
1appsrc/service/app_core.hpp
-
58appsrc/service/dm_gas_path_mgr_service.cpp
-
34appsrc/service/dm_gas_path_mgr_service.hpp
-
0appsrc/service/hardware/dm_exch_selector_driver.cpp
-
31appsrc/service/hardware/dm_exch_selector_driver.hpp
@ -0,0 +1,2 @@ |
|||
#include "dm_gas_path.hpp"
|
|||
DMGasPath_ZENUM_IMPL |
@ -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); |
@ -1,3 +1,3 @@ |
|||
#pragma once
|
|||
#define VERSION "3.2.2"
|
|||
#define VERSION "3.2.3"
|
|||
#define PROJECT_NAME "TRANSMIT_DM"
|
@ -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(); |
|||
} |
@ -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,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
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue