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:
35:063dc3b472d5
Parent:
33:8bbc3a992326
Child:
36:2f1ada427e56
diff -r 8bbc3a992326 -r 063dc3b472d5 MQTTClient.h
--- a/MQTTClient.h	Wed Jul 30 19:12:00 2014 +0000
+++ b/MQTTClient.h	Fri Aug 01 13:13:35 2014 +0000
@@ -417,7 +417,7 @@
         case PUBLISH:
             MQTTString topicName;
             Message msg;
-            if (MQTTDeserialize_publish((int*)&msg.dup, (int*)&msg.qos, (int*)&msg.retained, (int*)&msg.id, &topicName,
+            if (MQTTDeserialize_publish((unsigned char*)&msg.dup, (int*)&msg.qos, (unsigned char*)&msg.retained, (int*)&msg.id, &topicName,
                                  (char**)&msg.payload, (int*)&msg.payloadlen, readbuf, MAX_MQTT_PACKET_SIZE) != 1)
                 goto exit;
 //          if (msg.qos != QOS2) 
@@ -444,7 +444,8 @@
             }
             break;
         case PUBREC:
-            int type, dup, mypacketid;
+            int type, mypacketid;
+            unsigned char dup;
             if (MQTTDeserialize_ack(&type, &dup, &mypacketid, readbuf, MAX_MQTT_PACKET_SIZE) != 1)
                 rc = FAILURE;
             else if ((len = MQTTSerialize_ack(buf, MAX_MQTT_PACKET_SIZE, PUBREL, 0, mypacketid)) <= 0)
@@ -652,7 +653,8 @@
     {
         if (waitfor(PUBACK, timer) == PUBACK)
         {
-            int type, dup, mypacketid;
+            int type, mypacketid;
+            unsigned char dup;
             if (MQTTDeserialize_ack(&type, &dup, &mypacketid, readbuf, MAX_MQTT_PACKET_SIZE) != 1)
                 rc = FAILURE;
         }
@@ -663,7 +665,8 @@
     {
         if (waitfor(PUBCOMP, timer) == PUBCOMP)
         {
-            int type, dup, mypacketid;
+            int type, mypacketid;
+            unsigned char dup;
             if (MQTTDeserialize_ack(&type, &dup, &mypacketid, readbuf, MAX_MQTT_PACKET_SIZE) != 1)
                 rc = FAILURE;
         }