修改设备显示信息的寄存器地址配置文件,修改服务端界面

This commit is contained in:
lixiaoyuan
2025-09-29 18:31:44 +08:00
parent af625fba49
commit 454310262b
23 changed files with 1000 additions and 334 deletions

View File

@@ -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);
};