Skip to content

Commit

Permalink
Merge pull request knolleary#120 from tomkcook/master
Browse files Browse the repository at this point in the history
Use std::function on ESP8266 platform.
  • Loading branch information
knolleary committed Jan 31, 2016
2 parents baeb59e + 67eba6d commit 83b69a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ PubSubClient& PubSubClient::setServer(const char * domain, uint16_t port) {
return *this;
}

PubSubClient& PubSubClient::setCallback(void(*callback)(char*,uint8_t*,unsigned int)){
PubSubClient& PubSubClient::setCallback(MQTT_CALLBACK_SIGNATURE) {
this->callback = callback;
return *this;
}
Expand Down
7 changes: 6 additions & 1 deletion src/PubSubClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
#define MQTTQOS1 (1 << 1)
#define MQTTQOS2 (2 << 1)

#define MQTT_CALLBACK_SIGNATURE void (*callback)(char*,uint8_t*,unsigned int)
#ifdef ESP8266
#include <functional>
#define MQTT_CALLBACK_SIGNATURE std::function<void(char*, uint8_t*, uint32_t)> callback
#else
#define MQTT_CALLBACK_SIGNATURE void (*callback)(char*, uint8_t*, uint32_t)
#endif

class PubSubClient {
private:
Expand Down

0 comments on commit 83b69a7

Please sign in to comment.