QMqtt Namespace

Contains miscellaneous identifiers used throughout the Qt MQTT module. More...

Header: #include <QMqtt>
qmake: QT += mqtt
Since: Qt 5.12

This namespace was introduced in Qt 5.12.

Types

enum MessageStatus { Unknown, Published, Acknowledged, Received, Released, Completed }
enum PayloadFormatIndicator { Unspecified, UTF8Encoded }
enum ReasonCode { Success, SubscriptionQoSLevel0, SubscriptionQoSLevel1, SubscriptionQoSLevel2, ..., WildCardSubscriptionsNotSupported }

Detailed Description

Type Documentation

enum QMqtt::MessageStatus

This enum type specifies the available states of a message. Depending on the QoS and role of the client, different message statuses are expected.

ConstantValueDescription
QMqtt::Unknown0The message status is unknown.
QMqtt::Published1The client received a message for one of its subscriptions. This applies to all QoS levels.
QMqtt::Acknowledged2A message has been acknowledged. This applies to QoS 1 and states that the message handling has been finished from the client side.
QMqtt::Received3A message has been received. This applies to QoS 2.
QMqtt::Released4A message has been released. This applies to QoS 2. For a publisher the message handling has been finished.
QMqtt::Completed5A message has been completed. This applies to QoS 2 and states that the message handling has been finished from the client side.

This enum was introduced or modified in Qt 5.12.

enum QMqtt::PayloadFormatIndicator

The payload format provides information on the content of a message. This can help other clients to handle the message faster.

ConstantValueDescription
QMqtt::Unspecified0The format is not specified.
QMqtt::UTF8Encoded1The payload of the message is formatted as UTF-8 Encoded Character Data.

This enum was introduced or modified in Qt 5.12.

enum QMqtt::ReasonCode

This enum type specifies the available error codes.

ConstantValueDescription
QMqtt::Success0The specified action has succeeded.
QMqtt::SubscriptionQoSLevel00A subscription with QoS level 0 has been created.
QMqtt::SubscriptionQoSLevel10x01A subscription with QoS level 1 has been created.
QMqtt::SubscriptionQoSLevel20x02A subscription with QoS level 2 has been created.
QMqtt::NoMatchingSubscriber0x10The message has been accepted by the server, but there are no subscribers to receive this message. A broker may send this reason code instead of Success.
QMqtt::UnspecifiedError0x80An unspecified error occurred.
QMqtt::MalformedPacket0x81The packet sent to the server is invalid.
QMqtt::ProtocolError0x82A protocol error has occurred. In most cases, this will cause the server to disconnect the client.
QMqtt::ImplementationSpecificError0x83The packet is valid, but the recipient rejects it.
QMqtt::UnsupportedProtocolVersion0x84The requested protocol version is not supported by the server.
QMqtt::InvalidClientId0x85The client ID is invalid.
QMqtt::InvalidUserNameOrPassword0x86The username or password specified is invalid.
QMqtt::NotAuthorized0x87The client is not authorized for the specified action.
QMqtt::ServerNotAvailable0x88The server to connect to is not available.
QMqtt::ServerBusy0x89The server to connect to is not available. The client is asked to try at a later time.
QMqtt::ClientBanned0x8AThe client has been banned from the server.
QMqtt::InvalidAuthenticationMethod0x8CThe authentication method specified is invalid.
QMqtt::InvalidTopicFilter0x8FThe topic filter specified is invalid.
QMqtt::InvalidTopicName0x90The topic name specified is invalid.
QMqtt::MessageIdInUse0x91The message ID used in the previous packet is already in use.
QMqtt::MessageIdNotFound0x92The message ID used in the previous packet has not been found.
QMqtt::PacketTooLarge0x95The packet received is too large. See also QMqttServerConnectionProperties::maximumPacketSize().
QMqtt::QuotaExceeded0x97An administratively imposed limit has been exceeded.
QMqtt::InvalidPayloadFormat0x99The payload format is invalid.
QMqtt::RetainNotSupported0x9AThe server does not support retained messages.
QMqtt::QoSNotSupported0x9BThe QoS level requested is not supported.
QMqtt::UseAnotherServer0x9CThe server the client tries to connect to is not available. See also QMqttServerConnectionProperties::serverReference().
QMqtt::ServerMoved0x9DThe server the client tries to connect to has moved to a new address. See also QMqttServerConnectionProperties::serverReference().
QMqtt::SharedSubscriptionsNotSupported0x9EShared subscriptions are not supported.
QMqtt::ExceededConnectionRate0x9FThe connection rate limit has been exceeded.
QMqtt::SubscriptionIdsNotSupported0xA1Subscription IDs are not supported.
QMqtt::WildCardSubscriptionsNotSupported0xA2Subscriptions using wildcards are not supported by the server.

Not all values are available in every use case. Especially, some servers will reject a reason code not suited for a specific command. See below table to highlight expected reason codes for specific actions.

Reason CodeConnect PropertiesSubscription PropertiesMessage Properties
SuccessXXX
SubscriptionQoSLevel0X
SubscriptionQoSLevel1X
SubscriptionQoSLevel2X
NoMatchingSubscriberX
UnspecifiedErrorXXX
MalformedPacketX
ProtocolErrorX
ImplementationSpecificErrorXXX
UnsupportedProtocolVersionX
InvalidClientIdX
InvalidUserNameOrPasswordX
NotAuthorizedXXX
ServerNotAvailableX
ServerBusyX
ClientBannedX
InvalidAuthenticationMethodX
InvalidTopicFilterX
InvalidTopicNameXX
MessageIdInUseXX
MessageIdNotFoundX
PacketTooLargeX
QuotaExceededXXX
InvalidPayloadFormatXX
RetainNotSupportedX
QoSNotSupportedX
UseAnotherServerX
ServerMovedX
SharedSubscriptionsNotSupportedX
ExceededConnectionRateX
SubscriptionIdsNotSupportedX
WildCardSubscriptionsNotSupportedX

This enum was introduced or modified in Qt 5.12.

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