Commit 5a2f52b78da9e67c8d60e642980515af19de3a0b
1 parent
7870dc8a
Document PublishBase::getLengthWithoutFixedHeader()
Showing
1 changed file
with
8 additions
and
0 deletions
types.cpp
| @@ -121,6 +121,14 @@ PublishBase::PublishBase(const std::string &topic, const std::string &payload, c | @@ -121,6 +121,14 @@ PublishBase::PublishBase(const std::string &topic, const std::string &payload, c | ||
| 121 | 121 | ||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | +/** | ||
| 125 | + * @brief PublishBase::getLengthWithoutFixedHeader gets the size for packet buffer allocation, but without the MQTT5 properties. | ||
| 126 | + * @return | ||
| 127 | + * | ||
| 128 | + * The protocol version is not part of the Publish object, because it's used to send publishes to MQTT3 and MQTT5 clients, so that | ||
| 129 | + * has to be added later. See the `MqttPacket::MqttPacket(const ProtocolVersion protocolVersion, Publish &_publish)` | ||
| 130 | + * constructor. | ||
| 131 | + */ | ||
| 124 | size_t PublishBase::getLengthWithoutFixedHeader() const | 132 | size_t PublishBase::getLengthWithoutFixedHeader() const |
| 125 | { | 133 | { |
| 126 | const int topicLength = this->skipTopic ? 0 : topic.length(); | 134 | const int topicLength = this->skipTopic ? 0 : topic.length(); |