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:
30:b2aed80037db
Parent:
27:c90092f35d79
Child:
32:16ef25cbb05c
--- a/MQTTThreadedClient.h	Mon Mar 27 15:16:23 2017 +0000
+++ b/MQTTThreadedClient.h	Tue Mar 28 09:18:49 2017 +0000
@@ -7,6 +7,13 @@
 #include "NetworkInterface.h"
 #include "FP.h"
 
+#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
 
 #include <cstdio>
 #include <string>
@@ -17,6 +24,9 @@
 #define MAX_MQTT_PACKET_SIZE 200
 #define MAX_MQTT_PAYLOAD_SIZE 100
 
+namespace MQTT
+{
+    
 typedef enum { QOS0, QOS1, QOS2 } QoS;
 
 // all failure return codes must be negative
@@ -187,4 +197,5 @@
     int login();
 };
 
+}
 #endif