From 5fb965424fcc0aa6aca0ab7b628375de9c7287ce Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Mon, 27 Jun 2022 13:05:25 +0200 Subject: [PATCH] Add parsePubAckData() --- mqttpacket.cpp | 8 +++++++- mqttpacket.h | 1 + packetdatatypes.h | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index d87e72b..2d9e936 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -1211,9 +1211,15 @@ void MqttPacket::handlePublish() } } +void MqttPacket::parsePubAckData() +{ + setPosToDataStart(); + this->packet_id = readTwoBytesToUInt16(); +} + void MqttPacket::handlePubAck() { - uint16_t packet_id = readTwoBytesToUInt16(); + parsePubAckData(); sender->getSession()->clearQosMessage(packet_id, true); } diff --git a/mqttpacket.h b/mqttpacket.h index 0cd093d..46b4436 100644 --- a/mqttpacket.h +++ b/mqttpacket.h @@ -120,6 +120,7 @@ public: void handlePing(); void parsePublishData(); void handlePublish(); + void parsePubAckData(); void handlePubAck(); void handlePubRec(); void handlePubRel(); diff --git a/packetdatatypes.h b/packetdatatypes.h index 1b1925e..2937b32 100644 --- a/packetdatatypes.h +++ b/packetdatatypes.h @@ -54,5 +54,10 @@ struct SubAckData std::vector subAckCodes; }; +struct PubAckData +{ + uint16_t packet_id; +}; + #endif // PACKETDATATYPES_H -- libgit2 0.21.4