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:
Tue Sep 11 11:13:11 2018 -0700
Revision:
92:97148cf9aa2a
Parent:
91:bbf806070c5f
1.2.9

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 92:97148cf9aa2a 4 /** @file iothub_device_client_ll.h
AzureIoTClient 91:bbf806070c5f 5 * @brief APIs that allow a user (usually a device) to communicate
AzureIoTClient 91:bbf806070c5f 6 * with an Azure IoTHub.
AzureIoTClient 88:248736be106e 7 *
AzureIoTClient 91:bbf806070c5f 8 * @details IoTHubDeviceClient_LL is a module that allows a user (usually a
AzureIoTClient 91:bbf806070c5f 9 * device) to communicate with an Azure IoTHub. It can send events
AzureIoTClient 91:bbf806070c5f 10 * and receive messages. At any given moment in time there can only
AzureIoTClient 91:bbf806070c5f 11 * be at most 1 message callback function.
AzureIoTClient 88:248736be106e 12 *
AzureIoTClient 91:bbf806070c5f 13 * This API surface contains a set of APIs that allows the user to
AzureIoTClient 91:bbf806070c5f 14 * interact with the lower layer portion of the IoTHubClient. These APIs
AzureIoTClient 91:bbf806070c5f 15 * contain @c _LL_ in their name, but retain the same functionality like the
AzureIoTClient 91:bbf806070c5f 16 * @c IoTHubDeviceClient_... APIs, with one difference. If the @c _LL_ APIs are
AzureIoTClient 91:bbf806070c5f 17 * used then the user is responsible for scheduling when the actual work done
AzureIoTClient 91:bbf806070c5f 18 * by the IoTHubClient happens (when the data is sent/received on/from the wire).
AzureIoTClient 91:bbf806070c5f 19 * This is useful for constrained devices where spinning a separate thread is
AzureIoTClient 91:bbf806070c5f 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 92:97148cf9aa2a 32 #include "iothub_transport_ll.h"
AzureIoTClient 92:97148cf9aa2a 33 #include "iothub_client_core_ll.h"
AzureIoTClient 92:97148cf9aa2a 34
AzureIoTClient 88:248736be106e 35 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 36 extern "C"
AzureIoTClient 88:248736be106e 37 {
AzureIoTClient 88:248736be106e 38 #endif
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 91:bbf806070c5f 44 * @brief Creates a IoT Hub client for communication with an existing
AzureIoTClient 91:bbf806070c5f 45 * IoT Hub using the specified connection string parameter.
AzureIoTClient 88:248736be106e 46 *
AzureIoTClient 91:bbf806070c5f 47 * @param connectionString Pointer to a character string
AzureIoTClient 91:bbf806070c5f 48 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 49 *
AzureIoTClient 91:bbf806070c5f 50 * Sample connection string:
AzureIoTClient 91:bbf806070c5f 51 * <blockquote>
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 53 * </blockquote>
AzureIoTClient 88:248736be106e 54 *
AzureIoTClient 91:bbf806070c5f 55 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 61 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 91:bbf806070c5f 62 * Hub using the specified parameters.
AzureIoTClient 88:248736be106e 63 *
AzureIoTClient 91:bbf806070c5f 64 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 88:248736be106e 65 *
AzureIoTClient 91:bbf806070c5f 66 * The API does not allow sharing of a connection across multiple
AzureIoTClient 91:bbf806070c5f 67 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 68 *
AzureIoTClient 91:bbf806070c5f 69 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 75 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 91:bbf806070c5f 76 * Hub using an existing transport.
AzureIoTClient 88:248736be106e 77 *
AzureIoTClient 91:bbf806070c5f 78 * @param config Pointer to an @c IOTHUB_CLIENT_DEVICE_CONFIG structure
AzureIoTClient 88:248736be106e 79 *
AzureIoTClient 91:bbf806070c5f 80 * The API *allows* sharing of a connection across multiple
AzureIoTClient 91:bbf806070c5f 81 * devices. This is a blocking call.
AzureIoTClient 88:248736be106e 82 *
AzureIoTClient 91:bbf806070c5f 83 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 89 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 91:bbf806070c5f 90 * Hub using the device auth module.
AzureIoTClient 88:248736be106e 91 *
AzureIoTClient 91:bbf806070c5f 92 * @param iothub_uri Pointer to an ioThub hostname received in the registration process
AzureIoTClient 91:bbf806070c5f 93 * @param device_id Pointer to the device Id of the device
AzureIoTClient 91:bbf806070c5f 94 * @param device_auth_handle A device auth handle used to generate the connection string
AzureIoTClient 91:bbf806070c5f 95 * @param protocol Function pointer for protocol implementation
AzureIoTClient 88:248736be106e 96 *
AzureIoTClient 91:bbf806070c5f 97 * @return A non-NULL @c IOTHUB_DEVICE_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 103 * @brief Disposes of resources allocated by the IoT Hub client. This is a
AzureIoTClient 91:bbf806070c5f 104 * blocking call.
AzureIoTClient 88:248736be106e 105 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 111 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
AzureIoTClient 88:248736be106e 112 *
AzureIoTClient 91:bbf806070c5f 113 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 114 * @param eventMessageHandle The handle to an IoT Hub message.
AzureIoTClient 91:bbf806070c5f 115 * @param eventConfirmationCallback The callback specified by the device for receiving
AzureIoTClient 91:bbf806070c5f 116 * confirmation of the delivery of the IoT Hub message.
AzureIoTClient 91:bbf806070c5f 117 * This callback can be expected to invoke the
AzureIoTClient 91:bbf806070c5f 118 * ::IoTHubDeviceClient_LL_SendEventAsync function for the
AzureIoTClient 91:bbf806070c5f 119 * same message in an attempt to retry sending a failing
AzureIoTClient 91:bbf806070c5f 120 * message. The user can specify a @c NULL value here to
AzureIoTClient 91:bbf806070c5f 121 * indicate that no callback is required.
AzureIoTClient 91:bbf806070c5f 122 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 123 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 124 *
AzureIoTClient 91:bbf806070c5f 125 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 126 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 127 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 133 * @brief This function returns the current sending status for IoTHubClient.
AzureIoTClient 88:248736be106e 134 *
AzureIoTClient 91:bbf806070c5f 135 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 136 * @param iotHubClientStatus The sending state is populated at the address pointed
AzureIoTClient 91:bbf806070c5f 137 * at by this parameter. The value will be set to
AzureIoTClient 91:bbf806070c5f 138 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
AzureIoTClient 91:bbf806070c5f 139 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
AzureIoTClient 91:bbf806070c5f 140 * if there are.
AzureIoTClient 88:248736be106e 141 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 147 * @brief Sets up the message callback to be invoked when IoT Hub issues a
AzureIoTClient 91:bbf806070c5f 148 * message to the device. This is a blocking call.
AzureIoTClient 88:248736be106e 149 *
AzureIoTClient 91:bbf806070c5f 150 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 151 * @param messageCallback The callback specified by the device for receiving
AzureIoTClient 91:bbf806070c5f 152 * messages from IoT Hub.
AzureIoTClient 91:bbf806070c5f 153 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 154 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 155 *
AzureIoTClient 91:bbf806070c5f 156 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 157 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 158 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 91:bbf806070c5f 167 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 168 * @param connectionStatusCallback The callback specified by the device for receiving
AzureIoTClient 91:bbf806070c5f 169 * updates about the status of the connection to IoT Hub.
AzureIoTClient 91:bbf806070c5f 170 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 171 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 172 *
AzureIoTClient 91:bbf806070c5f 173 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 174 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 175 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 91:bbf806070c5f 184 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 185 * @param retryPolicy The policy to use to reconnect to IoT Hub when a
AzureIoTClient 91:bbf806070c5f 186 * connection drops.
AzureIoTClient 91:bbf806070c5f 187 * @param retryTimeoutLimitInSeconds Maximum amount of time(seconds) to attempt reconnection when a
AzureIoTClient 91:bbf806070c5f 188 * connection drops to IOT Hub.
AzureIoTClient 88:248736be106e 189 *
AzureIoTClient 91:bbf806070c5f 190 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 191 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 192 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 91:bbf806070c5f 202 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 203 * @param retryPolicy Out parameter containing the policy to use to reconnect to IoT Hub.
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 207 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 208 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 209 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 215 * @brief This function returns in the out parameter @p lastMessageReceiveTime
AzureIoTClient 91:bbf806070c5f 216 * what was the value of the @c time function when the last message was
AzureIoTClient 91:bbf806070c5f 217 * received at the client.
AzureIoTClient 88:248736be106e 218 *
AzureIoTClient 91:bbf806070c5f 219 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 220 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
AzureIoTClient 91:bbf806070c5f 221 * when the last message was received.
AzureIoTClient 88:248736be106e 222 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 228 * @brief This function is meant to be called by the user when work
AzureIoTClient 91:bbf806070c5f 229 * (sending/receiving) can be done by the IoTHubClient.
AzureIoTClient 88:248736be106e 230 *
AzureIoTClient 91:bbf806070c5f 231 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 88:248736be106e 232 *
AzureIoTClient 91:bbf806070c5f 233 * All IoTHubClient interactions (in regards to network traffic
AzureIoTClient 91:bbf806070c5f 234 * and/or user level callbacks) are the effect of calling this
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 240 * @brief This API sets a runtime option identified by parameter @p optionName
AzureIoTClient 91:bbf806070c5f 241 * to a value pointed to by @p value. @p optionName and the data type
AzureIoTClient 91:bbf806070c5f 242 * @p value is pointing to are specific for every option.
AzureIoTClient 88:248736be106e 243 *
AzureIoTClient 91:bbf806070c5f 244 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 245 * @param optionName Name of the option.
AzureIoTClient 91:bbf806070c5f 246 * @param value The value.
AzureIoTClient 88:248736be106e 247 *
AzureIoTClient 91:bbf806070c5f 248 * The options that can be set via this API are:
AzureIoTClient 91:bbf806070c5f 249 * - @b timeout - the maximum time in milliseconds a communication is
AzureIoTClient 91:bbf806070c5f 250 * allowed to use. @p value is a pointer to an @c unsigned @c int with
AzureIoTClient 91:bbf806070c5f 251 * the timeout value in milliseconds. This is only supported for the HTTP
AzureIoTClient 91:bbf806070c5f 252 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
AzureIoTClient 91:bbf806070c5f 253 * the parameter is <em>total request time</em>. When the HTTP protocol uses
AzureIoTClient 91:bbf806070c5f 254 * winhttp, the meaning is the same as the @c dwSendTimeout and
AzureIoTClient 91:bbf806070c5f 255 * @c dwReceiveTimeout parameters of the
AzureIoTClient 91:bbf806070c5f 256 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
AzureIoTClient 91:bbf806070c5f 257 * WinHttpSetTimeouts</a> API.
AzureIoTClient 91:bbf806070c5f 258 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
AzureIoTClient 91:bbf806070c5f 259 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 91:bbf806070c5f 260 * name. @p value is pointer to a long.
AzureIoTClient 91:bbf806070c5f 261 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
AzureIoTClient 91:bbf806070c5f 262 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 91:bbf806070c5f 263 * name. @p value is pointer to a long.
AzureIoTClient 91:bbf806070c5f 264 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
AzureIoTClient 91:bbf806070c5f 265 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 91:bbf806070c5f 266 * name. @p value is pointer to a long.
AzureIoTClient 91:bbf806070c5f 267 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
AzureIoTClient 91:bbf806070c5f 268 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 91:bbf806070c5f 269 * name. @p value is pointer to a long.
AzureIoTClient 91:bbf806070c5f 270 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
AzureIoTClient 91:bbf806070c5f 271 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 92:97148cf9aa2a 285 * @brief This API specifies a callback to be used when the device receives a desired state update.
AzureIoTClient 88:248736be106e 286 *
AzureIoTClient 91:bbf806070c5f 287 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 288 * @param deviceTwinCallback The callback specified by the device client to be used for updating
AzureIoTClient 92:97148cf9aa2a 289 * the desired state. The callback will be called in response to patch
AzureIoTClient 91:bbf806070c5f 290 * request send by the IoTHub services. The payload will be passed to the
AzureIoTClient 91:bbf806070c5f 291 * callback, along with two version numbers:
AzureIoTClient 91:bbf806070c5f 292 * - Desired:
AzureIoTClient 91:bbf806070c5f 293 * - LastSeenReported:
AzureIoTClient 91:bbf806070c5f 294 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 295 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 296 *
AzureIoTClient 91:bbf806070c5f 297 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 298 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 299 *
AzureIoTClient 91:bbf806070c5f 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 92:97148cf9aa2a 305 * @brief This API sends a report of the device's properties and their current values.
AzureIoTClient 88:248736be106e 306 *
AzureIoTClient 91:bbf806070c5f 307 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 308 * @param reportedState The current device property values to be 'reported' to the IoTHub.
AzureIoTClient 91:bbf806070c5f 309 * @param reportedStateCallback The callback specified by the device client to be called with the
AzureIoTClient 91:bbf806070c5f 310 * result of the transaction.
AzureIoTClient 91:bbf806070c5f 311 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 312 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 313 *
AzureIoTClient 91:bbf806070c5f 314 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 91:bbf806070c5f 315 * the ::IoTHubDeviceClient_LL_Destroy function from within any callback.
AzureIoTClient 88:248736be106e 316 *
AzureIoTClient 91:bbf806070c5f 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 92:97148cf9aa2a 321 * @brief This API sets the callback for async cloud to device method calls.
AzureIoTClient 88:248736be106e 322 *
AzureIoTClient 91:bbf806070c5f 323 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 324 * @param inboundDeviceMethodCallback The callback which will be called by IoTHub.
AzureIoTClient 91:bbf806070c5f 325 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 91:bbf806070c5f 326 * callback. This can be @c NULL.
AzureIoTClient 88:248736be106e 327 *
AzureIoTClient 91:bbf806070c5f 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 92:97148cf9aa2a 333 * @brief This API responds to an asnyc method callback identified the methodId.
AzureIoTClient 88:248736be106e 334 *
AzureIoTClient 91:bbf806070c5f 335 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 336 * @param methodId The methodId of the Device Method callback.
AzureIoTClient 91:bbf806070c5f 337 * @param response The response data for the method callback.
AzureIoTClient 91:bbf806070c5f 338 * @param response_size The size of the response data buffer.
AzureIoTClient 91:bbf806070c5f 339 * @param status_response The status response of the method callback.
AzureIoTClient 88:248736be106e 340 *
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 91:bbf806070c5f 350 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 91:bbf806070c5f 351 * @param destinationFileName name of the file.
AzureIoTClient 91:bbf806070c5f 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 91:bbf806070c5f 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 */