AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
Enumerated types

Enumerated types of the MQTT library. More...

Enumerations

enum  IotMqttError_t {
  IOT_MQTT_SUCCESS = 0, IOT_MQTT_STATUS_PENDING = 1, IOT_MQTT_INIT_FAILED = 2, IOT_MQTT_BAD_PARAMETER = 3,
  IOT_MQTT_NO_MEMORY = 4, IOT_MQTT_NETWORK_ERROR = 5, IOT_MQTT_SCHEDULING_ERROR = 6, IOT_MQTT_BAD_RESPONSE = 7,
  IOT_MQTT_TIMEOUT = 8, IOT_MQTT_SERVER_REFUSED = 9, IOT_MQTT_RETRY_NO_RESPONSE = 10, IOT_MQTT_NOT_INITIALIZED = 11
}
 Return codes of MQTT functions. More...
 
enum  IotMqttOperationType_t {
  IOT_MQTT_CONNECT, IOT_MQTT_PUBLISH_TO_SERVER, IOT_MQTT_PUBACK, IOT_MQTT_SUBSCRIBE,
  IOT_MQTT_UNSUBSCRIBE, IOT_MQTT_PINGREQ, IOT_MQTT_DISCONNECT
}
 Types of MQTT operations. More...
 
enum  IotMqttQos_t { IOT_MQTT_QOS_0 = 0, IOT_MQTT_QOS_1 = 1, IOT_MQTT_QOS_2 = 2 }
 Quality of service levels for MQTT PUBLISH messages. More...
 
enum  IotMqttDisconnectReason_t { IOT_MQTT_DISCONNECT_CALLED, IOT_MQTT_BAD_PACKET_RECEIVED, IOT_MQTT_KEEP_ALIVE_TIMEOUT }
 The reason that an MQTT connection (and its associated network connection) was disconnected. More...
 

Detailed Description

Enumerated types of the MQTT library.

Enumeration Type Documentation

◆ IotMqttError_t

Return codes of MQTT functions.

The function IotMqtt_strerror can be used to get a return code's description.

Enumerator
IOT_MQTT_SUCCESS 

MQTT operation completed successfully.

Functions that may return this value:

Will also be the value of an operation completion callback's IotMqttCallbackParam_t.result when successful.

IOT_MQTT_STATUS_PENDING 

MQTT operation queued, awaiting result.

Functions that may return this value:

IOT_MQTT_INIT_FAILED 

Initialization failed.

Functions that may return this value:

IOT_MQTT_BAD_PARAMETER 

At least one parameter is invalid.

Functions that may return this value:

IOT_MQTT_NO_MEMORY 

MQTT operation failed because of memory allocation failure.

Functions that may return this value:

IOT_MQTT_NETWORK_ERROR 

MQTT operation failed because the network was unusable.

This return value may indicate that the network is disconnected.

Functions that may return this value:

May also be the value of an operation completion callback's IotMqttCallbackParam_t.result.

IOT_MQTT_SCHEDULING_ERROR 

MQTT operation could not be scheduled, i.e. enqueued for sending.

Functions that may return this value:

IOT_MQTT_BAD_RESPONSE 

MQTT response packet received from the network is malformed.

Functions that may return this value:

May also be the value of an operation completion callback's IotMqttCallbackParam_t.result.

Note
If this value is received, the network connection has been closed.
IOT_MQTT_TIMEOUT 

A blocking MQTT operation timed out.

Functions that may return this value:

IOT_MQTT_SERVER_REFUSED 

A CONNECT or at least one subscription was refused by the server.

Functions that may return this value:

May also be the value of an operation completion callback's IotMqttCallbackParam_t.result for a SUBSCRIBE.

Note
If this value is returned and multiple subscriptions were passed to IotMqtt_SubscribeAsync (or IotMqtt_SubscribeSync), it's still possible that some of the subscriptions succeeded. This value only signifies that AT LEAST ONE subscription was rejected. The function IotMqtt_IsSubscribed can be used to determine which subscriptions were accepted or rejected.
IOT_MQTT_RETRY_NO_RESPONSE 

A QoS 1 PUBLISH received no response and the retry limit was reached.

Functions that may return this value:

May also be the value of an operation completion callback's IotMqttCallbackParam_t.result for a QoS 1 PUBLISH.

IOT_MQTT_NOT_INITIALIZED 

An API function was called before IotMqtt_Init.

Functions that may return this value:

◆ IotMqttOperationType_t

Types of MQTT operations.

The function IotMqtt_OperationType can be used to get an operation type's description.

Enumerator
IOT_MQTT_CONNECT 

Client-to-server CONNECT.

IOT_MQTT_PUBLISH_TO_SERVER 

Client-to-server PUBLISH.

IOT_MQTT_PUBACK 

Client-to-server PUBACK.

IOT_MQTT_SUBSCRIBE 

Client-to-server SUBSCRIBE.

IOT_MQTT_UNSUBSCRIBE 

Client-to-server UNSUBSCRIBE.

IOT_MQTT_PINGREQ 

Client-to-server PINGREQ.

IOT_MQTT_DISCONNECT 

Client-to-server DISCONNECT.

◆ IotMqttQos_t

Quality of service levels for MQTT PUBLISH messages.

All MQTT PUBLISH messages, including Last Will and Testament and messages received on subscription filters, have an associated Quality of Service, which defines any delivery guarantees for that message.

  • QoS 0 messages will be delivered at most once. This is a "best effort" transmission with no retransmissions.
  • QoS 1 messages will be delivered at least once. See IotMqttPublishInfo_t for the retransmission strategy this library uses to redeliver messages assumed to be lost.
Attention
QoS 2 is not supported by this library and should not be used.
Enumerator
IOT_MQTT_QOS_0 

Delivery at most once.

IOT_MQTT_QOS_1 

Delivery at least once. See IotMqttPublishInfo_t for client-side retry strategy.

IOT_MQTT_QOS_2 

Delivery exactly once. Unsupported, but enumerated for completeness.

◆ IotMqttDisconnectReason_t

The reason that an MQTT connection (and its associated network connection) was disconnected.

When an MQTT connection is closed, its associated disconnect callback will be invoked. This type is passed inside of an IotMqttCallbackParam_t to provide a reason for the disconnect.

Enumerator
IOT_MQTT_DISCONNECT_CALLED 

IotMqtt_Disconnect was invoked.

IOT_MQTT_BAD_PACKET_RECEIVED 

An invalid packet was received from the network.

IOT_MQTT_KEEP_ALIVE_TIMEOUT 

Keep-alive response was not received within IOT_MQTT_RESPONSE_WAIT_MS.