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:
91:bbf806070c5f
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_ll.h
AzureIoTClient 88:248736be106e 5 * @brief APIs that allow a user (usually a device) to communicate
AzureIoTClient 88:248736be106e 6 * with an Azure IoTHub.
AzureIoTClient 88:248736be106e 7 *
AzureIoTClient 88:248736be106e 8 * @details IoTHubDeviceClient_LL is a module that allows a user (usually a
AzureIoTClient 88:248736be106e 9 * device) to communicate with an Azure IoTHub. It can send events
AzureIoTClient 88:248736be106e 10 * and receive messages. At any given moment in time there can only
AzureIoTClient 88:248736be106e 11 * be at most 1 message callback function.
AzureIoTClient 88:248736be106e 12 *
AzureIoTClient 88:248736be106e 13 * This API surface contains a set of APIs that allows the user to
AzureIoTClient 88:248736be106e 14 * interact with the lower layer portion of the IoTHubClient. These APIs
AzureIoTClient 88:248736be106e 15 * contain @c _LL_ in their name, but retain the same functionality like the
AzureIoTClient 88:248736be106e 16 * @c IoTHubDeviceClient_... APIs, with one difference. If the @c _LL_ APIs are
AzureIoTClient 88:248736be106e 17 * used then the user is responsible for scheduling when the actual work done
AzureIoTClient 88:248736be106e 18 * by the IoTHubClient happens (when the data is sent/received on/from the wire).
AzureIoTClient 88:248736be106e 19 * This is useful for constrained devices where spinning a separate thread is
AzureIoTClient 88:248736be106e 20 * often not desired.
AzureIoTClient 88:248736be106e 21 */
AzureIoTClient 88:248736be106e 22
AzureIoTClient 88:248736be106e 23 #ifndef IOTHUB_DEVICE_CLIENT_LL_H
AzureIoTClient 88:248736be106e 24 #define IOTHUB_DEVICE_CLIENT_LL_H
AzureIoTClient 88:248736be106e 25
AzureIoTClient 88:248736be106e 26 #include <stddef.h>
AzureIoTClient 88:248736be106e 27 #include <stdint.h>
AzureIoTClient 88:248736be106e 28
AzureIoTClient 88:248736be106e 29 #include "azure_c_shared_utility/macro_utils.h"
AzureIoTClient 88:248736be106e 30 #include "azure_c_shared_utility/umock_c_prod.h"
AzureIoTClient 88:248736be106e 31
AzureIoTClient 88:248736be106e 32 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 33 extern "C"
AzureIoTClient 88:248736be106e 34 {
AzureIoTClient 88:248736be106e 35 #endif
AzureIoTClient 88:248736be106e 36
AzureIoTClient 88:248736be106e 37 #include "iothub_transport_ll.h"
AzureIoTClient 88:248736be106e 38 #include "iothub_client_core_ll.h"
AzureIoTClient 88:248736be106e 39
AzureIoTClient 88:248736be106e 40 typedef struct IOTHUB_CLIENT_CORE_LL_HANDLE_DATA_TAG* IOTHUB_DEVICE_CLIENT_LL_HANDLE;
AzureIoTClient 88:248736be106e 41
AzureIoTClient 88:248736be106e 42
AzureIoTClient 88:248736be106e 43 /**
AzureIoTClient 88:248736be106e 44 * @brief Creates a IoT Hub client for communication with an existing
AzureIoTClient 88:248736be106e 45 * IoT Hub using the specified connection string parameter.
AzureIoTClient 88:248736be106e 46 *
AzureIoTClient 88:248736be106e 47 * @param connectionString Pointer to a character string
AzureIoTClient 88:248736be106e 48 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 49 *
AzureIoTClient 88:248736be106e 50 * Sample connection string:
AzureIoTClient 88:248736be106e 51 * <blockquote>
AzureIoTClient 88:248736be106e 52 * <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 53 * </blockquote>
AzureIoTClient 88:248736be106e 54 *
AzureIoTClient 88:248736be106e 55 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 88:248736be106e 56 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 57 */
AzureIoTClient 88:248736be106e 58 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_LL_HANDLE, IoTHubDeviceClient_LL_CreateFromConnectionString, const char*, connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol);
AzureIoTClient 88:248736be106e 59
AzureIoTClient 88:248736be106e 60 /**
AzureIoTClient 88:248736be106e 61 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 62 * Hub using the specified parameters.
AzureIoTClient 88:248736be106e 63 *
AzureIoTClient 88:248736be106e 64 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 88:248736be106e 65 *
AzureIoTClient 88:248736be106e 66 * The API does not allow sharing of a connection across multiple
AzureIoTClient 88:248736be106e 67 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 68 *
AzureIoTClient 88:248736be106e 69 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 88:248736be106e 70 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 71 */
AzureIoTClient 88:248736be106e 72 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_LL_HANDLE, IoTHubDeviceClient_LL_Create, const IOTHUB_CLIENT_CONFIG*, config);
AzureIoTClient 88:248736be106e 73
AzureIoTClient 88:248736be106e 74 /**
AzureIoTClient 88:248736be106e 75 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 76 * Hub using an existing transport.
AzureIoTClient 88:248736be106e 77 *
AzureIoTClient 88:248736be106e 78 * @param config Pointer to an @c IOTHUB_CLIENT_DEVICE_CONFIG structure
AzureIoTClient 88:248736be106e 79 *
AzureIoTClient 88:248736be106e 80 * The API *allows* sharing of a connection across multiple
AzureIoTClient 88:248736be106e 81 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 82 *
AzureIoTClient 88:248736be106e 83 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 88:248736be106e 84 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 85 */
AzureIoTClient 88:248736be106e 86 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_LL_HANDLE, IoTHubDeviceClient_LL_CreateWithTransport, const IOTHUB_CLIENT_DEVICE_CONFIG*, config);
AzureIoTClient 88:248736be106e 87
AzureIoTClient 88:248736be106e 88 /**
AzureIoTClient 88:248736be106e 89 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 88:248736be106e 90 * Hub using the device auth module.
AzureIoTClient 88:248736be106e 91 *
AzureIoTClient 88:248736be106e 92 * @param iothub_uri Pointer to an ioThub hostname received in the registration process
AzureIoTClient 88:248736be106e 93 * @param device_id Pointer to the device Id of the device
AzureIoTClient 88:248736be106e 94 * @param device_auth_handle a device auth handle used to generate the connection string
AzureIoTClient 88:248736be106e 95 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 96 *
AzureIoTClient 88:248736be106e 97 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 88:248736be106e 98 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 88:248736be106e 99 */
AzureIoTClient 88:248736be106e 100 MOCKABLE_FUNCTION(, IOTHUB_DEVICE_CLIENT_LL_HANDLE, IoTHubDeviceClient_LL_CreateFromDeviceAuth, const char*, iothub_uri, const char*, device_id, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol);
AzureIoTClient 88:248736be106e 101
AzureIoTClient 88:248736be106e 102 /**
AzureIoTClient 88:248736be106e 103 * @brief Disposes of resources allocated by the IoT Hub client. This is a
AzureIoTClient 88:248736be106e 104 * blocking call.
AzureIoTClient 88:248736be106e 105 *
AzureIoTClient 88:248736be106e 106 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 107 */
AzureIoTClient 88:248736be106e 108 MOCKABLE_FUNCTION(, void, IoTHubDeviceClient_LL_Destroy, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle);
AzureIoTClient 88:248736be106e 109
AzureIoTClient 88:248736be106e 110 /**
AzureIoTClient 88:248736be106e 111 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
AzureIoTClient 88:248736be106e 112 *
AzureIoTClient 88:248736be106e 113 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 114 * @param eventMessageHandle The handle to an IoT Hub message.
AzureIoTClient 88:248736be106e 115 * @param eventConfirmationCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 116 * confirmation of the delivery of the IoT Hub message.
AzureIoTClient 88:248736be106e 117 * This callback can be expected to invoke the
AzureIoTClient 88:248736be106e 118 * ::IoTHubDeviceClient_LL_SendEventAsync function for the
AzureIoTClient 88:248736be106e 119 * same message in an attempt to retry sending a failing
AzureIoTClient 88:248736be106e 120 * message. The user can specify a @c NULL value here to
AzureIoTClient 88:248736be106e 121 * indicate that no callback is required.
AzureIoTClient 88:248736be106e 122 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 123 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 124 *
AzureIoTClient 88:248736be106e 125 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 126 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 127 *
AzureIoTClient 88:248736be106e 128 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 129 */
AzureIoTClient 88:248736be106e 130 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SendEventAsync, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_MESSAGE_HANDLE, eventMessageHandle, IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK, eventConfirmationCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 131
AzureIoTClient 88:248736be106e 132 /**
AzureIoTClient 88:248736be106e 133 * @brief This function returns the current sending status for IoTHubClient.
AzureIoTClient 88:248736be106e 134 *
AzureIoTClient 88:248736be106e 135 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 136 * @param iotHubClientStatus The sending state is populated at the address pointed
AzureIoTClient 88:248736be106e 137 * at by this parameter. The value will be set to
AzureIoTClient 88:248736be106e 138 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
AzureIoTClient 88:248736be106e 139 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
AzureIoTClient 88:248736be106e 140 * if there are.
AzureIoTClient 88:248736be106e 141 *
AzureIoTClient 88:248736be106e 142 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 143 */
AzureIoTClient 88:248736be106e 144 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_GetSendStatus, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_STATUS*, iotHubClientStatus);
AzureIoTClient 88:248736be106e 145
AzureIoTClient 88:248736be106e 146 /**
AzureIoTClient 88:248736be106e 147 * @brief Sets up the message callback to be invoked when IoT Hub issues a
AzureIoTClient 88:248736be106e 148 * message to the device. This is a blocking call.
AzureIoTClient 88:248736be106e 149 *
AzureIoTClient 88:248736be106e 150 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 151 * @param messageCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 152 * messages from IoT Hub.
AzureIoTClient 88:248736be106e 153 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 154 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 155 *
AzureIoTClient 88:248736be106e 156 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 157 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 158 *
AzureIoTClient 88:248736be106e 159 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 160 */
AzureIoTClient 88:248736be106e 161 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetMessageCallback, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC, messageCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 162
AzureIoTClient 88:248736be106e 163 /**
AzureIoTClient 88:248736be106e 164 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 165 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 166 *
AzureIoTClient 88:248736be106e 167 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 168 * @param connectionStatusCallback The callback specified by the device for receiving
AzureIoTClient 88:248736be106e 169 * updates about the status of the connection to IoT Hub.
AzureIoTClient 88:248736be106e 170 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 171 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 172 *
AzureIoTClient 88:248736be106e 173 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 174 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 175 *
AzureIoTClient 88:248736be106e 176 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 177 */
AzureIoTClient 88:248736be106e 178 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetConnectionStatusCallback, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK, connectionStatusCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 179
AzureIoTClient 88:248736be106e 180 /**
AzureIoTClient 88:248736be106e 181 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 182 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 183 *
AzureIoTClient 88:248736be106e 184 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 185 * @param retryPolicy The policy to use to reconnect to IoT Hub when a
AzureIoTClient 88:248736be106e 186 * connection drops.
AzureIoTClient 88:248736be106e 187 * @param retryTimeoutLimitInSeconds Maximum amount of time(seconds) to attempt reconnection when a
AzureIoTClient 88:248736be106e 188 * connection drops to IOT Hub.
AzureIoTClient 88:248736be106e 189 *
AzureIoTClient 88:248736be106e 190 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 191 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 192 *
AzureIoTClient 88:248736be106e 193 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 194 */
AzureIoTClient 88:248736be106e 195 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetRetryPolicy, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY, retryPolicy, size_t, retryTimeoutLimitInSeconds);
AzureIoTClient 88:248736be106e 196
AzureIoTClient 88:248736be106e 197
AzureIoTClient 88:248736be106e 198 /**
AzureIoTClient 88:248736be106e 199 * @brief Sets up the connection status callback to be invoked representing the status of
AzureIoTClient 88:248736be106e 200 * the connection to IOT Hub. This is a blocking call.
AzureIoTClient 88:248736be106e 201 *
AzureIoTClient 88:248736be106e 202 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 203 * @param retryPolicy Out parameter containing the policy to use to reconnect to IoT Hub.
AzureIoTClient 88:248736be106e 204 * @param retryTimeoutLimitInSeconds Out parameter containing maximum amount of time in seconds to attempt reconnection
AzureIoTClient 88:248736be106e 205 to IOT Hub.
AzureIoTClient 88:248736be106e 206 *
AzureIoTClient 88:248736be106e 207 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 208 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 209 *
AzureIoTClient 88:248736be106e 210 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 211 */
AzureIoTClient 88:248736be106e 212 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_GetRetryPolicy, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY*, retryPolicy, size_t*, retryTimeoutLimitInSeconds);
AzureIoTClient 88:248736be106e 213
AzureIoTClient 88:248736be106e 214 /**
AzureIoTClient 88:248736be106e 215 * @brief This function returns in the out parameter @p lastMessageReceiveTime
AzureIoTClient 88:248736be106e 216 * what was the value of the @c time function when the last message was
AzureIoTClient 88:248736be106e 217 * received at the client.
AzureIoTClient 88:248736be106e 218 *
AzureIoTClient 88:248736be106e 219 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 220 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
AzureIoTClient 88:248736be106e 221 * when the last message was received.
AzureIoTClient 88:248736be106e 222 *
AzureIoTClient 88:248736be106e 223 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 224 */
AzureIoTClient 88:248736be106e 225 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_GetLastMessageReceiveTime, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, time_t*, lastMessageReceiveTime);
AzureIoTClient 88:248736be106e 226
AzureIoTClient 88:248736be106e 227 /**
AzureIoTClient 88:248736be106e 228 * @brief This function is meant to be called by the user when work
AzureIoTClient 88:248736be106e 229 * (sending/receiving) can be done by the IoTHubClient.
AzureIoTClient 88:248736be106e 230 *
AzureIoTClient 88:248736be106e 231 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 232 *
AzureIoTClient 88:248736be106e 233 * All IoTHubClient interactions (in regards to network traffic
AzureIoTClient 88:248736be106e 234 * and/or user level callbacks) are the effect of calling this
AzureIoTClient 88:248736be106e 235 * function and they take place synchronously inside _DoWork.
AzureIoTClient 88:248736be106e 236 */
AzureIoTClient 88:248736be106e 237 MOCKABLE_FUNCTION(, void, IoTHubDeviceClient_LL_DoWork, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle);
AzureIoTClient 88:248736be106e 238
AzureIoTClient 88:248736be106e 239 /**
AzureIoTClient 88:248736be106e 240 * @brief This API sets a runtime option identified by parameter @p optionName
AzureIoTClient 88:248736be106e 241 * to a value pointed to by @p value. @p optionName and the data type
AzureIoTClient 88:248736be106e 242 * @p value is pointing to are specific for every option.
AzureIoTClient 88:248736be106e 243 *
AzureIoTClient 88:248736be106e 244 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 245 * @param optionName Name of the option.
AzureIoTClient 88:248736be106e 246 * @param value The value.
AzureIoTClient 88:248736be106e 247 *
AzureIoTClient 88:248736be106e 248 * The options that can be set via this API are:
AzureIoTClient 88:248736be106e 249 * - @b timeout - the maximum time in milliseconds a communication is
AzureIoTClient 88:248736be106e 250 * allowed to use. @p value is a pointer to an @c unsigned @c int with
AzureIoTClient 88:248736be106e 251 * the timeout value in milliseconds. This is only supported for the HTTP
AzureIoTClient 88:248736be106e 252 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
AzureIoTClient 88:248736be106e 253 * the parameter is <em>total request time</em>. When the HTTP protocol uses
AzureIoTClient 88:248736be106e 254 * winhttp, the meaning is the same as the @c dwSendTimeout and
AzureIoTClient 88:248736be106e 255 * @c dwReceiveTimeout parameters of the
AzureIoTClient 88:248736be106e 256 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
AzureIoTClient 88:248736be106e 257 * WinHttpSetTimeouts</a> API.
AzureIoTClient 88:248736be106e 258 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 259 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 260 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 261 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 262 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 263 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 264 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 265 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 266 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 267 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 268 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 269 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 270 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
AzureIoTClient 88:248736be106e 271 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 88:248736be106e 272 * name. @p value is pointer to a long.
AzureIoTClient 88:248736be106e 273 * - @b keepalive - available for MQTT protocol. Integer value that sets the
AzureIoTClient 88:248736be106e 274 * interval in seconds when pings are sent to the server.
AzureIoTClient 88:248736be106e 275 * - @b logtrace - available for MQTT protocol. Boolean value that turns on and
AzureIoTClient 88:248736be106e 276 * off the diagnostic logging.
AzureIoTClient 88:248736be106e 277 * - @b sas_token_lifetime - available for MQTT & AMQP protocol. size_t value that that determines the
AzureIoTClient 88:248736be106e 278 * sas token timeout length.
AzureIoTClient 88:248736be106e 279 *
AzureIoTClient 88:248736be106e 280 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 281 */
AzureIoTClient 88:248736be106e 282 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetOption, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, optionName, const void*, value);
AzureIoTClient 88:248736be106e 283
AzureIoTClient 88:248736be106e 284 /**
AzureIoTClient 88:248736be106e 285 * @brief This API specifies a call back to be used when the device receives a desired state update.
AzureIoTClient 88:248736be106e 286 *
AzureIoTClient 88:248736be106e 287 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 288 * @param deviceTwinCallback The callback specified by the device client to be used for updating
AzureIoTClient 88:248736be106e 289 * the desired state. The callback will be called in response to patch
AzureIoTClient 88:248736be106e 290 * request send by the IoTHub services. The payload will be passed to the
AzureIoTClient 88:248736be106e 291 * callback, along with two version numbers:
AzureIoTClient 88:248736be106e 292 * - Desired:
AzureIoTClient 88:248736be106e 293 * - LastSeenReported:
AzureIoTClient 88:248736be106e 294 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 295 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 296 *
AzureIoTClient 88:248736be106e 297 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 298 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 299 *
AzureIoTClient 88:248736be106e 300 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 301 */
AzureIoTClient 88:248736be106e 302 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetDeviceTwinCallback, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK, deviceTwinCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 303
AzureIoTClient 88:248736be106e 304 /**
AzureIoTClient 88:248736be106e 305 * @brief This API sneds a report of the device's properties and their current values.
AzureIoTClient 88:248736be106e 306 *
AzureIoTClient 88:248736be106e 307 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 308 * @param reportedState The current device property values to be 'reported' to the IoTHub.
AzureIoTClient 88:248736be106e 309 * @param reportedStateCallback The callback specified by the device client to be called with the
AzureIoTClient 88:248736be106e 310 * result of the transaction.
AzureIoTClient 88:248736be106e 311 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 312 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 313 *
AzureIoTClient 88:248736be106e 314 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 88:248736be106e 315 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 316 *
AzureIoTClient 88:248736be106e 317 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 318 */
AzureIoTClient 88:248736be106e 319 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SendReportedState, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, const unsigned char*, reportedState, size_t, size, IOTHUB_CLIENT_REPORTED_STATE_CALLBACK, reportedStateCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 320 /**
AzureIoTClient 88:248736be106e 321 * @brief This API sets callback for async cloud to device method call.
AzureIoTClient 88:248736be106e 322 *
AzureIoTClient 88:248736be106e 323 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 324 * @param inboundDeviceMethodCallback The callback which will be called by IoTHub.
AzureIoTClient 88:248736be106e 325 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 88:248736be106e 326 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 327 *
AzureIoTClient 88:248736be106e 328 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 329 */
AzureIoTClient 88:248736be106e 330 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_SetDeviceMethodCallback, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_METHOD_CALLBACK_ASYNC, deviceMethodCallback, void*, userContextCallback);
AzureIoTClient 88:248736be106e 331
AzureIoTClient 88:248736be106e 332 /**
AzureIoTClient 88:248736be106e 333 * @brief This API responses to a asnyc method callback identified the methodId.
AzureIoTClient 88:248736be106e 334 *
AzureIoTClient 88:248736be106e 335 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 336 * @param methodId The methodId of the Device Method callback.
AzureIoTClient 88:248736be106e 337 * @param response The response data for the method callback.
AzureIoTClient 88:248736be106e 338 * @param response_size The size of the response data buffer.
AzureIoTClient 88:248736be106e 339 * @param status_response The status response of the method callback.
AzureIoTClient 88:248736be106e 340 *
AzureIoTClient 88:248736be106e 341 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 342 */
AzureIoTClient 88:248736be106e 343 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_DeviceMethodResponse, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, METHOD_HANDLE, methodId, const unsigned char*, response, size_t, respSize, int, statusCode);
AzureIoTClient 88:248736be106e 344
AzureIoTClient 88:248736be106e 345 #ifndef DONT_USE_UPLOADTOBLOB
AzureIoTClient 88:248736be106e 346 /**
AzureIoTClient 88:248736be106e 347 * @brief This API uploads to Azure Storage the content pointed to by @p source having the size @p size
AzureIoTClient 88:248736be106e 348 * under the blob name devicename/@pdestinationFileName
AzureIoTClient 88:248736be106e 349 *
AzureIoTClient 88:248736be106e 350 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 351 * @param destinationFileName name of the file.
AzureIoTClient 88:248736be106e 352 * @param source pointer to the source for file content (can be NULL)
AzureIoTClient 88:248736be106e 353 * @param size the size of the source in memory (if @p source is NULL then size needs to be 0).
AzureIoTClient 88:248736be106e 354 *
AzureIoTClient 88:248736be106e 355 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 356 */
AzureIoTClient 88:248736be106e 357 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_UploadToBlob, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, destinationFileName, const unsigned char*, source, size_t, size);
AzureIoTClient 88:248736be106e 358
AzureIoTClient 88:248736be106e 359 /**
AzureIoTClient 88:248736be106e 360 * @brief This API uploads to Azure Storage the content provided block by block by @p getDataCallback
AzureIoTClient 88:248736be106e 361 * under the blob name devicename/@pdestinationFileName
AzureIoTClient 88:248736be106e 362 *
AzureIoTClient 88:248736be106e 363 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 364 * @param destinationFileName name of the file.
AzureIoTClient 88:248736be106e 365 * @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 366 * @param context Any data provided by the user to serve as context on getDataCallback.
AzureIoTClient 88:248736be106e 367 *
AzureIoTClient 88:248736be106e 368 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 88:248736be106e 369 */
AzureIoTClient 88:248736be106e 370 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubDeviceClient_LL_UploadMultipleBlocksToBlob, IOTHUB_DEVICE_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX, getDataCallbackEx, void*, context);
AzureIoTClient 88:248736be106e 371
AzureIoTClient 88:248736be106e 372 #endif /*DONT_USE_UPLOADTOBLOB*/
AzureIoTClient 88:248736be106e 373
AzureIoTClient 88:248736be106e 374 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 375 }
AzureIoTClient 88:248736be106e 376 #endif
AzureIoTClient 88:248736be106e 377
AzureIoTClient 88:248736be106e 378 #endif /* IOTHUB_DEVICE_CLIENT_LL_H */