34 Publish::
Publish(uint16_t packetIdentifier,
const std::string& topic,
const std::string& message, uint8_t qoS,
bool dup,
bool retain)
36 this->flags =
static_cast<uint8_t>((dup ? 0x08 : 0x00) | ((qoS << 1) & 0x06) | (retain ? 0x01 : 0x00));
37 this->packetIdentifier = packetIdentifier;
39 this->message = message;
46 std::vector<
char> packet(topic.serialize());
49 std::vector<
char> tmpVector = packetIdentifier.serialize();
50 packet.insert(packet.end(), tmpVector.begin(), tmpVector.end());
53 std::vector<
char> tmpVector = message.serialize();
54 packet.insert(packet.end(), tmpVector.begin(), tmpVector.end());