Removed blocking keepalive code
Dependencies: EthernetInterface mbed-rtos
Fork of niMQTT by
Revision 1:4faa96fa4350, committed 2013-08-07
- Comitter:
- Nim65s
- Date:
- Wed Aug 07 13:33:54 2013 +0000
- Parent:
- 0:d4dfed20c6ea
- Child:
- 2:ed8c78234d7c
- Commit message:
- Better parameter order
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 Wed Aug 07 12:57:21 2013 +0000
+++ b/niMQTT.cpp Wed Aug 07 13:33:54 2013 +0000
@@ -1,6 +1,6 @@
#include "niMQTT.h"
-niMQTT::niMQTT(char *server, int port, char *id, void (*callback)(char*, char*), char *username, char *password, bool debug):
+niMQTT::niMQTT(char *server, void (*callback)(char*, 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 Wed Aug 07 12:57:21 2013 +0000
+++ b/niMQTT.h Wed Aug 07 13:33:54 2013 +0000
@@ -48,7 +48,7 @@
#define LEAST_ONCE LEAST_ONCE_NUM << 1
#define EXACTLY_ONCE EXACTLY_ONCE_NUM << 1
-#define KEEP_ALIVE 300 // seconds
+#define KEEP_ALIVE 100 // seconds
#define TIMEOUT 1000 // ms
#define START_THREAD 1
@@ -57,14 +57,14 @@
public:
/** Initialise and launch the MQTT Client
* \param server the address of your server
- * \param port the port of your server
+ * \param callback a callback to execute on receiving a PUBLISH
* \param id the id of this client (should be unique)
- * \param callback a callback to execute on receiving a PUBLISH
+ * \param port the port of your server
* \param username your username for the server
* \param password your password for the server
* \param debug get a more verbose output
*/
- niMQTT(char *server, int port=1884, char *id="mbed", void (*callback)(char *, char*), char *username="", char *password="", bool debug=false);
+ niMQTT(char *server, void (*callback)(char *, char*), char *id="mbed", int port=1883, char *username="", char *password="", bool debug=false);
~niMQTT();
/* Publish a message on a topic
