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:
@@ -8,22 +8,6 @@
|
||||
|
||||
class Station;
|
||||
|
||||
struct REGInfo
|
||||
{
|
||||
std::string key;
|
||||
std::string datatype;
|
||||
int bytes {0};
|
||||
std::string remark;
|
||||
int ratio {1};
|
||||
|
||||
REGInfo() {}
|
||||
REGInfo(std::string key, std::string datatype, std::string remark)
|
||||
: key(key), datatype(datatype), remark(remark)
|
||||
{
|
||||
if (datatype == "uint16" || datatype == "int16") { bytes = 1; }
|
||||
else if (datatype == "uint32" || datatype == "int32") { bytes = 2; }
|
||||
}
|
||||
};
|
||||
|
||||
struct TopicInfo
|
||||
{
|
||||
@@ -41,8 +25,6 @@ using namespace std;
|
||||
class MqttClient
|
||||
{
|
||||
public:
|
||||
static void loadDataStruct(std::string filename);
|
||||
|
||||
int init(string addr, string clientId, string username, string password);
|
||||
void destory();
|
||||
|
||||
@@ -51,13 +33,13 @@ public:
|
||||
int polling();
|
||||
|
||||
void onConnectionLost(char* cause);
|
||||
int onMessageArrived(char* topic, int len, MQTTAsync_message* msg);
|
||||
void onDeliveryComplete(MQTTAsync_token token);
|
||||
|
||||
void onConnectSuccess(MQTTAsync_successData* resp);
|
||||
void onConnectFaiure(MQTTAsync_failureData* resp);
|
||||
|
||||
void parseEMS_YX(std::shared_ptr<Station> station, njson& json, std::map<std::string, REGInfo>& mapRegInfo);
|
||||
int onMessageArrived(char* topic, int len, MQTTAsync_message* msg);
|
||||
void ParseArrivedMessage(njson& json, string clientId, string command, std::shared_ptr<Station> station);
|
||||
|
||||
public:
|
||||
// MQTT clientId (使用station 的 code)
|
||||
|
||||
Reference in New Issue
Block a user