SNode.C
Loading...
Searching...
No Matches
iot::mqtt_fast::packets::Unsubscribe Class Reference

#include <Unsubscribe.h>

Inheritance diagram for iot::mqtt_fast::packets::Unsubscribe:
Collaboration diagram for iot::mqtt_fast::packets::Unsubscribe:

Public Member Functions

 Unsubscribe (uint16_t packetIdentifier, const std::list< std::string > &topics)
 
 Unsubscribe (iot::mqtt_fast::ControlPacketFactory &controlPacketFactory)
 
uint16_t getPacketIdentifier () const
 
const std::list< std::string > & getTopics () const
 
- Public Member Functions inherited from iot::mqtt_fast::ControlPacket
 ControlPacket (uint8_t type, uint8_t reserved=0)
 
 ControlPacket (iot::mqtt_fast::ControlPacketFactory &controlPacketFactory)
 
 ControlPacket (const ControlPacket &)=delete
 
 ControlPacket (ControlPacket &&)=delete
 
ControlPacketoperator= (const ControlPacket &)=delete
 
ControlPacketoperator= (ControlPacket &&)=delete
 
uint8_t getType () const
 
uint8_t getReserved () const
 
uint64_t getRemainingLength () const
 
std::vector< char > getPacket ()
 
bool isError () const
 

Private Attributes

uint16_t packetIdentifier
 
std::list< std::string > topics
 

Additional Inherited Members

- Protected Member Functions inherited from iot::mqtt_fast::ControlPacket
std::vector< char > & getValue ()
 
uint8_t getInt8 ()
 
uint16_t getInt16 ()
 
uint32_t getInt32 ()
 
uint64_t getInt64 ()
 
uint32_t getIntV ()
 
std::string getString ()
 
std::string getStringRaw ()
 
std::list< uint8_t > getUint8ListRaw ()
 
void putInt8 (uint8_t value)
 
void putInt16 (uint16_t value)
 
void putInt32 (uint32_t value)
 
void putInt64 (uint64_t value)
 
void putIntV (uint32_t value)
 
void putString (const std::string &value)
 
void putStringRaw (const std::string &value)
 
void putUint8ListRaw (const std::list< uint8_t > &value)
 
bool isError ()
 
- Protected Attributes inherited from iot::mqtt_fast::ControlPacket
bool error = false
 

Detailed Description

Definition at line 63 of file Unsubscribe.h.

Constructor & Destructor Documentation

◆ Unsubscribe() [1/2]

iot::mqtt_fast::packets::Unsubscribe::Unsubscribe ( uint16_t  packetIdentifier,
const std::list< std::string > &  topics 
)

Definition at line 50 of file Unsubscribe.cpp.

53 , topics(topics) {
54 // V-Header
56
57 // Payload
58 for (const std::string& topic : this->topics) {
59 putString(topic);
60 }
61 }
void putInt16(uint16_t value)
void putString(const std::string &value)
std::list< std::string > topics
Definition Unsubscribe.h:74
#define MQTT_UNSUBSCRIBE
Definition Unsubscribe.h:59

References iot::mqtt_fast::ControlPacket::ControlPacket(), packetIdentifier, iot::mqtt_fast::ControlPacket::putInt16(), iot::mqtt_fast::ControlPacket::putString(), and topics.

Referenced by iot::mqtt_fast::SocketContext::sendUnsubscribe().

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

◆ Unsubscribe() [2/2]

iot::mqtt_fast::packets::Unsubscribe::Unsubscribe ( iot::mqtt_fast::ControlPacketFactory controlPacketFactory)
explicit

Definition at line 63 of file Unsubscribe.cpp.

64 : iot::mqtt_fast::ControlPacket(controlPacketFactory) {
65 // V-Header
67
68 // Payload
69 for (std::string name = getString(); !name.empty(); name = getString()) {
70 topics.push_back(name);
71 }
72
73 if (!isError()) {
74 error = topics.empty();
75 }
76 }

References iot::mqtt_fast::ControlPacket::ControlPacket(), iot::mqtt_fast::ControlPacket::error, iot::mqtt_fast::ControlPacket::getInt16(), iot::mqtt_fast::ControlPacket::getString(), iot::mqtt_fast::ControlPacket::isError(), packetIdentifier, and topics.

Referenced by iot::mqtt_fast::SocketContext::onReceivedFromPeer().

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

Member Function Documentation

◆ getPacketIdentifier()

uint16_t iot::mqtt_fast::packets::Unsubscribe::getPacketIdentifier ( ) const

Definition at line 78 of file Unsubscribe.cpp.

78 {
79 return packetIdentifier;
80 }

References packetIdentifier.

◆ getTopics()

const std::list< std::string > & iot::mqtt_fast::packets::Unsubscribe::getTopics ( ) const

Definition at line 82 of file Unsubscribe.cpp.

82 {
83 return topics;
84 }

References topics.

Member Data Documentation

◆ packetIdentifier

uint16_t iot::mqtt_fast::packets::Unsubscribe::packetIdentifier
private

Definition at line 73 of file Unsubscribe.h.

Referenced by getPacketIdentifier(), Unsubscribe(), and Unsubscribe().

◆ topics

std::list<std::string> iot::mqtt_fast::packets::Unsubscribe::topics
private

Definition at line 74 of file Unsubscribe.h.

Referenced by getTopics(), Unsubscribe(), and Unsubscribe().


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