acl/lib_acl_cpp/include/acl_cpp/mqtt/mqtt_unsubscribe.hpp

50 lines
860 B
C++
Raw Normal View History

2021-03-04 17:37:28 +08:00
#pragma once
#include "mqtt_message.hpp"
namespace acl {
2021-03-07 12:45:22 +08:00
class ACL_CPP_API mqtt_unsubscribe : public mqtt_message {
2021-03-04 17:37:28 +08:00
public:
2021-03-08 15:03:32 +08:00
mqtt_unsubscribe(void);
mqtt_unsubscribe(const mqtt_header& header);
2021-03-04 17:37:28 +08:00
~mqtt_unsubscribe(void);
void set_pkt_id(unsigned short id);
void add_topic(const char* topic);
protected:
// @override
2021-03-04 17:37:28 +08:00
bool to_string(string& out);
// @override
2021-03-04 17:37:28 +08:00
int update(const char* data, int dlen);
// @override
bool is_finished(void) const {
return finished_;
}
2021-03-04 17:37:28 +08:00
public:
int update_header_var(const char* data, int dlen);
int update_topic_len(const char* data, int dlen);
int update_topic_val(const char* data, int dlen);
private:
2021-03-08 15:03:32 +08:00
unsigned status_;
2021-03-04 17:37:28 +08:00
bool finished_;
char buff_[2];
unsigned dlen_;
unsigned short pkt_id_;
std::vector<string> topics_;
unsigned body_len_;
2021-03-04 17:37:28 +08:00
unsigned nread_;
string topic_;
};
} // namespace acl