mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现MQTT协议消息订阅和消息解析流程
This commit is contained in:
@@ -9,8 +9,24 @@
|
||||
|
||||
class CommEntity;
|
||||
|
||||
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Device> create(Fields& fields);
|
||||
|
||||
|
||||
int startComm();
|
||||
|
||||
void getCacheVoltage(std::vector<std::string>& vec);
|
||||
void getCacheCurrent(std::vector<std::string>& vec);
|
||||
void getCachePower(std::vector<std::string>& vec);
|
||||
|
||||
void setParam(std::string k, std::string v);
|
||||
std::string getParam(std::string k, std::string defaultVal = "");
|
||||
|
||||
void getRuntimeParams(std::vector<std::pair<std::string, std::string>>& params);
|
||||
|
||||
public:
|
||||
int deviceId = -1;
|
||||
int type = -1;
|
||||
@@ -30,23 +46,9 @@ public:
|
||||
// 通讯entity
|
||||
std::shared_ptr<CommEntity> commEntity;
|
||||
|
||||
//int getAttrInt(std::string key);
|
||||
//float getAttrFloat(std::string key);
|
||||
//double getAttrDouble(std::string key);
|
||||
//std::string getAttrStr(std::string key);
|
||||
|
||||
|
||||
int64_t tsDataDate {};
|
||||
std::map<int, double> mapCacheVoltage;
|
||||
std::map<int, double> mapCacheCurrent;
|
||||
std::map<int, double> mapCachePower;
|
||||
|
||||
// 启动通讯
|
||||
int startComm();
|
||||
void getRuntimeParams(std::vector<std::pair<std::string, std::string>>& params);
|
||||
void getCacheVoltage(std::vector<std::string>& vec);
|
||||
void getCacheCurrent(std::vector<std::string>& vec);
|
||||
void getCachePower(std::vector<std::string>& vec);
|
||||
|
||||
static std::shared_ptr<Device> create(Fields& fields);
|
||||
std::map<std::string, std::string> mapParams;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user