Microsoft Azure IoTHub client libraries

Dependents:   sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more

This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks

Committer:
AzureIoTClient
Date:
Mon Jun 11 15:39:23 2018 -0700
Revision:
88:248736be106e
Child:
89:a2ed767a532e
1.2.5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzureIoTClient 88:248736be106e 1 // Copyright (c) Microsoft. All rights reserved.
AzureIoTClient 88:248736be106e 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
AzureIoTClient 88:248736be106e 3
AzureIoTClient 88:248736be106e 4 /** @file iothub_client.h
AzureIoTClient 88:248736be106e 5 * @brief Extends the IoTHubCLient_LL module with additional features.
AzureIoTClient 88:248736be106e 6 *
AzureIoTClient 88:248736be106e 7 * @details IoTHubClient is a module that extends the IoTHubCLient_LL
AzureIoTClient 88:248736be106e 8 * module with 2 features:
AzureIoTClient 88:248736be106e 9 * - scheduling the work for the IoTHubCLient from a
AzureIoTClient 88:248736be106e 10 * thread, so that the user does not need to create their
AzureIoTClient 88:248736be106e 11 * own thread
AzureIoTClient 88:248736be106e 12 * - thread-safe APIs
AzureIoTClient 88:248736be106e 13 */
AzureIoTClient 88:248736be106e 14
AzureIoTClient 88:248736be106e 15 #ifndef IOTHUB_CLIENT_H
AzureIoTClient 88:248736be106e 16 #define IOTHUB_CLIENT_H
AzureIoTClient 88:248736be106e 17
AzureIoTClient 88:248736be106e 18 #include <stddef.h>
AzureIoTClient 88:248736be106e 19 #include <stdint.h>
AzureIoTClient 88:248736be106e 20
AzureIoTClient 88:248736be106e 21 #include "azure_c_shared_utility/umock_c_prod.h"
AzureIoTClient 88:248736be106e 22 #include "iothub_transport_ll.h"
AzureIoTClient 88:248736be106e 23 #include "iothub_client_core_ll.h"
AzureIoTClient 88:248736be106e 24 #include "iothub_client_core.h"
AzureIoTClient 88:248736be106e 25 #include "iothub_device_client_ll.h"
AzureIoTClient 88:248736be106e 26
AzureIoTClient 88:248736be106e 27 #ifndef IOTHUB_DEVICE_CLIENT_INSTANCE_TYPE
AzureIoTClient 88:248736be106e 28 typedef IOTHUB_CLIENT_CORE_HANDLE IOTHUB_DEVICE_CLIENT_HANDLE;
AzureIoTClient 88:248736be106e 29 #define IOTHUB_DEVICE_CLIENT_INSTANCE_TYPE
AzureIoTClient 88:248736be106e 30 #endif // IOTHUB_CLIENT_INSTANCE
AzureIoTClient 88:248736be106e 31
AzureIoTClient 88:248736be106e 32
AzureIoTClient 88:248736be106e 33 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 34 extern "C"
AzureIoTClient 88:248736be106e 35 {
AzureIoTClient 88:248736be106e 36 #endif
AzureIoTClient 88:248736be106e 37
AzureIoTClient 88:248736be106e 38 /**
AzureIoTClient 88:248736be106e 39 * @brief Creates a IoT Hub client for communication with an existing
AzureIoTClient 88:248736be106e 40 * IoT Hub using the specified connection string parameter.
AzureIoTClient 88:248736be106e 41 *
AzureIoTClient 88:248736be106e 42 * @param connectionString Pointer to a character string
AzureIoTClient 88:248736be106e 43 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 44 *
AzureIoTClient 88:248736be106e 45 * Sample connection string:
AzureIoTClient 88:248736be106e 46 * <blockquote>
AzureIoTClient 88:248736be106e 47 * <pre>HostName=[IoT Hub name goes here].[IoT Hub suffix goes here, e.g., private.azure-devices-int.net];DeviceId=[Device ID goes here];SharedAccessKey=[Device key goes here];</pre>
AzureIoTClient 88:248736be106e 48 * <pre>HostName=[IoT Hub name goes here].[IoT Hub suffix goes here, e.g., private.azure-devices-int.net];DeviceId=[Device ID goes here];SharedAccessSignature=SharedAccessSignature sr=[IoT Hub name goes here].[IoT Hub suffix goes here, e.g., private.azure-devices-int.net]/devices/[Device ID goes here]&sig=[SAS Token goes here]&se=[Expiry Time goes here];</pre>
AzureIoTClient 88:248736be106e 49 * </blockquote>
AzureIoTClient 88:248736be106e 50 *
AzureIoTClient 88:248736be106e 51 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_HANDLE value that is used when
AzureIoTClient 88:248736be106e 52 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 53 */
AzureIoTClient 88:248736be106e 54 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_HANDLE, IoTHubDeviceClient_CreateFromConnectionString, const char*, connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol);
AzureIoTClient 88:248736be106e 55
AzureIoTClient 88:248736be106e 56 /**
AzureIoTClient 88:248736be106e 57 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 58 * Hub using the specified parameters.
AzureIoTClient 88:248736be106e 59 *
AzureIoTClient 88:248736be106e 60 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 88:248736be106e 61 *
AzureIoTClient 88:248736be106e 62 * The API does not allow sharing of a connection across multiple
AzureIoTClient 88:248736be106e 63 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 64 *
AzureIoTClient 88:248736be106e 65 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_HANDLE value that is used when
AzureIoTClient 88:248736be106e 66 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 67 */
AzureIoTClient 88:248736be106e 68 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_HANDLE, IoTHubDeviceClient_Create, const IOTHUB_CLIENT_CONFIG*, config);
AzureIoTClient 88:248736be106e 69
AzureIoTClient 88:248736be106e 70 /**
AzureIoTClient 88:248736be106e 71 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 72 * Hub using the specified parameters.
AzureIoTClient 88:248736be106e 73 *
AzureIoTClient 88:248736be106e 74 * @param transportHandle TRANSPORT_HANDLE which represents a connection.
AzureIoTClient 88:248736be106e 75 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 88:248736be106e 76 *
AzureIoTClient 88:248736be106e 77 * The API allows sharing of a connection across multiple
AzureIoTClient 88:248736be106e 78 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 79 *
AzureIoTClient 88:248736be106e 80 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_HANDLE value that is used when
AzureIoTClient 88:248736be106e 81 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 82 */
AzureIoTClient 88:248736be106e 83 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_HANDLE, IoTHubDeviceClient_CreateWithTransport, TRANSPORT_HANDLE, transportHandle, const IOTHUB_CLIENT_CONFIG*, config);
AzureIoTClient 88:248736be106e 84
AzureIoTClient 88:248736be106e 85 /**
AzureIoTClient 88:248736be106e 86 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 87 * Hub using the device auth module.
AzureIoTClient 88:248736be106e 88 *
AzureIoTClient 88:248736be106e 89 * @param iothub_uri Pointer to an ioThub hostname received in the registration process
AzureIoTClient 88:248736be106e 90 * @param device_id Pointer to the device Id of the device
AzureIoTClient 88:248736be106e 91 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 92 *
AzureIoTClient 88:248736be106e 93 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_HANDLE value that is used when
AzureIoTClient 88:248736be106e 94 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 95 */
AzureIoTClient 88:248736be106e 96 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_HANDLE, IoTHubDeviceClient_CreateFromDeviceAuth, const char*, iothub_uri, const char*, device_id, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol);
AzureIoTClient 88:248736be106e 97
AzureIoTClient 88:248736be106e 98 /**
AzureIoTClient 88:248736be106e 99 * @brief Disposes of resources allocated by the IoT Hub client. This is a
AzureIoTClient 88:248736be106e 100 * blocking call.
AzureIoTClient 88:248736be106e 101 *
AzureIoTClient 88:248736be106e 102 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 103 */
AzureIoTClient 88:248736be106e 104 MOCKABLE_FUNCTION(, void, IoTHubDeviceClient_Destroy, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle);
AzureIoTClient 88:248736be106e 105
AzureIoTClient 88:248736be106e 106 /**
AzureIoTClient 88:248736be106e 107 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
AzureIoTClient 88:248736be106e 108 *
AzureIoTClient 88:248736be106e 109 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 110 * @param eventMessageHandle The handle to an IoT Hub message.
AzureIoTClient 88:248736be106e 111 * @param eventConfirmationCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 112 * confirmation of the delivery of the IoT Hub message.
AzureIoTClient 88:248736be106e 113 * This callback can be expected to invoke the
AzureIoTClient 88:248736be106e 114 * ::IoTHubDeviceClient_SendEventAsync function for the
AzureIoTClient 88:248736be106e 115 * same message in an attempt to retry sending a failing
AzureIoTClient 88:248736be106e 116 * message. The user can specify a @c NULL value here to
AzureIoTClient 88:248736be106e 117 * indicate that no callback is required.
AzureIoTClient 88:248736be106e 118 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 119 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 120 *
AzureIoTClient 88:248736be106e 121 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 122 * the ::IoTHubDeviceClient_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 123 *
AzureIoTClient 88:248736be106e 124 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 125 */
AzureIoTClient 88:248736be106e 126 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SendEventAsync, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_MESSAGE_HANDLE, eventMessageHandle, IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK, eventConfirmationCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 127
AzureIoTClient 88:248736be106e 128 /**
AzureIoTClient 88:248736be106e 129 * @brief This function returns the current sending status for IoTHubClient.
AzureIoTClient 88:248736be106e 130 *
AzureIoTClient 88:248736be106e 131 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 132 * @param iotHubClientStatus The sending state is populated at the address pointed
AzureIoTClient 88:248736be106e 133 * at by this parameter. The value will be set to
AzureIoTClient 88:248736be106e 134 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
AzureIoTClient 88:248736be106e 135 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
AzureIoTClient 88:248736be106e 136 * if there are.
AzureIoTClient 88:248736be106e 137 *
AzureIoTClient 88:248736be106e 138 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 139 */
AzureIoTClient 88:248736be106e 140 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_GetSendStatus, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_STATUS*, iotHubClientStatus);
AzureIoTClient 88:248736be106e 141
AzureIoTClient 88:248736be106e 142 /**
AzureIoTClient 88:248736be106e 143 * @brief Sets up the message callback to be invoked when IoT Hub issues a
AzureIoTClient 88:248736be106e 144 * message to the device. This is a blocking call.
AzureIoTClient 88:248736be106e 145 *
AzureIoTClient 88:248736be106e 146 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 147 * @param messageCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 148 * messages from IoT Hub.
AzureIoTClient 88:248736be106e 149 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 150 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 151 *
AzureIoTClient 88:248736be106e 152 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 153 * the ::IoTHubDeviceClient_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 154 *
AzureIoTClient 88:248736be106e 155 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 156 */
AzureIoTClient 88:248736be106e 157 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetMessageCallback, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC, messageCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 158
AzureIoTClient 88:248736be106e 159 /**
AzureIoTClient 88:248736be106e 160 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 161 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 162 *
AzureIoTClient 88:248736be106e 163 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 164 * @param connectionStatusCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 165 * updates about the status of the connection to IoT Hub.
AzureIoTClient 88:248736be106e 166 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 167 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 168 *
AzureIoTClient 88:248736be106e 169 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 170 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 171 *
AzureIoTClient 88:248736be106e 172 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 173 */
AzureIoTClient 88:248736be106e 174 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetConnectionStatusCallback, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK, connectionStatusCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 175
AzureIoTClient 88:248736be106e 176 /**
AzureIoTClient 88:248736be106e 177 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 178 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 179 *
AzureIoTClient 88:248736be106e 180 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 181 * @param retryPolicy The policy to use to reconnect to IoT Hub when a
AzureIoTClient 88:248736be106e 182 * connection drops.
AzureIoTClient 88:248736be106e 183 * @param retryTimeoutLimitInSeconds Maximum amount of time(seconds) to attempt reconnection when a
AzureIoTClient 88:248736be106e 184 * connection drops to IOT Hub.
AzureIoTClient 88:248736be106e 185 *
AzureIoTClient 88:248736be106e 186 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 187 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 188 *
AzureIoTClient 88:248736be106e 189 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 190 */
AzureIoTClient 88:248736be106e 191 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetRetryPolicy, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY, retryPolicy, size_t, retryTimeoutLimitInSeconds);
AzureIoTClient 88:248736be106e 192
AzureIoTClient 88:248736be106e 193 /**
AzureIoTClient 88:248736be106e 194 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 195 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 196 *
AzureIoTClient 88:248736be106e 197 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 198 * @param retryPolicy Out parameter containing the policy to use to reconnect to IoT Hub.
AzureIoTClient 88:248736be106e 199 * @param retryTimeoutLimitInSeconds Out parameter containing maximum amount of time in seconds to attempt reconnection
AzureIoTClient 88:248736be106e 200 to IOT Hub.
AzureIoTClient 88:248736be106e 201 *
AzureIoTClient 88:248736be106e 202 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 203 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 204 *
AzureIoTClient 88:248736be106e 205 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 206 */
AzureIoTClient 88:248736be106e 207 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_GetRetryPolicy, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY*, retryPolicy, size_t*, retryTimeoutLimitInSeconds);
AzureIoTClient 88:248736be106e 208
AzureIoTClient 88:248736be106e 209 /**
AzureIoTClient 88:248736be106e 210 * @brief This function returns in the out parameter @p lastMessageReceiveTime
AzureIoTClient 88:248736be106e 211 * what was the value of the @c time function when the last message was
AzureIoTClient 88:248736be106e 212 * received at the client.
AzureIoTClient 88:248736be106e 213 *
AzureIoTClient 88:248736be106e 214 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 215 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
AzureIoTClient 88:248736be106e 216 * when the last message was received.
AzureIoTClient 88:248736be106e 217 *
AzureIoTClient 88:248736be106e 218 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 219 */
AzureIoTClient 88:248736be106e 220 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_GetLastMessageReceiveTime, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, time_t*, lastMessageReceiveTime);
AzureIoTClient 88:248736be106e 221
AzureIoTClient 88:248736be106e 222 /**
AzureIoTClient 88:248736be106e 223 * @brief This API sets a runtime option identified by parameter @p optionName
AzureIoTClient 88:248736be106e 224 * to a value pointed to by @p value. @p optionName and the data type
AzureIoTClient 88:248736be106e 225 * @p value is pointing to are specific for every option.
AzureIoTClient 88:248736be106e 226 *
AzureIoTClient 88:248736be106e 227 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 228 * @param optionName Name of the option.
AzureIoTClient 88:248736be106e 229 * @param value The value.
AzureIoTClient 88:248736be106e 230 *
AzureIoTClient 88:248736be106e 231 * The options that can be set via this API are:
AzureIoTClient 88:248736be106e 232 * - @b timeout - the maximum time in milliseconds a communication is
AzureIoTClient 88:248736be106e 233 * allowed to use. @p value is a pointer to an @c unsigned @c int with
AzureIoTClient 88:248736be106e 234 * the timeout value in milliseconds. This is only supported for the HTTP
AzureIoTClient 88:248736be106e 235 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
AzureIoTClient 88:248736be106e 236 * the parameter is <em>total request time</em>. When the HTTP protocol uses
AzureIoTClient 88:248736be106e 237 * winhttp, the meaning is the same as the @c dwSendTimeout and
AzureIoTClient 88:248736be106e 238 * @c dwReceiveTimeout parameters of the
AzureIoTClient 88:248736be106e 239 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
AzureIoTClient 88:248736be106e 240 * WinHttpSetTimeouts</a> API.
AzureIoTClient 88:248736be106e 241 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 242 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 243 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 244 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 245 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 246 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 247 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 248 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 249 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 250 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 251 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 252 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 253 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 254 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 255 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 256 * - @b messageTimeout - the maximum time in milliseconds until a message
AzureIoTClient 88:248736be106e 257 * is timeouted. The time starts at IoTHubDeviceClient_SendEventAsync. By default,
AzureIoTClient 88:248736be106e 258 * messages do not expire. @p is a pointer to a uint64_t
AzureIoTClient 88:248736be106e 259 * - @b svc2cl_keep_alive_timeout_secs - the AMQP service side keep alive interval in seconds.
AzureIoTClient 88:248736be106e 260 * After the connection established the client requests the server to set the
AzureIoTClient 88:248736be106e 261 * keep alive interval for given time.
AzureIoTClient 88:248736be106e 262 * If it is not set then the default 240 sec applies.
AzureIoTClient 88:248736be106e 263 * If it is set to zero the server will not send keep alive messages to the client.
AzureIoTClient 88:248736be106e 264 * - @b cl2svc_keep_alive_send_ratio - the AMQP client side keep alive interval in seconds.
AzureIoTClient 88:248736be106e 265 * After the connection established the server requests the client to set the
AzureIoTClient 88:248736be106e 266 * keep alive interval for given time.
AzureIoTClient 88:248736be106e 267 * If it is not set then the default ratio of 1/2 is applied.
AzureIoTClient 88:248736be106e 268 * The ratio has to be greater than 0.0 and equal to or less than 0.9
AzureIoTClient 88:248736be106e 269
AzureIoTClient 88:248736be106e 270 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 271 */
AzureIoTClient 88:248736be106e 272 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetOption, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, const char*, optionName, const void*, value);
AzureIoTClient 88:248736be106e 273
AzureIoTClient 88:248736be106e 274 /**
AzureIoTClient 88:248736be106e 275 * @brief This API specifies a call back to be used when the device receives a state update.
AzureIoTClient 88:248736be106e 276 *
AzureIoTClient 88:248736be106e 277 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 278 * @param deviceTwinCallback The callback specified by the device client to be used for updating
AzureIoTClient 88:248736be106e 279 * the desired state. The callback will be called in response to a
AzureIoTClient 88:248736be106e 280 * request send by the IoTHub services. The payload will be passed to the
AzureIoTClient 88:248736be106e 281 * callback, along with two version numbers:
AzureIoTClient 88:248736be106e 282 * - Desired:
AzureIoTClient 88:248736be106e 283 * - LastSeenReported:
AzureIoTClient 88:248736be106e 284 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 285 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 286 *
AzureIoTClient 88:248736be106e 287 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 288 * the ::IoTHubDeviceClient_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 289 *
AzureIoTClient 88:248736be106e 290 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 291 */
AzureIoTClient 88:248736be106e 292 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetDeviceTwinCallback, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK, deviceTwinCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 293
AzureIoTClient 88:248736be106e 294 /**
AzureIoTClient 88:248736be106e 295 * @brief This API sends a report of the device's properties and their current values.
AzureIoTClient 88:248736be106e 296 *
AzureIoTClient 88:248736be106e 297 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 298 * @param reportedState The current device property values to be 'reported' to the IoTHub.
AzureIoTClient 88:248736be106e 299 * @param reportedStateCallback The callback specified by the device client to be called with the
AzureIoTClient 88:248736be106e 300 * result of the transaction.
AzureIoTClient 88:248736be106e 301 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 302 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 303 *
AzureIoTClient 88:248736be106e 304 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 305 * the ::IoTHubDeviceClient_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 306 *
AzureIoTClient 88:248736be106e 307 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 308 */
AzureIoTClient 88:248736be106e 309 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SendReportedState, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, const unsigned char*, reportedState, size_t, size, IOTHUB_CLIENT_REPORTED_STATE_CALLBACK, reportedStateCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 310
AzureIoTClient 88:248736be106e 311 /**
AzureIoTClient 88:248736be106e 312 * @brief This API sets callback for async cloud to device method call.
AzureIoTClient 88:248736be106e 313 *
AzureIoTClient 88:248736be106e 314 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 315 * @param inboundDeviceMethodCallback The callback which will be called by IoTHub.
AzureIoTClient 88:248736be106e 316 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 317 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 318 *
AzureIoTClient 88:248736be106e 319 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 320 */
AzureIoTClient 88:248736be106e 321 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_SetDeviceMethodCallback, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_METHOD_CALLBACK_ASYNC, deviceMethodCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 322
AzureIoTClient 88:248736be106e 323 /**
AzureIoTClient 88:248736be106e 324 * @brief This API responses to a asnyc method callback identified the methodId.
AzureIoTClient 88:248736be106e 325 *
AzureIoTClient 88:248736be106e 326 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 327 * @param methodId The methodId of the Device Method callback.
AzureIoTClient 88:248736be106e 328 * @param response The response data for the method callback.
AzureIoTClient 88:248736be106e 329 * @param response_size The size of the response data buffer.
AzureIoTClient 88:248736be106e 330 * @param status_response The status response of the method callback.
AzureIoTClient 88:248736be106e 331 *
AzureIoTClient 88:248736be106e 332 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 333 */
AzureIoTClient 88:248736be106e 334 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_DeviceMethodResponse, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, METHOD_HANDLE, methodId, const unsigned char*, response, size_t, response_size, int, statusCode);
AzureIoTClient 88:248736be106e 335
AzureIoTClient 88:248736be106e 336 #ifndef DONT_USE_UPLOADTOBLOB
AzureIoTClient 88:248736be106e 337 /**
AzureIoTClient 88:248736be106e 338 * @brief IoTHubDeviceClient_UploadToBlobAsync uploads data from memory to a file in Azure Blob Storage.
AzureIoTClient 88:248736be106e 339 *
AzureIoTClient 88:248736be106e 340 * @param iotHubClientHandle The handle created by a call to the IoTHubDeviceClient_Create function.
AzureIoTClient 88:248736be106e 341 * @param destinationFileName The name of the file to be created in Azure Blob Storage.
AzureIoTClient 88:248736be106e 342 * @param source The source of data.
AzureIoTClient 88:248736be106e 343 * @param size The size of data.
AzureIoTClient 88:248736be106e 344 * @param iotHubClientFileUploadCallback A callback to be invoked when the file upload operation has finished.
AzureIoTClient 88:248736be106e 345 * @param context A user-provided context to be passed to the file upload callback.
AzureIoTClient 88:248736be106e 346 *
AzureIoTClient 88:248736be106e 347 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 348 */
AzureIoTClient 88:248736be106e 349 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_UploadToBlobAsync, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, const char*, destinationFileName, const unsigned char*, source, size_t, size, IOTHUB_CLIENT_FILE_UPLOAD_CALLBACK, iotHubClientFileUploadCallback, void*, context);
AzureIoTClient 88:248736be106e 350
AzureIoTClient 88:248736be106e 351 /**
AzureIoTClient 88:248736be106e 352 * @brief Uploads a file to a Blob storage in chunks, fed through the callback function provided by the user.
AzureIoTClient 88:248736be106e 353 * @remarks This function allows users to upload large files in chunks, not requiring the whole file content to be passed in memory.
AzureIoTClient 88:248736be106e 354 * @param iotHubClientHandle The handle created by a call to the IoTHubDeviceClient_Create function.
AzureIoTClient 88:248736be106e 355 * @param destinationFileName The name of the file to be created in Azure Blob Storage.
AzureIoTClient 88:248736be106e 356 * @param getDataCallbackEx A callback to be invoked to acquire the file chunks to be uploaded, as well as to indicate the status of the upload of the previous block.
AzureIoTClient 88:248736be106e 357 * @param context Any data provided by the user to serve as context on getDataCallback.
AzureIoTClient 88:248736be106e 358 * @returns An IOTHUB_CLIENT_RESULT value indicating the success or failure of the API call.
AzureIoTClient 88:248736be106e 359 */
AzureIoTClient 88:248736be106e 360 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_UploadMultipleBlocksToBlobAsync, IOTHUB_DEVICE_CLIENT_HANDLE, iotHubClientHandle, const char*, destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX, getDataCallbackEx, void*, context);
AzureIoTClient 88:248736be106e 361
AzureIoTClient 88:248736be106e 362 #endif /* DONT_USE_UPLOADTOBLOB */
AzureIoTClient 88:248736be106e 363
AzureIoTClient 88:248736be106e 364 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 365 }
AzureIoTClient 88:248736be106e 366 #endif
AzureIoTClient 88:248736be106e 367
AzureIoTClient 88:248736be106e 368 #endif /* IOTHUB_CLIENT_H */