MQTT API Reference
MQTT 3.1.1 client library
Constants

Defined constants of the MQTT library.

Libraries may #define constants in their headers with special meanings. This page describes the meanings and uses of any constants defined by the MQTT library. Related constants are shown in a single section on this page.

MQTT Initializers

Provides default values for the data types of the MQTT library.

#define IOT_MQTT_NETWORK_INFO_INITIALIZER { .createNetworkConnection = true }
#define IOT_MQTT_SERIALIZER_INITIALIZER { 0 }
#define IOT_MQTT_CONNECT_INFO_INITIALIZER { .cleanSession = true }
#define IOT_MQTT_PUBLISH_INFO_INITIALIZER { .qos = IOT_MQTT_QOS_0 }
#define IOT_MQTT_SUBSCRIPTION_INITIALIZER { .qos = IOT_MQTT_QOS_0 }
#define IOT_MQTT_CALLBACK_INFO_INITIALIZER { 0 }
#define IOT_MQTT_CONNECTION_INITIALIZER NULL
#define IOT_MQTT_OPERATION_INITIALIZER NULL

All user-facing data types of the MQTT library should be initialized using one of the following.

Warning
Failing to initialize an MQTT data type with the appropriate initializer may result in undefined behavior!
Note
The initializers may change at any time in future versions, but their names will remain the same.

Example

MQTT Function Flags

Flags that modify the behavior of MQTT library functions.

Flags should be bitwise-ORed with each other to change the behavior of IotMqtt_SubscribeAsync, IotMqtt_UnsubscribeAsync, IotMqtt_PublishAsync, their blocking versions; or IotMqtt_Disconnect.

Note
The values of the flags may change at any time in future versions, but their names will remain the same. Additionally, flags that may be used together will be bitwise-exclusive of each other.
IOT_MQTT_CONNECT_INFO_INITIALIZER
#define IOT_MQTT_CONNECT_INFO_INITIALIZER
Initializer for IotMqttConnectInfo_t.
Definition: iot_mqtt_types.h:1061
IotMqttCallbackInfo_t
Information on a user-provided MQTT callback function.
Definition: iot_mqtt_types.h:516
IotMqttOperation_t
struct _mqttOperation * IotMqttOperation_t
Opaque handle that references an in-progress MQTT operation.
Definition: iot_mqtt_types.h:88
IOT_MQTT_NETWORK_INFO_INITIALIZER
#define IOT_MQTT_NETWORK_INFO_INITIALIZER
Initializer for IotMqttNetworkInfo_t.
Definition: iot_mqtt_types.h:1057
IotMqttConnection_t
struct _mqttConnection * IotMqttConnection_t
Opaque handle of an MQTT connection.
Definition: iot_mqtt_types.h:66
IOT_MQTT_CONNECTION_INITIALIZER
#define IOT_MQTT_CONNECTION_INITIALIZER
Initializer for IotMqttConnection_t.
Definition: iot_mqtt_types.h:1069
IotMqttNetworkInfo_t
Infomation on the transport-layer network connection for the new MQTT connection.
Definition: iot_mqtt_types.h:930
IotMqttSerializer_t
Function pointers for MQTT packet serializer overrides.
Definition: iot_mqtt_types.h:715
IOT_MQTT_CALLBACK_INFO_INITIALIZER
#define IOT_MQTT_CALLBACK_INFO_INITIALIZER
Initializer for IotMqttCallbackInfo_t.
Definition: iot_mqtt_types.h:1067
IotMqttSubscription_t
Information on an MQTT subscription.
Definition: iot_mqtt_types.h:550
IOT_MQTT_SERIALIZER_INITIALIZER
#define IOT_MQTT_SERIALIZER_INITIALIZER
Initializer for IotMqttSerializer_t.
Definition: iot_mqtt_types.h:1059
IOT_MQTT_SUBSCRIPTION_INITIALIZER
#define IOT_MQTT_SUBSCRIPTION_INITIALIZER
Initializer for IotMqttSubscription_t.
Definition: iot_mqtt_types.h:1065
IotMqttPublishInfo_t
Information on a PUBLISH message.
Definition: iot_mqtt_types.h:397
IOT_MQTT_PUBLISH_INFO_INITIALIZER
#define IOT_MQTT_PUBLISH_INFO_INITIALIZER
Initializer for IotMqttPublishInfo_t.
Definition: iot_mqtt_types.h:1063
IotMqttConnectInfo_t
Information on a new MQTT connection.
Definition: iot_mqtt_types.h:585
IOT_MQTT_OPERATION_INITIALIZER
#define IOT_MQTT_OPERATION_INITIALIZER
Initializer for IotMqttOperation_t.
Definition: iot_mqtt_types.h:1071