Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MQTTPacket by
Diff: MQTTConnectClient.c
- Revision:
- 16:d0b3886ada32
- Parent:
- 14:c2052aee81de
- Child:
- 17:c5bd28cc139a
diff -r f0ae0b8d4418 -r d0b3886ada32 MQTTConnectClient.c
--- a/MQTTConnectClient.c Fri Aug 01 16:27:19 2014 +0000
+++ b/MQTTConnectClient.c Fri Aug 01 16:58:18 2014 +0000
@@ -123,19 +123,20 @@
/**
* Deserializes the supplied (wire) buffer into connack data - return code
+ * @param sessionPresent the session present flag returned (only for MQTT 3.1.1)
* @param connack_rc returned integer value of the connack return code
* @param buf the raw buffer data, of the correct length determined by the remaining length field
* @param len the length in bytes of the data in the supplied buffer
* @return error code. 1 is success, 0 is failure
*/
-int MQTTDeserialize_connack(unsigned char* connack_rc, unsigned char* buf, int buflen)
+int MQTTDeserialize_connack(unsigned char* sessionPresent, unsigned char* connack_rc, unsigned char* buf, int buflen)
{
MQTTHeader header;
unsigned char* curdata = buf;
unsigned char* enddata = NULL;
int rc = 0;
int mylen;
- int compression;
+ MQTTConnackFlags flags;
FUNC_ENTRY;
header.byte = readChar(&curdata);
@@ -147,7 +148,8 @@
if (enddata - curdata < 2)
goto exit;
- compression = readChar(&curdata);
+ flags.all = readChar(&curdata);
+ *sessionPresent = flags.bits.sessionpresent;
*connack_rc = readChar(&curdata);
rc = 1;
