acl
3.5.3.0
|
#include <mqtt_client.hpp>
Public 成员函数 | |
mqtt_client (const char *addr, int conn_timeout=10, int rw_timeout=10) | |
mqtt_client (acl::socket_stream &conn) | |
~mqtt_client (void) | |
bool | send (mqtt_message &message) |
mqtt_message * | get_message (void) |
bool | read_header (mqtt_header &header) |
bool | read_message (const mqtt_header &header, mqtt_message &body) |
Public 成员函数 继承自 acl::connect_client | |
connect_client (void) | |
virtual | ~connect_client () |
time_t | get_when () |
void | set_when (time_t when) |
connect_pool * | get_pool () const |
virtual void | set_timeout (int conn_timeout, int rw_timeout) |
Protected 成员函数 | |
bool | open (void) |
Protected 成员函数 继承自 acl::connect_client | |
void | set_pool (connect_pool *pool) |
Protected 成员函数 继承自 acl::acl::noncopyable | |
noncopyable () | |
~noncopyable () | |
额外继承的成员函数 | |
Protected 属性 继承自 acl::connect_client | |
int | conn_timeout_ |
int | rw_timeout_ |
time_t | when_ |
connect_pool * | pool_ |
mqtt communication class in sync mode, used by mqtt client or mqtt server.
在文件 mqtt_client.hpp 第 15 行定义.
acl::mqtt_client::mqtt_client | ( | const char * | addr, |
int | conn_timeout = 10 , |
||
int | rw_timeout = 10 |
||
) |
used to construct one mqtt client for connecting one mqtt server.
addr | {const char*} the mqtt server's addr with the format like ip|port or domain|port. |
conn_timeout | {int} the timeout for connecting mqtt server. |
rw_timeout | {int} the timeout for reading from mqtt connection. |
acl::mqtt_client::mqtt_client | ( | acl::socket_stream & | conn | ) |
used to construct one mqtt client for connecting mqtt server, or receiving from mqtt client.
conn | {acl::socket_stream&} |
acl::mqtt_client::~mqtt_client | ( | void | ) |
mqtt_message* acl::mqtt_client::get_message | ( | void | ) |
read mqtt data from mqtt connection and create the correspondingly mqtt message object with the mqtt type from mqtt header.
|
protectedvirtual |
实现了 acl::connect_client.
bool acl::mqtt_client::read_header | ( | mqtt_header & | header | ) |
read mqtt header information from mqtt connection.
header | {const mqtt_header&} will store the mqtt headeer info. |
bool acl::mqtt_client::read_message | ( | const mqtt_header & | header, |
mqtt_message & | body | ||
) |
read mqtt body information from mqtt connection.
header | {const mqtt_header&} used to parse mqtt body. |
body | {mqtt_message&} will store mqtt body info. |
bool acl::mqtt_client::send | ( | mqtt_message & | message | ) |
send ont mqtt message to the peer mqtt.
message | {mqtt_message&} the mqtt message to be sent, where some viriable method of the mesage will be called, so we can't add the const limit on it. |