Hi,
Can someone explain me this:
If I compile the PubSubClient example: mqtt_publish_in_callback with IDE 1.6.5 there is no problem.
Extract of the sketch:
........
EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
........
// Callback function
void callback(char* topic, byte* payload, unsigned int length) {
.....
Now using IDE 1.6.6 or 1.6.7 I have as foreseen in the example to add twice the definition of the Callback function, otherwise an error message is generated
exit status 1
'callback' was not declared in this scope
Extract of the working sketch
// Callback function header
void callback(char* topic, byte* payload, unsigned int length);
EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
......
// Callback function
void callback(char* topic, byte* payload, unsigned int length) {
// In order to republish this payload, a copy must be made
// as the orignal payload buffer will be overwritten whilst
// constructing the PUBLISH packet.
.........
However, looking at the PubSubClient.h I read
#define MQTT_CALLBACK_SIGNATURE void (callback)(char,uint8_t*,unsigned int)
.....
public:
.....
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
I don't understand this issue and why it was not present with version 1.6.5?
Thanks in advance
Robert