mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改设备显示信息的寄存器地址配置文件,修改服务端界面
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum class EAlertType
|
||||
{
|
||||
@@ -56,12 +57,43 @@ struct RegAddrUnit
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 需要在前端展示的设备参数
|
||||
struct DeviceParamAddr
|
||||
{
|
||||
std::string name;
|
||||
std::string addr;
|
||||
std::string defaultVal;
|
||||
std::string unit;
|
||||
float ratio {1.0};
|
||||
DeviceParamAddr() {};
|
||||
DeviceParamAddr(std::string name, std::string addr, std::string defaultVal, std::string unit, float ratio = 1.0f)
|
||||
: name(name), addr(addr), defaultVal(defaultVal), unit(unit), ratio(ratio)
|
||||
{
|
||||
if (this->ratio == 0.0)
|
||||
{
|
||||
this->ratio = 1.0f;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class REGAddr
|
||||
{
|
||||
public:
|
||||
// key: 寄存器地址
|
||||
static std::map<std::string, std::map<std::string, RegAddrUnit>> s_mapReg;
|
||||
|
||||
static std::map<int, std::vector<DeviceParamAddr>> s_mapDeviceAddrParam;
|
||||
static std::map<int, std::vector<std::string>> s_mapDeviceAddrCurve;
|
||||
static std::map<int, std::map<std::string, std::map<std::string, std::string>>> g_mapRegAddrValStr;
|
||||
static std::map<int, std::map<std::string, RegAddrUnit>> g_mapRegDeviceType;
|
||||
|
||||
static void load(std::string filename);
|
||||
static void loadParamAddr(std::string filename);
|
||||
|
||||
static std::map<std::string, RegAddrUnit>* getRegMap(std::string name);
|
||||
|
||||
static std::map<std::string, RegAddrUnit>* getRegMapByDeviceType(int deviceType);
|
||||
|
||||
static std::vector<DeviceParamAddr>& GetDeviceParamAddrs(int deviceType);
|
||||
};
|
||||
Reference in New Issue
Block a user