QMqttLastWillProperties Class
QMqttLastWillProperties 类表示QMqttClient 在连接服务器时指定最后意愿时可传递给服务器的配置选项。更多
Header: | #include <QMqttLastWillProperties> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Mqtt) target_link_libraries(mytarget PRIVATE Qt6::Mqtt) |
qmake: | QT += mqtt |
公共函数
QString | contentType() const |
QByteArray | correlationData() const |
quint32 | messageExpiryInterval() const |
QMqtt::PayloadFormatIndicator | payloadFormatIndicator() const |
QString | responseTopic() const |
void | setContentType(const QString &content) |
void | setCorrelationData(const QByteArray &correlation) |
void | setMessageExpiryInterval(quint32 expiry) |
void | setPayloadFormatIndicator(QMqtt::PayloadFormatIndicator p) |
void | setResponseTopic(const QString &response) |
void | setUserProperties(const QMqttUserProperties &properties) |
void | setWillDelayInterval(quint32 delay) |
QMqttUserProperties | userProperties() const |
quint32 | willDelayInterval() const |
详细说明
注意: Last Will 属性是 MQTT 5.0 规范的一部分,在连接较低协议级别时无法使用。更多信息请参阅QMqttClient::ProtocolVersion 。
成员函数文档
QString QMqttLastWillProperties::contentType() const
返回最后一条 will 消息的内容类型。
另请参阅 setContentType()。
QByteArray QMqttLastWillProperties::correlationData() const
返回用于识别请求的相关数据。
另请参阅 setCorrelationData()。
quint32 QMqttLastWillProperties::messageExpiryInterval() const
以秒为单位返回最后一条意愿信息的有效期,从意愿延迟时间间隔开始计算。
另请参阅 setMessageExpiryInterval()。
QMqtt::PayloadFormatIndicator QMqttLastWillProperties::payloadFormatIndicator() const
返回有效载荷格式指示符。
另请参阅 setPayloadFormatIndicator().
QString QMqttLastWillProperties::responseTopic() const
返回最后一条 will 消息的订阅者应回复的主题。
另请参阅 setResponseTopic()。
void QMqttLastWillProperties::setContentType(const QString &content)
将内容类型设为content 。
另请参阅 contentType() 。
void QMqttLastWillProperties::setCorrelationData(const QByteArray &correlation)
将相关数据设置为correlation 。
另请参阅 correlationData() 。
void QMqttLastWillProperties::setMessageExpiryInterval(quint32 expiry)
将信息过期时间间隔设置为expiry 。
另请参阅 messageExpiryInterval() 。
void QMqttLastWillProperties::setPayloadFormatIndicator(QMqtt::PayloadFormatIndicator p)
将有效载荷格式指示符设置为p 。
另请参阅 payloadFormatIndicator() 。
void QMqttLastWillProperties::setResponseTopic(const QString &response)
将回复主题设置为response 。
另请参阅 responseTopic() 。
void QMqttLastWillProperties::setUserProperties(const QMqttUserProperties &properties)
将用户属性设置为properties 。
另请参阅 userProperties() 。
void QMqttLastWillProperties::setWillDelayInterval(quint32 delay)
将延迟时间间隔设置为delay 。
另请参阅 willDelayInterval() 。
QMqttUserProperties QMqttLastWillProperties::userProperties() const
返回用户属性。
另请参阅 setUserProperties()。
quint32 QMqttLastWillProperties::willDelayInterval() const
返回断开服务器连接后发送最后一条意愿消息的延迟时间(以秒为单位)。
另请参阅 setWillDelayInterval()。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.