An MQTT Client for the new etherNet Interface.
Dependencies: EthernetInterface mbed-rtos
Dependents: AV_MQTT niMQTT_example
Revision 6:661892e00fe1, committed 2013-08-13
- Comitter:
- Nim65s
- Date:
- Tue Aug 13 12:26:57 2013 +0000
- Parent:
- 5:3d21020a2826
- Child:
- 7:d01d8f0bac58
- Commit message:
- callback arguments needs to be const for AV_MQTT's picojson's inclusion
Changed in this revision
| niMQTT.cpp | Show annotated file Show diff for this revision Revisions of this file |
| niMQTT.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/niMQTT.cpp Mon Aug 12 15:31:55 2013 +0000
+++ b/niMQTT.cpp Tue Aug 13 12:26:57 2013 +0000
@@ -1,6 +1,6 @@
#include "niMQTT.h"
-niMQTT::niMQTT(char *server, void (*callback)(char*, char*), char *id, int port, char *username, char *password, bool debug):
+niMQTT::niMQTT(char *server, void (*callback)(const char*, const char*), char *id, int port, char *username, char *password, bool debug):
server(server), port(port), id(id), callback(callback), username(username), password(password),
debug(debug), connected(true), message_id(0), thread(&niMQTT::thread_starter, this),
waiting_new_packet(true), packet_sent(false), waiting_connack(0), waiting_suback(0), waiting_pingresp(0) {
--- a/niMQTT.h Mon Aug 12 15:31:55 2013 +0000
+++ b/niMQTT.h Tue Aug 13 12:26:57 2013 +0000
@@ -64,7 +64,7 @@
* \param password your password for the server
* \param debug get a more verbose output
*/
- niMQTT(char *server, void (*callback)(char *, char*), char *id="mbed", int port=1883, char *username="", char *password="", bool debug=false);
+ niMQTT(char *server, void (*callback)(const char *, const char*), char *id="mbed", int port=1883, char *username="", char *password="", bool debug=false);
void reconnect();
~niMQTT();
@@ -79,11 +79,11 @@
*/
int sub(char *topic, bool unsub=false);
- private:
+ protected:
char *server;
int port;
char *id;
- void (*callback)(char *, char*);
+ void (*callback)(const char *, const char*);
char *username;
char *password;
Guilhem Saurel