AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
IotMqttCallbackInfo_t Struct Reference

MQTT callback function and context. 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 *pCallbackContext, IotMqttCallbackParam_t *pCallbackParam)
 User-provided callback function signature. More...
 

Detailed Description

MQTT callback function and context.

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

Specifies a function to be invoked with optional context 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 *pCallbackContext, IotMqttCallbackParam_t *pCallbackParam)

User-provided callback function signature.

Parameters
[in]pCallbackContextIotMqttCallbackInfo_t.pCallbackContext.
[in]pCallbackParamDetails 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: