SNode.C
Loading...
Searching...
No Matches
iot::mqtt::server::broker::Message Class Reference

#include <Message.h>

Collaboration diagram for iot::mqtt::server::broker::Message:

Public Member Functions

 Message ()=default
 
 Message (const std::string &originClientId, const std::string &topic, const std::string &message, uint8_t qoS, bool originRetain)
 
 Message (const Message &message)=default
 
Messageoperator= (const Message &)=default
 
const std::string & getOriginClientId () const
 
const std::string & getTopic () const
 
void setTopic (const std::string &topic)
 
const std::string & getMessage () const
 
void setMessage (const std::string &message)
 
uint8_t getQoS () const
 
void setQoS (uint8_t qoS)
 
bool getOriginRetain () const
 
nlohmann::json toJson () const
 
MessagefromJson (const nlohmann::json &json)
 

Private Attributes

std::string originClientId
 
std::string topic
 
std::string message
 
uint8_t qoS = 0
 
bool originRetain = false
 

Detailed Description

Definition at line 55 of file Message.h.

Constructor & Destructor Documentation

◆ Message() [1/3]

iot::mqtt::server::broker::Message::Message ( )
default

Referenced by iot::mqtt::server::broker::Session::fromJson(), and iot::mqtt::server::broker::RetainTree::TopicLevel::release().

Here is the caller graph for this function:

◆ Message() [2/3]

iot::mqtt::server::broker::Message::Message ( const std::string &  originClientId,
const std::string &  topic,
const std::string &  message,
uint8_t  qoS,
bool  originRetain 
)

Definition at line 53 of file Message.cpp.

References message, originClientId, originRetain, qoS, and topic.

Referenced by iot::mqtt::server::broker::Broker::publish().

Here is the caller graph for this function:

◆ Message() [3/3]

iot::mqtt::server::broker::Message::Message ( const Message message)
default

Member Function Documentation

◆ fromJson()

Message & iot::mqtt::server::broker::Message::fromJson ( const nlohmann::json &  json)

Definition at line 105 of file Message.cpp.

105 {
106 if (!json.empty()) {
107 originClientId = json["origin_client_id"];
108 topic = json["topic"];
109 message = json["message"];
110 qoS = json["qos"];
111 }
112
113 return *this;
114 }

References message, originClientId, qoS, and topic.

Referenced by iot::mqtt::server::broker::RetainTree::TopicLevel::fromJson(), and iot::mqtt::server::broker::Session::fromJson().

Here is the caller graph for this function:

◆ getMessage()

◆ getOriginClientId()

const std::string & iot::mqtt::server::broker::Message::getOriginClientId ( ) const

Definition at line 62 of file Message.cpp.

62 {
63 return originClientId;
64 }

References originClientId.

Referenced by iot::mqtt::server::broker::Session::sendPublish().

Here is the caller graph for this function:

◆ getOriginRetain()

bool iot::mqtt::server::broker::Message::getOriginRetain ( ) const

Definition at line 90 of file Message.cpp.

90 {
91 return originRetain;
92 }

References originRetain.

Referenced by iot::mqtt::server::broker::Session::sendPublish().

Here is the caller graph for this function:

◆ getQoS()

uint8_t iot::mqtt::server::broker::Message::getQoS ( ) const

Definition at line 82 of file Message.cpp.

82 {
83 return qoS;
84 }

References qoS.

Referenced by iot::mqtt::server::broker::RetainTree::TopicLevel::appear(), iot::mqtt::server::broker::RetainTree::TopicLevel::appear(), iot::mqtt::server::broker::Session::publishQueued(), iot::mqtt::server::broker::RetainTree::TopicLevel::retain(), and iot::mqtt::server::broker::Session::sendPublish().

Here is the caller graph for this function:

◆ getTopic()

const std::string & iot::mqtt::server::broker::Message::getTopic ( ) const

◆ operator=()

Message & iot::mqtt::server::broker::Message::operator= ( const Message )
default

Referenced by iot::mqtt::server::broker::RetainTree::TopicLevel::release(), and iot::mqtt::server::broker::RetainTree::TopicLevel::retain().

Here is the caller graph for this function:

◆ setMessage()

void iot::mqtt::server::broker::Message::setMessage ( const std::string &  message)

Definition at line 78 of file Message.cpp.

78 {
79 this->message = message;
80 }

References message.

◆ setQoS()

void iot::mqtt::server::broker::Message::setQoS ( uint8_t  qoS)

Definition at line 86 of file Message.cpp.

86 {
87 this->qoS = qoS;
88 }

References qoS.

Referenced by iot::mqtt::server::broker::Session::sendPublish().

Here is the caller graph for this function:

◆ setTopic()

void iot::mqtt::server::broker::Message::setTopic ( const std::string &  topic)

Definition at line 70 of file Message.cpp.

70 {
71 this->topic = topic;
72 }

References topic.

◆ toJson()

nlohmann::json iot::mqtt::server::broker::Message::toJson ( ) const

Definition at line 94 of file Message.cpp.

94 {
95 nlohmann::json json;
96
97 json["origin_client_id"] = originClientId;
98 json["topic"] = topic;
99 json["message"] = message;
100 json["qos"] = qoS;
101
102 return json;
103 }

References message, originClientId, qoS, and topic.

Referenced by iot::mqtt::server::broker::RetainTree::TopicLevel::toJson(), and iot::mqtt::server::broker::Session::toJson().

Here is the caller graph for this function:

Member Data Documentation

◆ message

std::string iot::mqtt::server::broker::Message::message
private

Definition at line 82 of file Message.h.

Referenced by fromJson(), getMessage(), Message(), setMessage(), and toJson().

◆ originClientId

std::string iot::mqtt::server::broker::Message::originClientId
private

Definition at line 80 of file Message.h.

Referenced by fromJson(), getOriginClientId(), Message(), and toJson().

◆ originRetain

bool iot::mqtt::server::broker::Message::originRetain = false
private

Definition at line 84 of file Message.h.

Referenced by getOriginRetain(), and Message().

◆ qoS

uint8_t iot::mqtt::server::broker::Message::qoS = 0
private

Definition at line 83 of file Message.h.

Referenced by fromJson(), getQoS(), Message(), setQoS(), and toJson().

◆ topic

std::string iot::mqtt::server::broker::Message::topic
private

Definition at line 81 of file Message.h.

Referenced by fromJson(), getTopic(), Message(), setTopic(), and toJson().


The documentation for this class was generated from the following files: