MQTT API Reference
MQTT 3.1.1 client library
IotMqttCallbackInfo_t Struct Reference

Information on a user-provided MQTT callback function. More...

#include <iot_mqtt_types.h>

Data Fields

void * pCallbackContext
 The first parameter to pass to the callback function to provide context.
 
void(* function )(void *, IotMqttCallbackParam_t *)
 User-provided callback function signature. More...
 

Detailed Description

Information on a user-provided MQTT callback function.

Parameter for: IotMqtt_SubscribeAsync, IotMqtt_UnsubscribeAsync, and IotMqtt_PublishAsync. Cannot be used with IOT_MQTT_FLAG_WAITABLE.

Provides a function to be invoked when an operation completes or when a server-to-client PUBLISH is received.

All instances of IotMqttCallbackInfo_t should be initialized with IOT_MQTT_CALLBACK_INFO_INITIALIZER.

Below is an example for receiving an asynchronous notification on operation completion. See IotMqtt_SubscribeAsync for an example of using this struct with for incoming PUBLISH messages.

// Operation completion callback.
void operationComplete( void * pArgument, IotMqttCallbackParam_t * pOperation );
// Callback information.
callbackInfo.function = operationComplete;
// Operation to wait for.
IotMqttError_t result = IotMqtt_PublishAsync( &mqttConnection,
&publishInfo,
0,
&callbackInfo,
&reference );
// Publish should have returned IOT_MQTT_STATUS_PENDING. Once a response
// is received, operationComplete is executed with the actual status passed
// in pOperation.

Field Documentation

◆ function

void( * IotMqttCallbackInfo_t::function) (void *, IotMqttCallbackParam_t *)

User-provided callback function signature.

Parameters
[in]void* IotMqttCallbackInfo_t.pCallbackContext
[in]IotMqttCallbackParam_t* Details on the outcome of the MQTT operation or an incoming MQTT PUBLISH.
See also
IotMqttCallbackParam_t for more information on the second parameter.

The documentation for this struct was generated from the following file:
IotMqttError_t
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:103
IotMqttCallbackInfo_t
Information on a user-provided MQTT callback function.
Definition: iot_mqtt_types.h:516
IotMqtt_PublishAsync
IotMqttError_t IotMqtt_PublishAsync(IotMqttConnection_t mqttConnection, const IotMqttPublishInfo_t *pPublishInfo, uint32_t flags, const IotMqttCallbackInfo_t *pCallbackInfo, IotMqttOperation_t *const pPublishOperation)
Publishes a message to the given topic name and receive an asynchronous notification when the publish...
Definition: iot_mqtt_api.c:1595
IOT_MQTT_CALLBACK_INFO_INITIALIZER
#define IOT_MQTT_CALLBACK_INFO_INITIALIZER
Initializer for IotMqttCallbackInfo_t.
Definition: iot_mqtt_types.h:1067
IotMqttCallbackParam_t
Parameter to an MQTT callback function.
Definition: iot_mqtt_types.h:443
IotMqttCallbackInfo_t::function
void(* function)(void *, IotMqttCallbackParam_t *)
User-provided callback function signature.
Definition: iot_mqtt_types.h:529