acl
3.5.3.0
mqtt_unsubscribe.hpp
浏览该文件的文档.
1
#pragma once
2
3
#include "
mqtt_message.hpp
"
4
5
namespace
acl
{
6
7
/**
8
* mqtt message object for MQTT_UNSUBSCRIBE type.
9
*/
10
class
ACL_CPP_API
mqtt_unsubscribe
:
public
mqtt_message
{
11
public
:
12
/**
13
* constructor for creating MQTT_PUBACK mqtt message object.
14
* @see mqtt_message
15
*/
16
mqtt_unsubscribe
(
void
);
17
18
/**
19
* constructor for creating MQTT_PUBACK mqtt message object.
20
* @see mqtt_message
21
*/
22
mqtt_unsubscribe
(
const
mqtt_header
& header);
23
24
~
mqtt_unsubscribe
(
void
);
25
26
/**
27
* set the message id.
28
* @param id {unsigned short} should > 0 && <= 65535.
29
* @return {mqtt_unsubscribe&}
30
*/
31
mqtt_unsubscribe
& set_pkt_id(
unsigned
short
id
);
32
33
/**
34
* set the message's topic.
35
* @param topic {const char*}
36
* @return {mqtt_unsubscribe&}
37
*/
38
mqtt_unsubscribe
& add_topic(
const
char
* topic);
39
40
protected
:
41
// @override
42
bool
to_string(
string
& out);
43
44
// @override
45
int
update(
const
char
* data,
int
dlen);
46
47
// @override
48
bool
finished
(
void
)
const
{
49
return
finished_;
50
}
51
52
public
:
53
// used internal to parse unsubscribe message in streaming mode.
54
55
int
update_header_var(
const
char
* data,
int
dlen);
56
int
update_topic_len(
const
char
* data,
int
dlen);
57
int
update_topic_val(
const
char
* data,
int
dlen);
58
59
private
:
60
unsigned
status_;
61
bool
finished_;
62
char
buff_[2];
63
unsigned
dlen_;
64
65
unsigned
short
pkt_id_;
66
std::vector<string> topics_;
67
68
unsigned
body_len_;
69
unsigned
nread_;
70
71
string
topic_;
72
};
73
74
}
// namespace acl
75
acl::mqtt_unsubscribe::finished
bool finished(void) const
Definition:
mqtt_unsubscribe.hpp:48
acl
Definition:
acl_cpp_init.hpp:4
acl::mqtt_message
Definition:
mqtt_message.hpp:14
acl::mqtt_unsubscribe
Definition:
mqtt_unsubscribe.hpp:10
acl::mqtt_header
Definition:
mqtt_header.hpp:71
mqtt_message.hpp
ACL_CPP_API
#define ACL_CPP_API
Definition:
acl_cpp_define.hpp:16
include
acl_cpp
mqtt
mqtt_unsubscribe.hpp
生成于 2021年 九月 10日 星期五 11:14:44 , 为 acl使用
1.8.15