mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
调试预制舱通讯协议修改数据解析
This commit is contained in:
@@ -7,14 +7,13 @@
|
||||
#include "common/JsonN.h"
|
||||
|
||||
class Station;
|
||||
class Device;
|
||||
|
||||
|
||||
struct TopicInfo
|
||||
{
|
||||
std::string name;
|
||||
int deviceType {0};
|
||||
int polling {0}; // 召测
|
||||
int enabled {1};
|
||||
TopicInfo() {};
|
||||
TopicInfo(std::string name, int deviceType, int polling=0)
|
||||
:name(name), deviceType(deviceType), polling(polling)
|
||||
@@ -26,8 +25,6 @@ using namespace std;
|
||||
class MqttClient
|
||||
{
|
||||
public:
|
||||
static bool load(std::string filename);
|
||||
|
||||
int init(string addr, string clientId, string username, string password);
|
||||
void destory();
|
||||
|
||||
@@ -42,8 +39,7 @@ public:
|
||||
void onConnectFaiure(MQTTAsync_failureData* resp);
|
||||
|
||||
int onMessageArrived(char* topic, int len, MQTTAsync_message* msg);
|
||||
void ParseArrivedMessage(njson& json, string command, std::shared_ptr<Station> station);
|
||||
void ParseMessageCharge(njson& json, string command, std::shared_ptr<Station> station, std::shared_ptr<Device> device);
|
||||
void ParseArrivedMessage(njson& json, string clientId, string command, std::shared_ptr<Station> station);
|
||||
|
||||
public:
|
||||
// MQTT clientId (使用station 的 code)
|
||||
@@ -55,7 +51,7 @@ public:
|
||||
bool isConnected {false};
|
||||
bool isSubscribed {false};
|
||||
|
||||
static std::map<std::string, TopicInfo> s_mapTopicInfo;
|
||||
std::map<std::string, TopicInfo> mapTopicInfo;
|
||||
};
|
||||
|
||||
|
||||
@@ -75,3 +71,12 @@ public:
|
||||
#define TOPIC_PCS_YC "up/json/预制舱01/PCS_YC"
|
||||
#define TOPIC_PCS_YC "up/json/预制舱01/PCS_YC"
|
||||
|
||||
|
||||
class MQTT
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
public:
|
||||
static string pack(std::string name);
|
||||
};
|
||||
Reference in New Issue
Block a user