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_Subscribe, IotMqtt_Unsubscribe, and IotMqtt_Publish. 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_Subscribe 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_Publish( &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: