diff --git a/FlashMQTests/plugintests.cpp b/FlashMQTests/plugintests.cpp index a279332..5d4dcf5 100644 --- a/FlashMQTests/plugintests.cpp +++ b/FlashMQTests/plugintests.cpp @@ -543,7 +543,7 @@ void MainTests::testFailedAsyncClientCrashOnSession() FlashMQTestClient &second_client = clients.back(); Publish pub("sdf", "wer", 2); - MqttPacket pubPack(second_client.getClient()->getProtocolVersion(), pub, 0); + MqttPacket pubPack(second_client.getClient()->getProtocolVersion(), pub); if (pub.qos > 0) pubPack.setPacketId(3); second_client.getClient()->writeMqttPacketAndBlameThisClient(pubPack); diff --git a/FlashMQTests/tst_maintests.cpp b/FlashMQTests/tst_maintests.cpp index 997c45a..e85fbbd 100644 --- a/FlashMQTests/tst_maintests.cpp +++ b/FlashMQTests/tst_maintests.cpp @@ -795,7 +795,7 @@ void MainTests::testPacketInt16Parse() for (const uint16_t id : tests) { Publish pub("hallo", "content", 1); - MqttPacket packet(ProtocolVersion::Mqtt311, pub, 0); + MqttPacket packet(ProtocolVersion::Mqtt311, pub); packet.setPacketId(id); packet.pos -= 2; uint16_t idParsed = packet.readTwoBytesToUInt16(); @@ -978,7 +978,7 @@ void MainTests::testSavingSessions() std::shared_ptr c1ses = c1->getSession(); c1.reset(); - MqttPacket publishPacket(ProtocolVersion::Mqtt5, publish, 1); // TODO: subscription identifier, what to do here? + MqttPacket publishPacket(ProtocolVersion::Mqtt5, publish); PublishCopyFactory fac(&publishPacket); c1ses->writePacket(fac, 1, false, publishPacket.getPublishData().subscriptionIdentifier); // TODO: subscription identifier? What to do / test? @@ -1102,7 +1102,7 @@ void MainTests::testParsePacketHelper(const std::string &topic, uint8_t from_qos const std::string payloadOne = getSecureRandomString(len); Publish pubOne(topic, payloadOne, from_qos); pubOne.retain = retain; - MqttPacket stagingPacketOne(ProtocolVersion::Mqtt311, pubOne, 0); + MqttPacket stagingPacketOne(ProtocolVersion::Mqtt311, pubOne); if (from_qos > 0) stagingPacketOne.setPacketId(pack_id); CirBuf stagingBufOne(1024); diff --git a/flashmqtestclient.cpp b/flashmqtestclient.cpp index 17bfb14..fbc0f57 100644 --- a/flashmqtestclient.cpp +++ b/flashmqtestclient.cpp @@ -243,7 +243,7 @@ void FlashMQTestClient::publish(Publish &pub) const uint16_t packet_id = 77; - MqttPacket pubPack(client->getProtocolVersion(), pub, 0); + MqttPacket pubPack(client->getProtocolVersion(), pub); if (pub.qos > 0) pubPack.setPacketId(packet_id); client->writeMqttPacketAndBlameThisClient(pubPack); diff --git a/mqttpacket.cpp b/mqttpacket.cpp index 9f7035b..de36e63 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -107,8 +107,8 @@ MqttPacket::MqttPacket(const UnsubAck &unsubAck) : calculateRemainingLength(); } -MqttPacket::MqttPacket(const ProtocolVersion protocolVersion, const Publish &_publish, const uint32_t subscriptionIdentifier) : - MqttPacket(protocolVersion, _publish, _publish.qos, _publish.topicAlias, _publish.skipTopic, subscriptionIdentifier) +MqttPacket::MqttPacket(const ProtocolVersion protocolVersion, const Publish &_publish) : + MqttPacket(protocolVersion, _publish, _publish.qos, _publish.topicAlias, _publish.skipTopic, _publish.subscriptionIdentifier) { } diff --git a/mqttpacket.h b/mqttpacket.h index 4af2f5d..19ae9b2 100644 --- a/mqttpacket.h +++ b/mqttpacket.h @@ -116,7 +116,7 @@ class MqttPacket MqttPacket(const ConnAck &connAck); MqttPacket(const SubAck &subAck); MqttPacket(const UnsubAck &unsubAck); - MqttPacket(const ProtocolVersion protocolVersion, const Publish &_publish, const uint32_t subscriptionIdentifier); + MqttPacket(const ProtocolVersion protocolVersion, const Publish &_publish); MqttPacket(const ProtocolVersion protocolVersion, const Publish &_publish, const uint8_t _qos, const uint16_t _topic_alias, const bool _skip_topic, const uint32_t subscriptionIdentifier); MqttPacket(const PubResponse &pubAck); diff --git a/retainedmessagesdb.cpp b/retainedmessagesdb.cpp index c6ea7f5..46babd7 100644 --- a/retainedmessagesdb.cpp +++ b/retainedmessagesdb.cpp @@ -83,7 +83,7 @@ void RetainedMessagesDB::saveData(const std::vector &messages) logger->logf(LOG_DEBUG, "Saving retained message for topic '%s' QoS %d, age %d seconds.", rm.publish.topic.c_str(), rm.publish.qos, rm.publish.getAge()); Publish pcopy(rm.publish); - MqttPacket pack(ProtocolVersion::Mqtt5, pcopy, 0); // TODO: subscription identifier + MqttPacket pack(ProtocolVersion::Mqtt5, pcopy); // Dummy, to please the parser on reading. if (pcopy.qos > 0) diff --git a/sessionsandsubscriptionsdb.cpp b/sessionsandsubscriptionsdb.cpp index 88c7733..c5a7ae2 100644 --- a/sessionsandsubscriptionsdb.cpp +++ b/sessionsandsubscriptionsdb.cpp @@ -321,7 +321,7 @@ void SessionsAndSubscriptionsDB::saveData(const std::vectorlogf(LOG_DEBUG, "Saving QoS %d message for topic '%s'.", pub.qos, pub.topic.c_str()); - MqttPacket pack(ProtocolVersion::Mqtt5, pub, 0); // TODO: subscription identifier + MqttPacket pack(ProtocolVersion::Mqtt5, pub); pack.setPacketId(p.getPacketId()); const uint32_t packSize = pack.getSizeIncludingNonPresentHeader(); cirbuf.reset(); @@ -368,7 +368,7 @@ void SessionsAndSubscriptionsDB::saveData(const std::vectorqos > 0)