SNode.C
Loading...
Searching...
No Matches
iot::mqtt::packets::Subscribe Class Reference

#include <Subscribe.h>

Inheritance diagram for iot::mqtt::packets::Subscribe:
Collaboration diagram for iot::mqtt::packets::Subscribe:

Public Member Functions

 Subscribe ()
 
 Subscribe (uint16_t packetIdentifier, const std::list< iot::mqtt::Topic > &topics)
 
uint16_t getPacketIdentifier () const
 
const std::list< iot::mqtt::Topic > & getTopics () const
 
- Public Member Functions inherited from iot::mqtt::ControlPacket
 ControlPacket (uint8_t type, const std::string &name)
 
 ControlPacket (const ControlPacket &)=default
 
 ControlPacket (ControlPacket &&)=default
 
virtual ~ControlPacket ()
 
ControlPacketoperator= (const ControlPacket &)=default
 
ControlPacketoperator= (ControlPacket &&)=default
 
std::vector< char > serialize () const
 
const std::string & getName () const
 
uint8_t getType () const
 
uint8_t getFlags () const
 

Protected Attributes

iot::mqtt::types::UInt16 packetIdentifier
 
std::list< iot::mqtt::Topictopics
 
- Protected Attributes inherited from iot::mqtt::ControlPacket
uint8_t flags = 0
 

Private Member Functions

std::vector< char > serializeVP () const override
 

Detailed Description

Definition at line 60 of file Subscribe.h.

Constructor & Destructor Documentation

◆ Subscribe() [1/2]

iot::mqtt::packets::Subscribe::Subscribe ( )

Definition at line 56 of file Subscribe.cpp.

58 }
#define MQTT_SUBSCRIBE
Definition Subscribe.h:59

References iot::mqtt::ControlPacket::ControlPacket().

Referenced by Subscribe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Subscribe() [2/2]

iot::mqtt::packets::Subscribe::Subscribe ( uint16_t  packetIdentifier,
const std::list< iot::mqtt::Topic > &  topics 
)

Definition at line 60 of file Subscribe.cpp.

61 : Subscribe() {
63 this->topics = topics;
64 }
std::list< iot::mqtt::Topic > topics
Definition Subscribe.h:75
iot::mqtt::types::UInt16 packetIdentifier
Definition Subscribe.h:73

References iot::mqtt::types::UInt16::operator=(), packetIdentifier, Subscribe(), and topics.

Referenced by iot::mqtt::client::Mqtt::sendSubscribe().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getPacketIdentifier()

uint16_t iot::mqtt::packets::Subscribe::getPacketIdentifier ( ) const

Definition at line 82 of file Subscribe.cpp.

82 {
83 return packetIdentifier;
84 }

References packetIdentifier.

Referenced by iot::mqtt::server::Mqtt::_onSubscribe().

Here is the caller graph for this function:

◆ getTopics()

const std::list< Topic > & iot::mqtt::packets::Subscribe::getTopics ( ) const

Definition at line 86 of file Subscribe.cpp.

86 {
87 return topics;
88 }

References topics.

Referenced by iot::mqtt::server::Mqtt::_onSubscribe().

Here is the caller graph for this function:

◆ serializeVP()

std::vector< char > iot::mqtt::packets::Subscribe::serializeVP ( ) const
overrideprivatevirtual

Implements iot::mqtt::ControlPacket.

Definition at line 66 of file Subscribe.cpp.

66 {
67 std::vector<char> packet(packetIdentifier.serialize());
68
69 for (const Topic& topic : topics) {
70 iot::mqtt::types::String topicString;
71 topicString = topic.getName();
72
73 std::vector<char> tmpPacket = topicString.serialize();
74 packet.insert(packet.end(), tmpPacket.begin(), tmpPacket.end());
75
76 packet.push_back(static_cast<char>(topic.getQoS()));
77 }
78
79 return packet;
80 }
std::vector< char > serialize() const override
Definition String.cpp:97
virtual std::vector< char > serialize() const
Definition TypeBase.hpp:83

References iot::mqtt::Topic::getName(), iot::mqtt::Topic::getQoS(), iot::mqtt::types::String::operator=(), packetIdentifier, iot::mqtt::types::TypeBase< ValueTypeT >::serialize(), iot::mqtt::types::String::serialize(), and topics.

Here is the call graph for this function:

Member Data Documentation

◆ packetIdentifier

iot::mqtt::types::UInt16 iot::mqtt::packets::Subscribe::packetIdentifier
protected

◆ topics

std::list<iot::mqtt::Topic> iot::mqtt::packets::Subscribe::topics
protected

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