result of success : 1 to 0, max msg size: 127B to 16383B, fixed existing bugs

Fork of MQTTClient by wakwak koba

Revision:
10:6fa55ad359f0
Parent:
6:734e384f72c3
--- a/MQTTClient.h	Thu Apr 05 07:50:30 2012 +0000
+++ b/MQTTClient.h	Mon Jan 04 07:24:12 2016 +0000
@@ -36,8 +36,8 @@
 #define MQTTPUBLISH 3<<4
 #define MQTTSUBSCRIBE 8<<4
 
-#define MAX_PACKET_SIZE 128
-#define KEEPALIVE 15000
+//#define MAX_PACKET_SIZE 128
+//#define KEEPALIVE 15000
 
 /** MQTTClient 
  * 
@@ -54,13 +54,16 @@
     MQTTClient();
     ~MQTTClient();
     MQTTClient(IpAddr server, int port, void (*callback)(char*, char*));
-    void init(IpAddr *server, int port, void (*callback)(char*, char*));
-    void init(IpAddr *server, int port, char *userName, char *password, void (*callback)(char*, char*));
-    int connect(char *);
+    MQTTClient(IpAddr server, int port, char *id, char *userName, char *password, void (*callback)(char*, char*));
+    int connect();
+    int connect(char *id);
     void disconnect();
-    int publish(char *, char *);
+    int publish(char *, char *, bool retain = false);
     int subscribe(char *);
+    int keepalive;
     void live();
+    void pool();
+    bool connected;
     
 private:
     int open_session(char* id);
@@ -74,8 +77,8 @@
     Timer timer;
     IpAddr serverIp;
     int port;
-    bool connected;
     bool sessionOpened;
+    bool writtable;
     
     void onTCPSocketEvent(TCPSocketEvent e);
     TCPSocket* pTCPSocket;