An API for using MQTT over multiple transports

Dependencies:   FP MQTTPacket

Dependents:   Cellular_HelloMQTT IoTStarterKit GSwifiInterface_HelloMQTT IBMIoTClientEthernetExample ... more

This library is part of the EclipseTM Paho project; specifically the embedded client.

The goals of this API are:

  1. to be independent of any system library: hence templates parameters for networking, timer and threading classes
  2. not to rely on heap storage, only automatic (I think this is a good thing)
  3. to limit memory use, for instance by defining the size of the buffers and arrays used at object creation time
Revision:
57:3513ee54ebb4
Parent:
56:71ae1a773b64
--- a/MQTTClient.h	Tue Oct 03 22:51:58 2017 +0000
+++ b/MQTTClient.h	Thu Nov 02 12:07:28 2017 +0000
@@ -382,13 +382,15 @@
     int rc = FAILURE,
         sent = 0;
 
-    do
+    while (sent < length)
     {
         rc = ipstack.write(&sendbuf[sent], length - sent, timer.left_ms());
         if (rc < 0)  // there was an error writing the data
             break;
         sent += rc;
-    } while (sent < length && !timer.expired());
+        if (timer.expired()) // only check expiry after at least one attempt to write
+            break;
+    }
     if (sent == length)
     {
         if (this->keepAliveInterval > 0)