Refactor MQTT callback function names for consistency. Changed MessageCallback and ConnectionCallback to MessageCb and ConnectionCb in mqtt.hpp, mqtt.cpp, and custom_robot.cpp to improve code clarity and maintainability.
This commit is contained in:
@@ -15,8 +15,8 @@ namespace custom {
|
||||
|
||||
class MqttClient {
|
||||
public:
|
||||
using MessageCallback = std::function<void(const std::string& topic, const std::string& payload)>;
|
||||
using ConnectionCallback = std::function<void(bool connected)>;
|
||||
using MessageCb = std::function<void(const std::string& topic, const std::string& payload)>;
|
||||
using ConnectionCb = std::function<void(bool connected)>;
|
||||
|
||||
MqttClient(const std::string& broker, int port, const std::string& clientId);
|
||||
~MqttClient();
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
bool publish(const std::string& topic, const std::string& payload, int qos = 1, bool retain = false);
|
||||
bool publishJson(const std::string& topic, const nlohmann::json& json, int qos = 1, bool retain = false);
|
||||
|
||||
void setMessageCallback(MessageCallback callback);
|
||||
void setConnectionCallback(ConnectionCallback callback);
|
||||
void setMessageCb(MessageCb cb);
|
||||
void setConnectionCb(ConnectionCb cb);
|
||||
|
||||
// Message queue for async processing
|
||||
void startMessageProcessor();
|
||||
@@ -56,8 +56,8 @@ private:
|
||||
|
||||
MQTTClient client_;
|
||||
|
||||
MessageCallback messageCallback_;
|
||||
ConnectionCallback connectionCallback_;
|
||||
MessageCb messageCb_;
|
||||
ConnectionCb connectionCb_;
|
||||
|
||||
std::atomic<bool> connected_;
|
||||
std::atomic<bool> reconnecting_;
|
||||
|
||||
Reference in New Issue
Block a user