MQTTSuite
Loading...
Searching...
No Matches
mqtt::mqttbroker::lib Namespace Reference

Classes

struct  subscribe
struct  unsubscribe
struct  retaine
struct  release
class  Mqtt
class  MqttModel

Functions

static void to_json (nlohmann::json &j, const Mqtt *mqtt)
static void to_json (nlohmann::json &j, const subscribe &subscribe)
static void to_json (nlohmann::json &j, const unsubscribe &unsubscribe)
static void to_json (nlohmann::json &j, const retaine &retaine)
static void to_json (nlohmann::json &j, const release &release)

Function Documentation

◆ to_json() [1/5]

void mqtt::mqttbroker::lib::to_json ( nlohmann::json & j,
const Mqtt * mqtt )
static

Definition at line 97 of file MqttModel.cpp.

97 {
98 j = {{"clientId", mqtt->getClientId()},
99 {"connectionName", mqtt->getConnectionName()},
100 {"cleanSession", mqtt->getCleanSession()},
101 {"connectFlags", mqtt->getConnectFlags()},
102 {"username", mqtt->getUsername()},
103 {"usernameFlag", mqtt->getUsernameFlag()},
104 {"password", mqtt->getPassword()},
105 {"passwordFlag", mqtt->getPasswordFlag()},
106 {"keepAlive", mqtt->getKeepAlive()},
107 {"protocol", mqtt->getProtocol()},
108 {"protocolLevel", mqtt->getLevel()},
109 {"loopPrevention", !mqtt->getReflect()},
110 {"willMessage", mqtt->getWillMessage()},
111 {"willTopic", mqtt->getWillTopic()},
112 {"willQoS", mqtt->getWillQoS()},
113 {"willFlag", mqtt->getWillFlag()},
114 {"willRetain", mqtt->getWillRetain()},
115 {"since", mqtt->getMqttContext()->getSocketConnection()->getSocketContext()->getOnlineSince()},
116 {"duration", mqtt->getMqttContext()->getSocketConnection()->getSocketContext()->getOnlineDuration()},
117 {"localAddress", mqtt->getMqttContext()->getSocketConnection()->getLocalAddress().toString()},
118 {"remoteAddress", mqtt->getMqttContext()->getSocketConnection()->getRemoteAddress().toString()}};
119 }

◆ to_json() [2/5]

void mqtt::mqttbroker::lib::to_json ( nlohmann::json & j,
const release & release )
static

Definition at line 154 of file MqttModel.cpp.

154 {
155 j = {{"topic", release.topic}};
156 }
const std::string & topic

References mqtt::mqttbroker::lib::release::topic.

◆ to_json() [3/5]

void mqtt::mqttbroker::lib::to_json ( nlohmann::json & j,
const retaine & retaine )
static

Definition at line 146 of file MqttModel.cpp.

146 {
147 j = {{"topic", retaine.topic}, {"message", retaine.message}, {"qos", retaine.qoS}};
148 }
const std::string & topic
const std::string & message

References mqtt::mqttbroker::lib::retaine::message, mqtt::mqttbroker::lib::retaine::qoS, and mqtt::mqttbroker::lib::retaine::topic.

◆ to_json() [4/5]

void mqtt::mqttbroker::lib::to_json ( nlohmann::json & j,
const subscribe & subscribe )
static

◆ to_json() [5/5]

void mqtt::mqttbroker::lib::to_json ( nlohmann::json & j,
const unsubscribe & unsubscribe )
static

Definition at line 136 of file MqttModel.cpp.

136 {
137 j = {{"clientId", unsubscribe.clientId}, {"topic", unsubscribe.topic}};
138 }

References mqtt::mqttbroker::lib::unsubscribe::clientId, and mqtt::mqttbroker::lib::unsubscribe::topic.