Skip to content

Commit

Permalink
MQTTV5Client-C and MQTTClient-C documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CIPop committed Aug 3, 2023
1 parent 79d7b81 commit b42df2f
Show file tree
Hide file tree
Showing 6 changed files with 361 additions and 154 deletions.
18 changes: 17 additions & 1 deletion MQTTClient-C/src/MQTTClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,28 @@ int MQTTConnectWithResults(MQTTClient* c, MQTTPacket_connectData* options, MQTTC
// this will be a blocking call, wait for the connack
if (waitfor(c, CONNACK, &connect_timer) == CONNACK)
{
#if defined(MQTTV5)
data->reasonCode = MQTTREASONCODE_SUCCESS;
#else
data->rc = 0;
#endif

data->sessionPresent = 0;
if (MQTTDeserialize_connack(&data->sessionPresent, &data->rc, c->readbuf, c->readbuf_size) == 1)

#if defined(MQTTV5)
if (MQTTV5Deserialize_connack(c->recvProperties, &data->sessionPresent, (unsigned char*)(&data->reasonCode),
c->readbuf, c->readbuf_size) == 1) {
rc = (int)data->reasonCode;
}
#else
if (MQTTDeserialize_connack(&data->sessionPresent, &data->rc, c->readbuf, c->readbuf_size) == 1) {
rc = data->rc;
}
#endif
else
{
rc = MQTTCLIENT_FAILURE;
}
}
else
rc = MQTTCLIENT_FAILURE;
Expand Down
Loading

0 comments on commit b42df2f

Please sign in to comment.