Sets up the connection status callback to be invoked representing the status of the connection to IOT Hub. This is a blocking call.


#include "azure-iot-sdk-c/iothub_client/inc/iothub_device_client.h"

IOTHUB_CLIENT_RESULT IoTHubDeviceClient_SetConnectionStatusCallback(
  IOTHUB_DEVICE_CLIENT_HANDLE               iotHubClientHandle,
  void *                                    userContextCallback


  • iotHubClientHandle The handle created by a call to the create function.

  • connectionStatusCallback The callback specified by the device for receiving updates about the status of the connection to IoT Hub.

  • userContextCallback User specified context that will be provided to the callback. This can be NULL.

NOTE: The application behavior is undefined if the user calls the IoTHubDeviceClient_LL_Destroy function from within any callback.

Return Value

IOTHUB_CLIENT_OK upon success or an error code upon failure.