From e1c713fb003f2114171110417755191adc1b88ef Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 12 Aug 2022 15:41:27 +0200 Subject: [PATCH] * make mClient in mqtt private again (#145) * v0.5.10 --- tools/esp8266/app.cpp | 2 +- tools/esp8266/defines.h | 2 +- tools/esp8266/mqtt.h | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 23c8b575..c4bf5ece 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -163,7 +163,7 @@ void app::setup(uint32_t timeout) { mqttPort = 1883; mMqtt.setup(mqttAddr, mqttTopic, mqttUser, mqttPwd, mqttDevName, mqttPort); - mMqtt.mClient->setCallback(std::bind(&app::cbMqtt, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + mMqtt.setCallback(std::bind(&app::cbMqtt, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); mMqttTicker = 0; #ifdef __MQTT_TEST__ diff --git a/tools/esp8266/defines.h b/tools/esp8266/defines.h index f229e1da..0361d0b7 100644 --- a/tools/esp8266/defines.h +++ b/tools/esp8266/defines.h @@ -21,7 +21,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 5 -#define VERSION_PATCH 9 +#define VERSION_PATCH 10 //------------------------------------- diff --git a/tools/esp8266/mqtt.h b/tools/esp8266/mqtt.h index f8e0389e..eab0d043 100644 --- a/tools/esp8266/mqtt.h +++ b/tools/esp8266/mqtt.h @@ -12,8 +12,6 @@ class mqtt { public: - PubSubClient *mClient; - mqtt() { mClient = new PubSubClient(mEspClient); mAddressSet = false; @@ -42,8 +40,8 @@ class mqtt { mClient->setBufferSize(MQTT_MAX_PACKET_SIZE); } - void setCallback(void (*func)(const char* topic, byte* payload, unsigned int length)){ - mClient->setCallback(func); + void setCallback(MQTT_CALLBACK_SIGNATURE){ + mClient->setCallback(callback); } void sendMsg(const char *topic, const char *msg) { @@ -131,6 +129,7 @@ class mqtt { } WiFiClient mEspClient; + PubSubClient *mClient; bool mAddressSet; uint16_t mPort;