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

Files at this revision

API Documentation at this revision

Comitter:
icraggs
Date:
Tue Oct 03 22:51:58 2017 +0000
Parent:
54:ff9e5c4b52d0
Child:
57:3513ee54ebb4
Commit message:
Allow acks to be sent at end of timeout

Changed in this revision

MQTTClient.h Show annotated file Show diff for this revision Revisions of this file
MQTTPacket.lib Show annotated file Show diff for this revision Revisions of this file
--- a/MQTTClient.h	Sat Sep 30 16:46:21 2017 +0000
+++ b/MQTTClient.h	Tue Oct 03 22:51:58 2017 +0000
@@ -382,13 +382,13 @@
     int rc = FAILURE,
         sent = 0;
 
-    while (sent < length && !timer.expired())
+    do
     {
         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 (sent == length)
     {
         if (this->keepAliveInterval > 0)
@@ -400,7 +400,7 @@
 
 #if defined(MQTT_DEBUG)
     char printbuf[150];
-    DEBUG("Rc %d from sending packet %s\n", rc, 
+    DEBUG("Rc %d from sending packet %s\r\n", rc, 
         MQTTFormat_toServerString(printbuf, sizeof(printbuf), sendbuf, length));
 #endif
     return rc;
@@ -480,7 +480,7 @@
     if (rc >= 0)
     {
         char printbuf[50];
-        DEBUG("Rc %d receiving packet %s\n", rc, 
+        DEBUG("Rc %d receiving packet %s\r\n", rc, 
             MQTTFormat_toClientString(printbuf, sizeof(printbuf), readbuf, len));
     }
 #endif
@@ -688,8 +688,7 @@
         {
             rc = FAILURE; // session failure
             #if defined(MQTT_DEBUG)
-                char printbuf[150];
-                DEBUG("PINGRESP not received in keepalive interval\n");
+                DEBUG("PINGRESP not received in keepalive interval\r\n");
             #endif
         }
     }
--- a/MQTTPacket.lib	Sat Sep 30 16:46:21 2017 +0000
+++ b/MQTTPacket.lib	Tue Oct 03 22:51:58 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/mqtt/code/MQTTPacket/#1af97b41bc9d
+https://os.mbed.com/users/icraggs/code/MQTTPacket/#0cfb74c5a621