QMqtt Namespace

  • Header: QMqtt

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Mqtt)

    target_link_libraries(mytarget PRIVATE Qt6::Mqtt)

  • qmake: QT += mqtt

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.

Constant

Value

Description

QMqtt::MessageStatus::Unknown

0

The message status is unknown.

QMqtt::MessageStatus::Published

1

The client received a message for one of its subscriptions. This applies to QoS levels 1 and 2.

QMqtt::MessageStatus::Acknowledged

2

A message has been acknowledged. This applies to QoS 1 and states that the message handling has been finished from the client side.

QMqtt::MessageStatus::Received

3

A message has been received. This applies to QoS 2.

QMqtt::MessageStatus::Released

4

A message has been released. This applies to QoS 2. For a publisher the message handling has been finished.

QMqtt::MessageStatus::Completed

5

A message has been completed. This applies to QoS 2 and states that the message handling has been finished from the client side.

enum QMqtt::PayloadFormatIndicator

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

Constant

Value

Description

QMqtt::PayloadFormatIndicator::Unspecified

0

The format is not specified.

QMqtt::PayloadFormatIndicator::UTF8Encoded

1

The payload of the message is formatted as UTF-8 Encoded Character Data.

enum QMqtt::ReasonCode

This enum type specifies the available error codes.

Constant

Value

Description

QMqtt::ReasonCode::Success

0

The specified action has succeeded.

QMqtt::ReasonCode::SubscriptionQoSLevel0

0

A subscription with QoS level 0 has been created.

QMqtt::ReasonCode::SubscriptionQoSLevel1

0x01

A subscription with QoS level 1 has been created.

QMqtt::ReasonCode::SubscriptionQoSLevel2

0x02

A subscription with QoS level 2 has been created.

QMqtt::ReasonCode::NoMatchingSubscriber

0x10

The 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)

0x11

No matching Topic Filter is being used by the Client.

QMqtt::ReasonCode::ContinueAuthentication (since Qt 5.15)

0x18

Continue the authentication with another step.

QMqtt::ReasonCode::ReAuthenticate (since Qt 5.15)

0x19

Initiate a re-authentication.

QMqtt::ReasonCode::UnspecifiedError

0x80

An unspecified error occurred.

QMqtt::ReasonCode::MalformedPacket

0x81

The packet sent to the server is invalid.

QMqtt::ReasonCode::ProtocolError

0x82

A protocol error has occurred. In most cases, this will cause the server to disconnect the client.

QMqtt::ReasonCode::ImplementationSpecificError

0x83

The packet is valid, but the recipient rejects it.

QMqtt::ReasonCode::UnsupportedProtocolVersion

0x84

The requested protocol version is not supported by the server.

QMqtt::ReasonCode::InvalidClientId

0x85

The client ID is invalid.

QMqtt::ReasonCode::InvalidUserNameOrPassword

0x86

The username or password specified is invalid.

QMqtt::ReasonCode::NotAuthorized

0x87

The client is not authorized for the specified action.

QMqtt::ReasonCode::ServerNotAvailable

0x88

The server to connect to is not available.

QMqtt::ReasonCode::ServerBusy

0x89

The server to connect to is not available. The client is asked to try at a later time.

QMqtt::ReasonCode::ClientBanned

0x8A

The client has been banned from the server.

QMqtt::ReasonCode::InvalidAuthenticationMethod

0x8C

The authentication method specified is invalid.

QMqtt::ReasonCode::InvalidTopicFilter

0x8F

The topic filter specified is invalid.

QMqtt::ReasonCode::InvalidTopicName

0x90

The topic name specified is invalid.

QMqtt::ReasonCode::MessageIdInUse

0x91

The message ID used in the previous packet is already