Commit 37d0f98d authored by 957dd's avatar 957dd

Merge branch 'feature/add_ip_mac' into 'master'

将QOS改为了0 See merge request !7
parents 6f1572a4 0564d92d
No preview for this file type
......@@ -54,7 +54,7 @@ public:
void unsubscribe(const std::string& topic);
// 发布消息
void publish(const std::string& topic, const std::string& payload, int qos = 1, bool retained = false);
void publish(const std::string& topic, const std::string& payload, int qos = 0, bool retained = false);
private:
// 内部类,用于处理来自Paho库的回调
......
......@@ -22,7 +22,7 @@ public:
void AddSubscription(const std::string& topic, SimpleJsonCallback callback);
void AddSubscriptions(const std::vector<std::string>& topics, SimpleJsonCallback common_callback);
void RemoveSubscription(const std::string& topic);
void PublishJson(const std::string& topic, const nlohmann::json& json_payload, int qos = 1, bool retained = false);
void PublishJson(const std::string& topic, const nlohmann::json& json_payload, int qos = 0, bool retained = false);
private:
// 将订阅请求封装成一个任务
......
......@@ -27,8 +27,6 @@ const std::string publish_topic_prefix = "positioning/"; // 发布数据的主
std::string final_publish_topic;
std::string g_device_id;
NetworkInfo g_network_addr;
positioningMapData g_positioning_data_t;
......
......@@ -71,7 +71,7 @@ void MqttTopicsHandler::AddSubscription(const std::string& topic, JsonCallback c
post_task([this, topic, wrapped_callback]() {
std::cout << "工作线程:正在执行订阅主题: " << topic << std::endl;
// 假设 QoS 为 1
subscribe(topic, 1, wrapped_callback);
subscribe(topic, 0,wrapped_callback);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment