mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-15 01:10:52 +08:00
56 lines
1012 B
C++
56 lines
1012 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include "mqtt_message.hpp"
|
|
|
|
namespace acl {
|
|
|
|
class ACL_CPP_API mqtt_suback : public mqtt_message {
|
|
public:
|
|
mqtt_suback(void);
|
|
mqtt_suback(const mqtt_header& header);
|
|
~mqtt_suback(void);
|
|
|
|
mqtt_suback& set_pkt_id(unsigned short id);
|
|
mqtt_suback& add_topic_qos(mqtt_qos_t qos);
|
|
mqtt_suback& add_topic_qos(const std::vector<mqtt_qos_t>& qoses);
|
|
|
|
unsigned short get_pkt_id(void) const {
|
|
return pkt_id_;
|
|
}
|
|
|
|
const std::vector<mqtt_qos_t>& get_qoses(void) const {
|
|
return qoses_;
|
|
}
|
|
|
|
protected:
|
|
// @override
|
|
bool to_string(string& out);
|
|
|
|
// @override
|
|
int update(const char* data, int dlen);
|
|
|
|
// @override
|
|
bool finished(void) const {
|
|
return finished_;
|
|
}
|
|
|
|
public:
|
|
int update_header_var(const char* data, int dlen);
|
|
int update_topic_qos(const char* data, int dlen);
|
|
|
|
private:
|
|
unsigned status_;
|
|
bool finished_;
|
|
char buff_[2];
|
|
unsigned dlen_;
|
|
|
|
unsigned short pkt_id_;
|
|
std::vector<mqtt_qos_t> qoses_;
|
|
|
|
unsigned body_len_;
|
|
unsigned nread_;
|
|
};
|
|
|
|
} // namespace acl
|