天嵌二次封装库使用手册  V2.1.2
MQTTAsync_message结构体 参考

#include <MQTTAsync.h>

MQTTAsync_message 的协作图:

Public 属性

char struct_id [4]
 
int struct_version
 
int payloadlen
 
void * payload
 
int qos
 
int retained
 
int dup
 
int msgid
 
MQTTProperties properties
 

详细描述

A structure representing the payload and attributes of an MQTT message. The message topic is not part of this structure (see MQTTAsync_publishMessage(), MQTTAsync_publish(), MQTTAsync_receive(), MQTTAsync_freeMessage() and MQTTAsync_messageArrived()).

在文件 MQTTAsync.h261 行定义.

类成员变量说明

int MQTTAsync_message::dup

The dup flag indicates whether or not this message is a duplicate. It is only meaningful when receiving QoS1 messages. When true, the client application should take appropriate action to deal with the duplicate message. This is an output parameter only.

在文件 MQTTAsync.h311 行定义.

int MQTTAsync_message::msgid

The message identifier is reserved for internal use by the MQTT client and server. It is an output parameter only - writing to it will serve no purpose. It contains the MQTT message id of an incoming publish message.

在文件 MQTTAsync.h317 行定义.

void* MQTTAsync_message::payload

A pointer to the payload of the MQTT message.

在文件 MQTTAsync.h271 行定义.

int MQTTAsync_message::payloadlen

The length of the MQTT message payload in bytes.

在文件 MQTTAsync.h269 行定义.

MQTTProperties MQTTAsync_message::properties

The MQTT V5 properties associated with the message.

在文件 MQTTAsync.h321 行定义.

int MQTTAsync_message::qos

The quality of service (QoS) assigned to the message. There are three levels of QoS:

QoS0
Fire and forget - the message may not be delivered
QoS1
At least once - the message will be delivered, but may be delivered more than once in some circumstances.
QoS2
Once and one only - the message will be delivered exactly once.

在文件 MQTTAsync.h285 行定义.

int MQTTAsync_message::retained

The retained flag serves two purposes depending on whether the message it is associated with is being published or received.

retained = true
For messages being published, a true setting indicates that the MQTT server should retain a copy of the message. The message will then be transmitted to new subscribers to a topic that matches the message topic. For subscribers registering a new subscription, the flag being true indicates that the received message is not a new one, but one that has been retained by the MQTT server.

retained = false
For publishers, this indicates that this message should not be retained by the MQTT server. For subscribers, a false setting indicates this is a normal message, received as a result of it being published to the server.

在文件 MQTTAsync.h304 行定义.

char MQTTAsync_message::struct_id[4]

The eyecatcher for this structure. must be MQTM.

在文件 MQTTAsync.h264 行定义.

int MQTTAsync_message::struct_version

The version number of this structure. Must be 0 or 1. 0 indicates no message properties

在文件 MQTTAsync.h267 行定义.


该结构体的文档由以下文件生成: