Browse Source

recode

storage-in-realtime
zhaohe 12 months ago
parent
commit
09bc958ac9
  1. 16
      appsrc/appbase/appbasedep.hpp
  2. 6
      appsrc/appbase/appbean/hardware_component.hpp
  3. 29
      appsrc/appbase/dep.hpp
  4. 14
      appsrc/appbase/disinfection_snapshot.hpp
  5. 2
      appsrc/appcomponents/canchannel/transmit_disinfection_can_master.cpp
  6. 10
      appsrc/appcomponents/canchannel/transmit_disinfection_can_master.hpp
  7. 3
      appsrc/appsetting/appsetting.hpp
  8. 25
      appsrc/appsetting/project_setting/basic/componentid.hpp
  9. 5
      appsrc/appsetting/project_setting/basic/gconfig.hpp
  10. 16
      appsrc/appsetting/project_setting/basic/project_constant.hpp
  11. 68
      appsrc/appsetting/project_setting/component_id_mgr.cpp
  12. 0
      appsrc/appsetting/project_setting/component_id_mgr.hpp
  13. 47
      appsrc/appsetting/project_setting/project_setting.hpp
  14. 1
      appsrc/appsetting/project_setting/project_setting_mgr.cpp
  15. 47
      appsrc/appsetting/project_setting/project_setting_mgr.hpp
  16. 4
      appsrc/baseservice/db/setting_db_dao.hpp
  17. 2
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp
  18. 2
      appsrc/baseservice/udisk_mgr_service.hpp
  19. 1
      appsrc/main.cpp
  20. 26
      appsrc/service/app/air_tightness_test.cpp
  21. 2
      appsrc/service/app/air_tightness_test.hpp
  22. 2
      appsrc/service/disinfection_logs_service.hpp
  23. 55
      appsrc/service/hardware/base/component_id_mgr.cpp
  24. 41
      appsrc/service/hardware/base/component_id_mgr.hpp
  25. 13
      appsrc/service/hardware/device_ctrl_service.cpp
  26. 10
      appsrc/service/hardware/device_ctrl_service.hpp
  27. 3
      appsrc/service/main_control_service.cpp
  28. 1
      appsrc/service/main_control_service.hpp

16
appsrc/appbase/appbasedep.hpp

@ -0,0 +1,16 @@
#pragma once
#include "iflytop/core/components/jobs/work_queue.hpp"
#include "iflytop/core/components/stringutils.hpp"
#include "iflytop/core/components/timeutils.hpp"
#include "iflytop/core/core.hpp"
#include "iflytop/core/utils/uuid/uuid.hpp"
//
#include "app_protocols/apperrorcode/apperrorcode.hpp"
#include "app_protocols/appexception/appexception.hpp"
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
//
#include "components/sqlite_orm/sqlite_orm.hpp"
#include "components/uart_printer/uart_printer.hpp"
#include "components/zservice_container/zservice_container.hpp"

6
appsrc/appbase/appbean/hardware_component.hpp

@ -12,12 +12,14 @@
marco(type, WarningLight) /**/ \
marco(type, PositivePressureProportional) /**/ \
marco(type, NegativePressureProportional) /**/ \
marco(type, LeakDetectTest) /**/ \
marco(type, AirLeakDetectTestAC) /**/ \
marco(type, AirLeakDetectTestChannelCtrl) /**/ \
marco(type, ExtChSelector) /**/ \
marco(type, EvaporationBinWS) /**/ \
marco(type, DeviceBottomWS) /**/ \
marco(type, MainH2O2Sensor) /**/ \
marco(type, LeakDetectPS) /**/ \
marco(type, ACPostPS) /**/ \
marco(type, AirLeakDetectPS) /**/ \
marco(type, LiquidWeightPS) /**/ \
marco(type, SprayPumpPostPS) /**/ \
marco(type, AddLiquidPumpPostPS) /**/

29
appsrc/appbase/dep.hpp

@ -1,23 +1,14 @@
#pragma once
#include "iflytop/core/components/jobs/work_queue.hpp"
#include "iflytop/core/components/stringutils.hpp"
#include "iflytop/core/components/timeutils.hpp"
#include "iflytop/core/core.hpp"
#include "iflytop/core/utils/uuid/uuid.hpp"
//
#include "app_protocols/apperrorcode/apperrorcode.hpp"
#include "app_protocols/appexception/appexception.hpp"
#include "appbasedep.hpp"
//
#include "components/sqlite_orm/sqlite_orm.hpp"
#include "components/uart_printer/uart_printer.hpp"
#include "components/zservice_container/zservice_container.hpp"
//
#include "gconfig.hpp"
#include "project_setting.hpp"
#include "project_setting_mgr.hpp"
#include "utils/zdictionary.hpp"
#include "disinfection_state.hpp"
#include "appbase/appbean/setting_id.hpp"
#include "appbean/pumpid.hpp"
#include "disinfection_state.hpp"
#include "utils/zdictionary.hpp"
#include "appbase/appbean/disinfection_record_csv_header.hpp"
#include "appbase/appbean/disinfection_state.hpp"
#include "appbase/appbean/hardware_component.hpp"
#include "appbase/appbean/setting_id.hpp"
#include "appbase/appbean/pumpid.hpp"
#include "appbase/appbean/test_page_iterm.hpp"

14
appsrc/appbase/disinfection_snapshot.hpp

@ -1,20 +1,20 @@
#pragma once
#include "appbean/disinfection_state.hpp"
#include "disinfection_state.hpp"
#include "iflytop/core/components/timeutils.hpp"
#include "project_setting.hpp"
namespace iflytop {
using namespace core;
class StateSnapshot {
public:
disinfection_state_t state;
zsystem_tp time;
DisinfectionState state;
zsystem_tp time;
int32_t h2o2[MAX_SUPPORT_SENSOR]; // ppm
int32_t humid[MAX_SUPPORT_SENSOR]; // %RH
int32_t temp[MAX_SUPPORT_SENSOR]; // °C
int32_t saturation[MAX_SUPPORT_SENSOR]; // %RS
int32_t h2o2[10]; // ppm
int32_t humid[10]; // %RH
int32_t temp[10]; // °C
int32_t saturation[10]; // %RS
int min_h2o2;
int max_h2o2;

2
appsrc/appcomponents/canchannel/transmit_disinfection_can_master.cpp

@ -86,7 +86,7 @@ int TransmitDisinfectionCanMaster::airCompressorReadEIAdcRaw(int boardid) { //
return rec->getContent(0);
}
int TransmitDisinfectionCanMaster::leakDetectTestACCtrl(int boardid, int32_t val) {
int TransmitDisinfectionCanMaster::airLeakDetectTestACCtrl(int boardid, int32_t val) {
auto rec = m_com->callcmd1(boardid, kfn_air_tightness_test_ac_ctrl, val);
return rec->getContent(0);
}

10
appsrc/appcomponents/canchannel/transmit_disinfection_can_master.hpp

@ -90,8 +90,8 @@ class TransmitDisinfectionCanMaster {
int airCompressorReadEIAdcRaw(int boardid);
int airCompressorIsOpen(int boardid) { return m_com->callcmd0(boardid, kfn_air_compressor_is_open, DEFUALT_OVERTIME)->getContent(0); }
int leakDetectTestACCtrl(int boardid, int32_t val);
int leakDetectTestACIsOpen(int boardid) { return m_com->callcmd0(boardid, kfn_air_tightness_test_ac_is_open, DEFUALT_OVERTIME)->getContent(0); }
int airLeakDetectTestACCtrl(int boardid, int32_t val);
int airLeakDetectTestACIsOpen(int boardid) { return m_com->callcmd0(boardid, kfn_air_tightness_test_ac_is_open, DEFUALT_OVERTIME)->getContent(0); }
/***********************************************************************************************************************
* heater *
@ -126,9 +126,9 @@ class TransmitDisinfectionCanMaster {
int proportionalIsBusy(int boardid, int valveId) { return m_com->callcmd1(boardid, kfn_proportional_is_busy, valveId, DEFUALT_OVERTIME)->getContent(0); }
// kfn_air_tightness_test_is_cutoff
void leakDetectTestCloseOffCh(int boardid) { m_com->callcmd0(boardid, kfn_air_tightness_test_cutoff_ch, DEFUALT_OVERTIME); }
void leakDetectTestReleaseCh(int boardid) { m_com->callcmd0(boardid, kfn_air_tightness_test_release_ch, DEFUALT_OVERTIME); }
int leakDetectTestIsCutoff(int boardid) { return m_com->callcmd0(boardid, kfn_air_tightness_test_is_cutoff, DEFUALT_OVERTIME)->getContent(0); }
void airLeakDetectTestCloseOffCh(int boardid) { m_com->callcmd0(boardid, kfn_air_tightness_test_cutoff_ch, DEFUALT_OVERTIME); }
void airLeakDetectTestReleaseCh(int boardid) { m_com->callcmd0(boardid, kfn_air_tightness_test_release_ch, DEFUALT_OVERTIME); }
int airLeakDetectTestIsCutoff(int boardid) { return m_com->callcmd0(boardid, kfn_air_tightness_test_is_cutoff, DEFUALT_OVERTIME)->getContent(0); }
void extChSelectorSetCh(int boardid, int ch) { m_com->callcmd1(boardid, kfn_ext_ch_selector_set_ch, ch, DEFUALT_OVERTIME); }
int extChSelectorGetCh(int boardid) { return m_com->callcmd0(boardid, kfn_ext_ch_selector_get_ch, DEFUALT_OVERTIME)->getContent(0); }

3
appsrc/appsetting/appsetting.hpp

@ -0,0 +1,3 @@
#pragma once
#include "project_setting/project_setting_mgr.hpp"

25
appsrc/appsetting/project_setting/basic/componentid.hpp

@ -0,0 +1,25 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include "appbase/appbasedep.hpp"
namespace iflytop {
using namespace std;
class ComponentId {
public:
ComponentId(int boardId, int subId) : boardId(boardId), subId(subId) {}
int boardId;
int subId;
};
} // namespace iflytop

5
appsrc/appbase/gconfig.hpp → appsrc/appsetting/project_setting/basic/gconfig.hpp

@ -13,11 +13,8 @@
#include <vector>
#include "iflytop/core/components/config_template/config_template.hpp"
#include "project_constant.hpp"
#define PROJECT_LARGE_SPACE_DM "LargeSpaceDM"
#define PROJECT_SMALL_SPACE_DM "SmallSpaceDM"
#define PROJECT_PIPE_DM "PipeDM"
#define PROJECT_DRAW_BAR_DM "DrawBarDM"
#define ConfigELEMENT_LIST(marco) \
marco(string /* */, deviceId, "") /*设备ID*/ \

16
appsrc/appbase/project_setting.hpp → appsrc/appsetting/project_setting/basic/project_constant.hpp

@ -1,23 +1,21 @@
#pragma once
#define LINUX_HARDWARE_ID (0x02)
#define VERSION "1.0.0"
#define PROJECT_NAME "TRANSMIT_DM"
#define PROJECT_LARGE_SPACE_DM "LargeSpaceDM"
#define PROJECT_SMALL_SPACE_DM "SmallSpaceDM"
#define PROJECT_PIPE_DM "PipeDM"
#define PROJECT_DRAW_BAR_DM "DrawBarDM"
/*******************************************************************************
* LINUX_HARDWARE_REG *
*******************************************************************************/
#define REG_REBOOT_FLAG 0x0000 // 重启标识
#define REG_DEVICE_ID 0x0001 // 重启标识
#define REG_EXCEPTION_FLAG 0x0100 // 异常标志位
#define EMTPTY_LINE_WHEN_DISINFECTION 60
#define MAX_DISINFECTIONLOGGER_FILE_NUM 10 // 最大日志文件数量
#define USER_BEHAVIOR_RECORD_DB_MAX_RECORDS 3000 //
#define SENSOR_PREHEART_TIME_S (5 * 60) // 传感器预热时间
#define VERSION "1.0.0"
#define PROJECT_NAME "TRANSMIT_DM"
#define MAX_SUPPORT_SENSOR 3
// GPM_TO_SPEED_RADIO

68
appsrc/appsetting/project_setting/component_id_mgr.cpp

@ -0,0 +1,68 @@
#include "component_id_mgr.hpp"
#if 0
using namespace std;
using namespace iflytop;
using namespace core;
#define HC HardwareComponent
#define INSERT(id, boardId, subId) m_componentIdMap.insert({id, {boardId, subId}})
void ComponentIdMgr::initialize() { //
auto projSet = PROJECT_SETTING;
if (projSet->isLageSpaceDM() || projSet->isSmallSpaceDM() || projSet->isPipeDM()) {
// 加液泵
INSERT(HardwareComponent::kAddLiquidPump, kFixBoardId_LiquidCtrl, kpumpid_add_liquid);
// 喷雾泵
INSERT(HardwareComponent::kSprayPump, kFixBoardId_LiquidCtrl, kpumpid_spray);
// 风机
INSERT(HardwareComponent::kBlower, kFixBoardId_PowerControl, 0);
// 空压机
INSERT(HardwareComponent::kAirCompressor, kFixBoardId_PowerControl, 0);
// 加热器
INSERT(HardwareComponent::kHeater, kFixBoardId_PowerControl, 0);
// 报警灯
INSERT(HardwareComponent::kWarningLight, kFixBoardId_LiquidCtrl, 0);
// 蒸发仓水浸
INSERT(HardwareComponent::kEvaporationBinWS, kFixBoardId_LiquidCtrl, 0);
// 底部水浸
INSERT(HardwareComponent::kDeviceBottomWS, kFixBoardId_LiquidCtrl, 0);
// 主H2O2传感器
INSERT(HardwareComponent::kMainH2O2Sensor, kFixBoardId_PowerControl, 0);
// 液体重量传感器
INSERT(HardwareComponent::kLiquidWeightPS, kFixBoardId_LiquidCtrl, 1);
// 空压机后压力传感器
INSERT(HardwareComponent::kACPostPS, kFixBoardId_LiquidCtrl, 0);
// 喷雾泵后压力传感器
INSERT(HardwareComponent::kSprayPumpPostPS, kFixBoardId_LiquidCtrl, 0);
// 加液泵后压力传感器
INSERT(HardwareComponent::kAddLiquidPumpPostPS, kFixBoardId_LiquidCtrl, 0);
if (projSet->isPipeDM()) {
// 正压比例阀
INSERT(HardwareComponent::kPositivePressureProportional, kFixBoardId_LiquidCtrl, POSITIVE_PRESSURE_PROPORTIONAL_ID);
// 负压比例阀
INSERT(HardwareComponent::kNegativePressureProportional, kFixBoardId_LiquidCtrl, NEGATIVE_PRESSURE_PROPORTIONAL_ID);
// 气密传感器
INSERT(HardwareComponent::kAirLeakDetectPS, kFixBoardId_LiquidCtrl, 0);
// 空气密度测试空压机
INSERT(HardwareComponent::kAirLeakDetectTestAC, kFixBoardId_LiquidCtrl, 0);
// 空气密度测试通道控制
INSERT(HardwareComponent::kAirLeakDetectTestChannelCtrl, kFixBoardId_LiquidCtrl, 0);
}
}
if (projSet->isDrawBarDM()) {
}
// 外部通道选择器
// INSERT(HardwareComponent::kExtChSelector, kFixBoardId_ExtChSelector, 0);
}
ComponentId ComponentIdMgr::getId(HardwareComponent component) {
auto it = m_componentIdMap.find(component);
if (it != m_componentIdMap.end()) {
return it->second;
}
THROW_APP_EXCEPTION(err::kappe_code_error, "ComponentIdMgr::getId: component not found");
}
#endif

0
appsrc/appsetting/project_setting/component_id_mgr.hpp

47
appsrc/appbase/project_setting_mgr.hpp → appsrc/appsetting/project_setting/project_setting.hpp

@ -1,25 +1,31 @@
#pragma once
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include "gconfig.hpp"
//
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
#include "appbase/appbasedep.hpp"
#include "appbase/appbean/hardware_component.hpp"
//
#include "basic/componentid.hpp"
#include "basic/gconfig.hpp"
#include "basic/project_constant.hpp"
namespace iflytop {
using namespace std;
using namespace transmit_disfection_protocol;
class ProjectSetting {
THISCLASS(ProjectSetting);
public:
map<int, ComponentId> m_componentIdMap;
string projectType = PROJECT_LARGE_SPACE_DM;
int projectTypeInt = klarge_space_disinfection_machine;
@ -39,31 +45,14 @@ class ProjectSetting {
bool isProjectType(int id0, int id1) { return id0 == projectTypeInt || id1 == projectTypeInt; }
bool isProjectType(int id0, int id1, int id2) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt; }
bool isProjectType(int id0, int id1, int id2, int id3) { return id0 == projectTypeInt || id1 == projectTypeInt || id2 == projectTypeInt || id3 == projectTypeInt; }
};
class ProjectSettingMgr {
THISCLASS(ProjectSettingMgr);
private:
/* data */
map<string, shared_ptr<ProjectSetting>> projectSettingsMap;
shared_ptr<GConfig> gConfig;
public:
void initialize();
public:
shared_ptr<ProjectSetting> getProjectSetting();
int32_t getProjType();
private:
shared_ptr<ProjectSetting> getProjectSetting(string projectType);
shared_ptr<ProjectSetting> getProjectSetting(int projectTypeInt);
shared_ptr<ProjectSetting> createProjectSetting(int projectTypeInt);
ComponentId getId(HardwareComponent component) {
auto it = m_componentIdMap.find(component);
if (it != m_componentIdMap.end()) {
return it->second;
}
THROW_APP_EXCEPTION(err::kappe_code_error, "ComponentIdMgr::getId: component not found");
}
};
} // namespace iflytop
#define PROJECT_TYPE (GET_SERVICE(ProjectSettingMgr)->getProjType())
#define PROJECT_SETTING (GET_SERVICE(ProjectSettingMgr)->getProjectSetting())
} // namespace iflytop

1
appsrc/appbase/project_setting_mgr.cpp → appsrc/appsetting/project_setting/project_setting_mgr.cpp

@ -1,7 +1,6 @@
#include "project_setting_mgr.hpp"
#include "components/zservice_container/zservice_container.hpp"
#include "project_setting.hpp"
using namespace std;
using namespace iflytop;

47
appsrc/appsetting/project_setting/project_setting_mgr.hpp

@ -0,0 +1,47 @@
#pragma once
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include "project_setting.hpp"
//
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
//
namespace iflytop {
using namespace std;
using namespace transmit_disfection_protocol;
class ProjectSettingMgr {
THISCLASS(ProjectSettingMgr);
private:
/* data */
map<string, shared_ptr<ProjectSetting>> projectSettingsMap;
shared_ptr<GConfig> gConfig;
public:
void initialize();
public:
shared_ptr<ProjectSetting> getProjectSetting();
int32_t getProjType();
private:
shared_ptr<ProjectSetting> getProjectSetting(string projectType);
shared_ptr<ProjectSetting> getProjectSetting(int projectTypeInt);
shared_ptr<ProjectSetting> createProjectSetting(int projectTypeInt);
};
} // namespace iflytop
#define PROJECT_TYPE (GET_SERVICE(ProjectSettingMgr)->getProjType())
#define PROJECT_SETTING (GET_SERVICE(ProjectSettingMgr)->getProjectSetting())

4
appsrc/baseservice/db/setting_db_dao.hpp

@ -15,8 +15,10 @@
#include <string>
#include <vector>
#include "appbase/appbean/setting_id.hpp"
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
//
#include "base/dbbase.hpp"
#include "base/keyvaldb.hpp"
#include "user_behavior_des.hpp"

2
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.hpp

@ -16,6 +16,8 @@
#include <vector>
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
/**
* @brief
*

2
appsrc/baseservice/udisk_mgr_service.hpp

@ -15,7 +15,7 @@
#include <vector>
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
namespace iflytop {
class UDiskMgrService {

1
appsrc/main.cpp

@ -3,6 +3,7 @@
#include <sqlite3.h>
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
#include "service/main_control_service.hpp"
using namespace iflytop;

26
appsrc/service/app/air_tightness_test.cpp

@ -1,27 +1,27 @@
#include "air_tightness_test.hpp"
using namespace iflytop;
void LeakDetectTest::initialize() {
logger->info("LeakDetectTest initialize");
REGFNV2(LeakDetectTest, start);
REGFNV2(LeakDetectTest, stop);
REGFNV2(LeakDetectTest, getState);
REGFNV2(LeakDetectTest, getServiceConfig);
void AirLeakDetectTest::initialize() {
logger->info("AirLeakDetectTest initialize");
REGFNV2(AirLeakDetectTest, start);
REGFNV2(AirLeakDetectTest, stop);
REGFNV2(AirLeakDetectTest, getState);
REGFNV2(AirLeakDetectTest, getServiceConfig);
}
void LeakDetectTest::start() { m_workstate = kleakTesting; }
void LeakDetectTest::stop() { m_workstate = kidle; }
LeakDetectTest::state_t LeakDetectTest::getWorkstate() { return m_workstate; }
void AirLeakDetectTest::start() { m_workstate = kleakTesting; }
void AirLeakDetectTest::stop() { m_workstate = kidle; }
AirLeakDetectTest::state_t AirLeakDetectTest::getWorkstate() { return m_workstate; }
void LeakDetectTest::fn_start(shared_ptr<MsgProcessContext> cxt) { //
void AirLeakDetectTest::fn_start(shared_ptr<MsgProcessContext> cxt) { //
start();
}
void LeakDetectTest::fn_stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void LeakDetectTest::fn_getState(shared_ptr<MsgProcessContext> cxt) { //
void AirLeakDetectTest::fn_stop(shared_ptr<MsgProcessContext> cxt) { stop(); }
void AirLeakDetectTest::fn_getState(shared_ptr<MsgProcessContext> cxt) { //
cxt->content["workState"] = state2str(getWorkstate());
cxt->content["workStateDisplay"] = state2chstr(getWorkstate());
cxt->content["pressure"] = 3.1;
}
void LeakDetectTest::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
void AirLeakDetectTest::fn_getServiceConfig(shared_ptr<MsgProcessContext> cxt) {
json cfg;
cfg["pressureUint"] = "kPa";
cfg["pressureMax"] = 5.0;

2
appsrc/service/app/air_tightness_test.hpp

@ -11,7 +11,7 @@
//
#include "baseservice/baseservice.hpp"
namespace iflytop {
class LeakDetectTest : public enable_shared_from_this<LeakDetectTest> {
class AirLeakDetectTest : public enable_shared_from_this<AirLeakDetectTest> {
THISCLASS(AddLiquidService);
public:

2
appsrc/service/disinfection_logs_service.hpp

@ -10,6 +10,8 @@
#include <vector>
//
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
#include "baseservice/baseservice.hpp"
#include "iflytop/core/components/zcsv/zcsv.hpp"

55
appsrc/service/hardware/base/component_id_mgr.cpp

@ -1,55 +0,0 @@
#include "component_id_mgr.hpp"
using namespace std;
using namespace iflytop;
using namespace core;
#define HC HardwareComponent
#define INSERT(id, boardId, subId) m_componentIdMap.insert({id, {boardId, subId}})
void ComponentIdMgr::initialize() { //
auto projSet = PROJECT_SETTING;
// 加液泵
INSERT(HardwareComponent::kAddLiquidPump, kFixBoardId_LiquidCtrl, kpumpid_add_liquid);
// 喷雾泵
INSERT(HardwareComponent::kSprayPump, kFixBoardId_LiquidCtrl, kpumpid_spray);
// 风机
INSERT(HardwareComponent::kBlower, kFixBoardId_PowerControl, 0);
// 空压机
INSERT(HardwareComponent::kAirCompressor, kFixBoardId_PowerControl, 0);
// 加热器
INSERT(HardwareComponent::kHeater, kFixBoardId_PowerControl, 0);
// 报警灯
INSERT(HardwareComponent::kWarningLight, kFixBoardId_LiquidCtrl, 0);
// 正压比例阀
INSERT(HardwareComponent::kPositivePressureProportional, kFixBoardId_LiquidCtrl, POSITIVE_PRESSURE_PROPORTIONAL_ID);
// 负压比例阀
INSERT(HardwareComponent::kNegativePressureProportional, kFixBoardId_LiquidCtrl, NEGATIVE_PRESSURE_PROPORTIONAL_ID);
// 空气密度测试
INSERT(HardwareComponent::kLeakDetectTest, kFixBoardId_LiquidCtrl, 0);
// 外部通道选择器
INSERT(HardwareComponent::kExtChSelector, kFixBoardId_ExtChSelector, 0);
// 蒸发仓水浸
INSERT(HardwareComponent::kEvaporationBinWS, kFixBoardId_LiquidCtrl, 0);
// 底部水浸
INSERT(HardwareComponent::kDeviceBottomWS, kFixBoardId_LiquidCtrl, 0);
// 主H2O2传感器
INSERT(HardwareComponent::kMainH2O2Sensor, kFixBoardId_PowerControl, 0);
// 气密传感器
INSERT(HardwareComponent::kLeakDetectPS, kFixBoardId_LiquidCtrl, 0);
// 液体重量传感器
INSERT(HardwareComponent::kLiquidWeightPS, kFixBoardId_LiquidCtrl, 0);
// 喷雾泵后压力传感器
INSERT(HardwareComponent::kSprayPumpPostPS, kFixBoardId_LiquidCtrl, 0);
// 加液泵后压力传感器
INSERT(HardwareComponent::kAddLiquidPumpPostPS, kFixBoardId_LiquidCtrl, 0);
}
ComponentId ComponentIdMgr::getId(HardwareComponent component) {
auto it = m_componentIdMap.find(component);
if (it != m_componentIdMap.end()) {
return it->second;
}
THROW_APP_EXCEPTION(err::kappe_code_error,"ComponentIdMgr::getId: component not found");
}

41
appsrc/service/hardware/base/component_id_mgr.hpp

@ -1,41 +0,0 @@
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "appbase/appbean/hardware_component.hpp"
#include "baseservice/baseservice.hpp"
namespace iflytop {
using namespace std;
using namespace core;
class ComponentId {
public:
ComponentId(int boardId, int subId) : boardId(boardId), subId(subId) {}
int boardId;
int subId;
};
class ComponentIdMgr : public enable_shared_from_this<ComponentIdMgr> {
THISCLASS(ComponentIdMgr);
shared_ptr<ProjectSetting> m_projectSetting;
map<int, ComponentId> m_componentIdMap;
public:
void initialize();
ComponentId getId(HardwareComponent component);
private:
};
} // namespace iflytop

13
appsrc/service/hardware/device_ctrl_service.cpp

@ -1,5 +1,5 @@
#include "device_ctrl_service.hpp"
#if 0
using namespace iflytop;
using namespace std;
using namespace core;
@ -131,9 +131,9 @@ int DeviceIoControlService::NegaPressureProp_readPos() { return CAN_MASTER->pro
bool DeviceIoControlService::NegaPressureProp_isBusy() { return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); }
#undef COMPONENT
#define COMPONENT HardwareComponent::LeakDetectTest
void DeviceIoControlService::LeakDetectTest_cutoffCh() { CAN_MASTER->leakDetectTestCloseOffCh(GET_BOARDID()); }
void DeviceIoControlService::LeakDetectTest_releaseCh() { CAN_MASTER->leakDetectTestReleaseCh(GET_BOARDID()); }
#define COMPONENT HardwareComponent::AirLeakDetectTest
void DeviceIoControlService::AirLeakDetectTest_cutoffCh() { CAN_MASTER->airLeakDetectTestCloseOffCh(GET_BOARDID()); }
void DeviceIoControlService::AirLeakDetectTest_releaseCh() { CAN_MASTER->airLeakDetectTestReleaseCh(GET_BOARDID()); }
#undef COMPONENT
// ExtChSelector
@ -159,5 +159,6 @@ bool DeviceIoControlService::WaterSensor_readDeviceBottom() { return CAN_MASTER-
int DeviceIoControlService::PressureSensor_readValPa(int sensorId) { return 0; } // Pa
// 气体密性测试压力传感器
#define COMPONENT HardwareComponent::LeakDetectPressureSensor
int DeviceIoControlService::LeakDetectPressureSensor_readValPa() { return 0; } // Pa
#define COMPONENT HardwareComponent::AirLeakDetectPressureSensor
int DeviceIoControlService::AirLeakDetectPressureSensor_readValPa() { return 0; } // Pa
#endif

10
appsrc/service/hardware/device_ctrl_service.hpp

@ -12,7 +12,6 @@
#include "baseservice/baseservice.hpp"
//
#include "base/can_packet_dumper.hpp"
#include "base/component_id_mgr.hpp"
#include "base/h2o2_sensor_data_mgr.hpp"
#include "base/uint_convert_mgr.hpp"
/**
@ -40,7 +39,6 @@ class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlSer
shared_ptr<H2O2SensorDataMgr> m_h2o2SensorDataMgr = make_shared<H2O2SensorDataMgr>();
shared_ptr<UintConvertMgr> m_uintConvertMgr = make_shared<UintConvertMgr>();
shared_ptr<ComponentIdMgr> m_boardIdMgr = make_shared<ComponentIdMgr>();
public:
void initialize();
@ -96,10 +94,10 @@ class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlSer
int NegaPressureProp_readPos();
bool NegaPressureProp_isBusy();
void LeakDetectTest_start();
void AirLeakDetectTest_start();
void LeakDetectTest_cutoffCh();
void LeakDetectTest_releaseCh();
void AirLeakDetectTest_cutoffCh();
void AirLeakDetectTest_releaseCh();
void ExtChSelector_selectCh(int ch);
@ -115,7 +113,7 @@ class DeviceIoControlService : public enable_shared_from_this<DeviceIoControlSer
// 压力传感器
int PressureSensor_readValPa(int sensorId); // Pa
// 气体密性测试压力传感器
int LeakDetectPressureSensor_readValPa(); // Pa
int AirLeakDetectPressureSensor_readValPa(); // Pa
};

3
appsrc/service/main_control_service.cpp

@ -1,6 +1,5 @@
#include "main_control_service.hpp"
#include "appbase/project_setting_mgr.hpp"
#include "baseservice/baseservice.hpp"
#include "service/audit_mgr_service.hpp"
#include "service/device_info_mgr_service.hpp"
@ -53,7 +52,7 @@ void MainControlService::initialize() {
BUILD_AND_REG_SERRVICE(TestPageMgrService);
BUILD_AND_REG_SERRVICE(AddLiquidService);
BUILD_AND_REG_SERRVICE(LeakDetectTest);
BUILD_AND_REG_SERRVICE(AirLeakDetectTest);
BUILD_AND_REG_SERRVICE(DisinfectionCtrlService);
BUILD_AND_REG_SERRVICE(DrainLiquidService);

1
appsrc/service/main_control_service.hpp

@ -14,6 +14,7 @@
#include <vector>
#include "appbase/dep.hpp"
#include "appsetting/appsetting.hpp"
/**
* @brief

Loading…
Cancel
Save