2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
46#include <nlohmann/json.hpp>
62 std::vector<nlohmann::json> publishJsonVector;
63 for (
const auto& [packetIdentifier, publish] :
publishMap) {
64 nlohmann::json publishJson;
66 publishJson[
"packet_identifier"] = packetIdentifier;
73 publishJsonVector.emplace_back(publishJson);
76 if (!publishJsonVector.empty()) {
77 json[
"publish_map"] = publishJsonVector;
90 if (json.contains(
"pubrel_packetidentifier_set")) {
93 if (json.contains(
"publish_packetidentifier_set")) {
96 if (json.contains(
"publish_map")) {
97 for (
const auto& publishJson : json[
"publish_map"]) {
98 if (publishJson.contains(
"packet_identifier")) {
99 publishMap.emplace(publishJson[
"packet_identifier"],
101 publishJson[
"topic"]
,
102 publishJson[
"message"]
,
105 publishJson[
"retain"]
));
std::set< uint16_t > publishPacketIdentifierSet
virtual nlohmann::json toJson() const
std::map< uint16_t, iot::mqtt::packets::Publish > publishMap
Session(const nlohmann::json &json)
void fromJson(const nlohmann::json &json)
std::set< uint16_t > pubrelPacketIdentifierSet
std::string getTopic() const
std::string getMessage() const
Publish(uint16_t packetIdentifier, const std::string &topic, const std::string &message, uint8_t qoS, bool dup, bool retain)