Changed callback type.

This commit is contained in:
Tom Cook 2016-01-26 09:50:27 +00:00
parent 0bb4efcea5
commit 21b75a2c4a
2 changed files with 3 additions and 2 deletions

View File

@ -570,7 +570,7 @@ PubSubClient& PubSubClient::setServer(const char * domain, uint16_t port) {
return *this; return *this;
} }
PubSubClient& PubSubClient::setCallback(void(*callback)(char*,uint8_t*,unsigned int)){ PubSubClient& PubSubClient::setCallback(MQTT_CALLBACK_SIGNATURE) {
this->callback = callback; this->callback = callback;
return *this; return *this;
} }

View File

@ -11,6 +11,7 @@
#include "IPAddress.h" #include "IPAddress.h"
#include "Client.h" #include "Client.h"
#include "Stream.h" #include "Stream.h"
#include <functional>
#define MQTT_VERSION_3_1 3 #define MQTT_VERSION_3_1 3
#define MQTT_VERSION_3_1_1 4 #define MQTT_VERSION_3_1_1 4
@ -65,7 +66,7 @@
#define MQTTQOS1 (1 << 1) #define MQTTQOS1 (1 << 1)
#define MQTTQOS2 (2 << 1) #define MQTTQOS2 (2 << 1)
#define MQTT_CALLBACK_SIGNATURE void (*callback)(char*,uint8_t*,unsigned int) #define MQTT_CALLBACK_SIGNATURE std::function<void(char*, uint8_t*, uint32_t)> callback
class PubSubClient { class PubSubClient {
private: private: