Browse Source

* make mClient in mqtt private again (#145)

* v0.5.10
pull/152/head
lumapu 3 years ago
parent
commit
e1c713fb00
  1. 2
      tools/esp8266/app.cpp
  2. 2
      tools/esp8266/defines.h
  3. 7
      tools/esp8266/mqtt.h

2
tools/esp8266/app.cpp

@ -163,7 +163,7 @@ void app::setup(uint32_t timeout) {
mqttPort = 1883; mqttPort = 1883;
mMqtt.setup(mqttAddr, mqttTopic, mqttUser, mqttPwd, mqttDevName, mqttPort); 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; mMqttTicker = 0;
#ifdef __MQTT_TEST__ #ifdef __MQTT_TEST__

2
tools/esp8266/defines.h

@ -21,7 +21,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_PATCH 9 #define VERSION_PATCH 10
//------------------------------------- //-------------------------------------

7
tools/esp8266/mqtt.h

@ -12,8 +12,6 @@
class mqtt { class mqtt {
public: public:
PubSubClient *mClient;
mqtt() { mqtt() {
mClient = new PubSubClient(mEspClient); mClient = new PubSubClient(mEspClient);
mAddressSet = false; mAddressSet = false;
@ -42,8 +40,8 @@ class mqtt {
mClient->setBufferSize(MQTT_MAX_PACKET_SIZE); mClient->setBufferSize(MQTT_MAX_PACKET_SIZE);
} }
void setCallback(void (*func)(const char* topic, byte* payload, unsigned int length)){ void setCallback(MQTT_CALLBACK_SIGNATURE){
mClient->setCallback(func); mClient->setCallback(callback);
} }
void sendMsg(const char *topic, const char *msg) { void sendMsg(const char *topic, const char *msg) {
@ -131,6 +129,7 @@ class mqtt {
} }
WiFiClient mEspClient; WiFiClient mEspClient;
PubSubClient *mClient;
bool mAddressSet; bool mAddressSet;
uint16_t mPort; uint16_t mPort;

Loading…
Cancel
Save