MQTTPacket

Dependents:   MQTT

Fork of MQTTPacket by MQTT

Files at this revision

API Documentation at this revision

Comitter:
icraggs
Date:
Thu Apr 10 22:54:14 2014 +0000
Parent:
2:bc3bc0e3b764
Child:
4:c502573c6016
Commit message:
Fix up connect options defaults, and serialization of 0-length strings

Changed in this revision

MQTTConnect.h Show annotated file Show diff for this revision Revisions of this file
MQTTPacket.c Show annotated file Show diff for this revision Revisions of this file
--- a/MQTTConnect.h	Thu Apr 10 15:11:16 2014 +0000
+++ b/MQTTConnect.h	Thu Apr 10 22:54:14 2014 +0000
@@ -80,13 +80,9 @@
 {
 	/** The eyecatcher for this structure.  must be MQTC. */
 	char struct_id[4];
-	/** The version number of this structure.  Must be 0, 1 or 2.
-	  * 0 signifies no SSL options and no serverURIs
-	  * 1 signifies no serverURIs
-	  */
+	/** The version number of this structure.  Must be 0 */
 	int struct_version;
-	/** Version of MQTT to be used.  3 = 3.1 4 = 3.1.1
-	  */
+	/** Version of MQTT to be used.  3 = 3.1 4 = 3.1.1 */
 	int MQTTVersion;
 	MQTTString clientID;
 	int keepAliveInterval;
@@ -97,7 +93,7 @@
 	MQTTString password;
 } MQTTPacket_connectData;
 
-#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'W'}, 0, 3, {"", {0, NULL}}, 60, 1, 0, \
+#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \
 		MQTTPacket_willOptions_initializer, {NULL, {0, NULL}}, {NULL, {0, NULL}} }
 
 int MQTTSerialize_connect(char* buf, int buflen, MQTTPacket_connectData* options);
--- a/MQTTPacket.c	Thu Apr 10 15:11:16 2014 +0000
+++ b/MQTTPacket.c	Thu Apr 10 22:54:14 2014 +0000
@@ -200,6 +200,8 @@
 	}
 	else if (mqttstring.cstring)
 		writeCString(pptr, mqttstring.cstring);
+	else
+		writeInt(pptr, 0);
 }