QMqtt Namespace

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

Header: #include <QMqtt>
CMake: find_package(Qt6 REQUIRED COMPONENTS Mqtt)
target_link_libraries(mytarget PRIVATE Qt6::Mqtt)
qmake: QT += mqtt
Since: Qt 5.12

Types

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

Detailed Description

Type Documentation

[since 5.12] enum class 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::MessageStatus::Unknown0The message status is unknown.
QMqtt::MessageStatus::Published1The client received a message for one of its subscriptions. This applies to QoS levels 1 and 2.
QMqtt::MessageStatus::Acknowledged2A message has been acknowledged. This applies to QoS 1 and states that the message handling has been finished from the client side.
QMqtt::MessageStatus::Received3A message has been received. This applies to QoS 2.
QMqtt::MessageStatus::Released4A message has been released. This applies to QoS 2. For a publisher the message handling has been finished.
QMqtt::MessageStatus::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.

[since 5.12] enum class 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::PayloadFormatIndicator::Unspecified0The format is not specified.
QMqtt::PayloadFormatIndicator::UTF8Encoded1The payload of the message is formatted as UTF-8 Encoded Character Data.

This enum was introduced or modified in Qt 5.12.

[since 5.12] enum class QMqtt::ReasonCode

This enum type specifies the available error codes.

ConstantValueDescription
QMqtt::ReasonCode::Success0The specified action has succeeded.
QMqtt::ReasonCode::SubscriptionQoSLevel00A subscription with QoS level 0 has been created.
QMqtt::ReasonCode::SubscriptionQoSLevel10x01A subscription with QoS level 1 has been created.
QMqtt::ReasonCode::SubscriptionQoSLevel20x02A subscription with QoS level 2 has been created.
QMqtt::ReasonCode::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::ReasonCode::NoSubscriptionExisted (since Qt 5.15)0x11No matching Topic Filter is being used by the Client.
QMqtt::ReasonCode::ContinueAuthentication (since Qt 5.15)0x18Continue the authentication with another step.
QMqtt::ReasonCode::ReAuthenticate (since Qt 5.15)0x19Initiate a re-authentication.
QMqtt::ReasonCode::UnspecifiedError0x80An unspecified error occurred.
QMqtt::ReasonCode::MalformedPacket0x81The packet sent to the server is invalid.
QMqtt::ReasonCode::ProtocolError0x82A protocol error has occurred. In most cases, this will cause the server to disconnect the client.
QMqtt::ReasonCode::ImplementationSpecificError0x83The packet is valid, but the recipient rejects it.
QMqtt::ReasonCode::UnsupportedProtocolVersion0x84The requested protocol version is not supported by the server.
QMqtt::ReasonCode::InvalidClientId0x85The client ID is invalid.
QMqtt::ReasonCode::InvalidUserNameOrPassword0x86The username or password specified is invalid.
QMqtt::ReasonCode::NotAuthorized0x87The client is not authorized for the specified action.
QMqtt::ReasonCode::ServerNotAvailable0x88The server to connect to is not available.
QMqtt::ReasonCode::ServerBusy0x89The server to connect to is not available. The client is asked to try at a later time.
QMqtt::ReasonCode::ClientBanned0x8AThe client has been banned from the server.
QMqtt::ReasonCode::InvalidAuthenticationMethod0x8CThe authentication method specified is invalid.
QMqtt::ReasonCode::InvalidTopicFilter0x8FThe topic filter specified is invalid.
QMqtt::ReasonCode::InvalidTopicName0x90The topic name specified is invalid.
QMqtt::ReasonCode::MessageIdInUse0x91The message ID used in the previous packet is already in use.
QMqtt::ReasonCode::MessageIdNotFound0x92The message ID used in the previous packet has not been found.
QMqtt::ReasonCode::PacketTooLarge0x95The packet received is too large. See also QMqttServerConnectionProperties::maximumPacketSize().
QMqtt::ReasonCode::QuotaExceeded0x97An administratively imposed limit has been exceeded.
QMqtt::ReasonCode::InvalidPayloadFormat0x99The payload format is invalid. See also QMqttPublishProperties::payloadFormatIndicator().
QMqtt::ReasonCode::RetainNotSupported0x9AThe server does not support retained messages. See also QMqttServerConnectionProperties::retainAvailable().
QMqtt::ReasonCode::QoSNotSupported0x9BThe QoS level requested is not supported. See also QMqttServerConnectionProperties::maximumQoS().
QMqtt::ReasonCode::UseAnotherServer0x9CThe server the client tries to connect to is not available. See also QMqttServerConnectionProperties::serverReference().
QMqtt::ReasonCode::ServerMoved0x9DThe server the client tries to connect to has moved to a new address. See also QMqttServerConnectionProperties::serverReference().
QMqtt::ReasonCode::SharedSubscriptionsNotSupported0x9EShared subscriptions are not supported. See also QMqttServerConnectionProperties::sharedSubscriptionSupported().
QMqtt::ReasonCode::ExceededConnectionRate0x9FThe connection rate limit has been exceeded.
QMqtt::ReasonCode::SubscriptionIdsNotSupported0xA1Subscription IDs are not supported. See also QMqttServerConnectionProperties::subscriptionIdentifierSupported().
QMqtt::ReasonCode::WildCardSubscriptionsNotSupported0xA2Subscriptions using wildcards are not supported by the server. See also QMqttServerConnectionProperties::wildcardSupported().

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.