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