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_ack : public mqtt_message {
|
2021-03-04 17:37:28 +08:00
|
|
|
public:
|
|
|
|
mqtt_ack(mqtt_type_t type);
|
|
|
|
virtual ~mqtt_ack(void);
|
|
|
|
|
|
|
|
void set_pkt_id(unsigned short id);
|
|
|
|
|
|
|
|
unsigned short get_pkt_id(void) const {
|
|
|
|
return pkt_id_;
|
|
|
|
}
|
|
|
|
|
2021-03-05 14:30:21 +08:00
|
|
|
protected:
|
|
|
|
// @override
|
2021-03-04 17:37:28 +08:00
|
|
|
bool to_string(string& out);
|
|
|
|
|
2021-03-05 14:30:21 +08:00
|
|
|
// @override
|
2021-03-04 17:37:28 +08:00
|
|
|
int update(const char* data, int dlen);
|
|
|
|
|
2021-03-05 14:30:21 +08:00
|
|
|
// @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);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool finished_;
|
|
|
|
char hbuf_[2];
|
|
|
|
unsigned hlen_;
|
|
|
|
|
|
|
|
unsigned short pkt_id_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace acl
|