A Threaded Secure MQTT Client example. Uses MBED TLS for SSL/TLS connection. QoS0 only for now. Example has been tested with K64F connected via Ethernet.

Dependencies:   FP MQTTPacket

Fork of HelloMQTT by MQTT

Revision:
31:d34f6adb7a53
Parent:
27:c90092f35d79
--- a/MQTTThreadedClient.h	Mon Mar 27 15:16:23 2017 +0000
+++ b/MQTTThreadedClient.h	Sat Apr 01 12:41:29 2017 +0000
@@ -12,11 +12,22 @@
 #include <string>
 #include <map>
 
+//#define MQTT_DEBUG 1
+
+#ifdef MQTT_DEBUG
+#define DBG(fmt, args...)    printf(fmt, ## args)
+#else
+#define DBG(fmt, args...)    /* Don't do anything in release builds */
+#endif
+
 #define COMMAND_TIMEOUT 5000
 #define DEFAULT_SOCKET_TIMEOUT 1000
-#define MAX_MQTT_PACKET_SIZE 200
-#define MAX_MQTT_PAYLOAD_SIZE 100
+#define MAX_MQTT_PACKET_SIZE 500
+#define MAX_MQTT_PAYLOAD_SIZE 300
 
+namespace MQTT
+{
+    
 typedef enum { QOS0, QOS1, QOS2 } QoS;
 
 // all failure return codes must be negative
@@ -187,4 +198,5 @@
     int login();
 };
 
+}
 #endif