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

#include <Subscribe.h>

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

Public Member Functions

 Subscribe (uint16_t packetIdentifier, const std::list< iot::mqtt_fast::Topic > &topics)
 
 Subscribe (iot::mqtt_fast::ControlPacketFactory &controlPacketFactory)
 
uint16_t getPacketIdentifier () const
 
const std::list< iot::mqtt_fast::Topic > & 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< iot::mqtt_fast::Topictopics
 

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 41 of file Subscribe.h.

Constructor & Destructor Documentation

◆ Subscribe() [1/2]

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

Definition at line 30 of file Subscribe.cpp.

33 , topics(topics) {
34 // V-Header
36
37 // Payload
38 for (const iot::mqtt_fast::Topic& topic : this->topics) {
39 putString(topic.getName());
40 putInt8(topic.getRequestedQoS());
41 }
42 }
void putInt16(uint16_t value)
void putString(const std::string &value)
std::list< iot::mqtt_fast::Topic > topics
Definition Subscribe.h:52
#define MQTT_SUBSCRIBE
Definition Subscribe.h:37

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

Referenced by Subscribe().

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

◆ Subscribe() [2/2]

iot::mqtt_fast::packets::Subscribe::Subscribe ( iot::mqtt_fast::ControlPacketFactory & controlPacketFactory)
explicit

Definition at line 44 of file Subscribe.cpp.

45 : iot::mqtt_fast::ControlPacket(controlPacketFactory) {
46 // V-Header
48
49 // Payload
50 for (std::string name = getString(); !name.empty(); name = getString()) {
51 const uint8_t requestedQoS = getInt8();
52 topics.emplace_back(name, requestedQoS);
53 }
54
55 if (!isError()) {
56 error = topics.empty();
57 }
58 }

References iot::mqtt_fast::ControlPacket::ControlPacket(), iot::mqtt_fast::ControlPacket::getInt16(), iot::mqtt_fast::ControlPacket::getInt8(), iot::mqtt_fast::ControlPacket::getString(), and packetIdentifier.

Here is the call graph for this function:

Member Function Documentation

◆ getPacketIdentifier()

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

Definition at line 60 of file Subscribe.cpp.

60 {
61 return packetIdentifier;
62 }

References packetIdentifier.

◆ getTopics()

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

Definition at line 64 of file Subscribe.cpp.

64 {
65 return topics;
66 }

Member Data Documentation

◆ packetIdentifier

uint16_t iot::mqtt_fast::packets::Subscribe::packetIdentifier
private

Definition at line 50 of file Subscribe.h.

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

◆ topics

std::list<iot::mqtt_fast::Topic> iot::mqtt_fast::packets::Subscribe::topics
private

Definition at line 52 of file Subscribe.h.


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