QMqttAuthenticationProperties Class

QMqttAuthenticationProperties 类表示身份验证过程中的配置选项。更多

头文件: #include <QMqttAuthenticationProperties>
CMake: find_package(Qt6 REQUIRED COMPONENTS Mqtt)
target_link_libraries(mytarget PRIVATE Qt6::Mqtt)
qmake: QT += mqtt

公共函数

QByteArray authenticationData() const
QString authenticationMethod() const
QString reason() const
void setAuthenticationData(const QByteArray &adata)
void setAuthenticationMethod(const QString &method)
void setReason(const QString &r)
void setUserProperties(const QMqttUserProperties &user)
QMqttUserProperties userProperties() const

详细说明

注意: 验证属性是 MQTT 5.0 规范的一部分,在使用较低协议级别进行连接时无法使用。更多信息请参阅QMqttClient::ProtocolVersion

成员函数文档

QByteArray QMqttAuthenticationProperties::authenticationData() const

返回身份验证数据

另请参阅 setAuthenticationData()。

QString QMqttAuthenticationProperties::authenticationMethod() const

返回身份验证方法。

另请参阅 setAuthenticationMethod()。

QString QMqttAuthenticationProperties::reason() const

返回原因字符串。原因字符串指明断开连接的原因。

另请参阅 setReason()。

void QMqttAuthenticationProperties::setAuthenticationData(const QByteArray &adata)

将身份验证数据设置为adata

只有指定了身份验证方法,才能使用身份验证数据。

另请参阅 authenticationData() 和authenticationMethod()。

void QMqttAuthenticationProperties::setAuthenticationMethod(const QString &method)

将身份验证方法设置为method

另请参阅 authenticationMethod() 。

void QMqttAuthenticationProperties::setReason(const QString &r)

将原因字符串设置为r

另请参阅 reason() 。

void QMqttAuthenticationProperties::setUserProperties(const QMqttUserProperties &user)

将用户属性设置为user

另请参阅 userProperties() 。

QMqttUserProperties QMqttAuthenticationProperties::userProperties() const

返回用户属性。

另请参阅 setUserProperties()。

© 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.