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@80:db5f5237bc95, 2017-12-15 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Fri Dec 15 14:09:20 2017 -0800
- Revision:
- 80:db5f5237bc95
- Parent:
- 76:943524fee0b7
- Child:
- 82:f94e6bed4495
1.1.29
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 | 16:deba40344375 | 5 | * @brief APIs that allow a user (usually a device) to communicate |
AzureIoTClient | 16:deba40344375 | 6 | * with an Azure IoTHub. |
AzureIoTClient | 16:deba40344375 | 7 | * |
AzureIoTClient | 16:deba40344375 | 8 | * @details IoTHubClient_LL is a module that allows a user (usually a |
AzureIoTClient | 16:deba40344375 | 9 | * device) to communicate with an Azure IoTHub. It can send events |
AzureIoTClient | 16:deba40344375 | 10 | * and receive messages. At any given moment in time there can only |
AzureIoTClient | 16:deba40344375 | 11 | * be at most 1 message callback function. |
AzureIoTClient | 40:1a94db9139ea | 12 | * |
AzureIoTClient | 16:deba40344375 | 13 | * This API surface contains a set of APIs that allows the user to |
AzureIoTClient | 16:deba40344375 | 14 | * interact with the lower layer portion of the IoTHubClient. These APIs |
AzureIoTClient | 16:deba40344375 | 15 | * contain @c _LL_ in their name, but retain the same functionality like the |
AzureIoTClient | 16:deba40344375 | 16 | * @c IoTHubClient_... APIs, with one difference. If the @c _LL_ APIs are |
AzureIoTClient | 16:deba40344375 | 17 | * used then the user is responsible for scheduling when the actual work done |
AzureIoTClient | 16:deba40344375 | 18 | * by the IoTHubClient happens (when the data is sent/received on/from the wire). |
AzureIoTClient | 16:deba40344375 | 19 | * This is useful for constrained devices where spinning a separate thread is |
AzureIoTClient | 16:deba40344375 | 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 | |
Azure.IoT Build | 38:a05929a75111 | 26 | #include "azure_c_shared_utility/macro_utils.h" |
AzureIoTClient | 53:1e5a1ca1f274 | 27 | #include "azure_c_shared_utility/umock_c_prod.h" |
AzureIoTClient | 16:deba40344375 | 28 | |
AzureIoTClient | 80:db5f5237bc95 | 29 | #define IOTHUB_CLIENT_FILE_UPLOAD_RESULT_VALUES \ |
AzureIoTClient | 80:db5f5237bc95 | 30 | FILE_UPLOAD_OK, \ |
AzureIoTClient | 80:db5f5237bc95 | 31 | FILE_UPLOAD_ERROR |
AzureIoTClient | 80:db5f5237bc95 | 32 | |
AzureIoTClient | 80:db5f5237bc95 | 33 | DEFINE_ENUM(IOTHUB_CLIENT_FILE_UPLOAD_RESULT, IOTHUB_CLIENT_FILE_UPLOAD_RESULT_VALUES) |
AzureIoTClient | 80:db5f5237bc95 | 34 | typedef void(*IOTHUB_CLIENT_FILE_UPLOAD_CALLBACK)(IOTHUB_CLIENT_FILE_UPLOAD_RESULT result, void* userContextCallback); |
AzureIoTClient | 80:db5f5237bc95 | 35 | |
AzureIoTClient | 16:deba40344375 | 36 | #define IOTHUB_CLIENT_RESULT_VALUES \ |
AzureIoTClient | 16:deba40344375 | 37 | IOTHUB_CLIENT_OK, \ |
AzureIoTClient | 16:deba40344375 | 38 | IOTHUB_CLIENT_INVALID_ARG, \ |
AzureIoTClient | 16:deba40344375 | 39 | IOTHUB_CLIENT_ERROR, \ |
AzureIoTClient | 16:deba40344375 | 40 | IOTHUB_CLIENT_INVALID_SIZE, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 41 | IOTHUB_CLIENT_INDEFINITE_TIME |
AzureIoTClient | 16:deba40344375 | 42 | |
AzureIoTClient | 43:038d8511e817 | 43 | /** @brief Enumeration specifying the status of calls to various APIs in this module. |
AzureIoTClient | 43:038d8511e817 | 44 | */ |
AzureIoTClient | 43:038d8511e817 | 45 | |
AzureIoTClient | 43:038d8511e817 | 46 | DEFINE_ENUM(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_RESULT_VALUES); |
AzureIoTClient | 43:038d8511e817 | 47 | |
AzureIoTClient | 53:1e5a1ca1f274 | 48 | #define IOTHUB_CLIENT_RETRY_POLICY_VALUES \ |
AzureIoTClient | 53:1e5a1ca1f274 | 49 | IOTHUB_CLIENT_RETRY_NONE, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 50 | IOTHUB_CLIENT_RETRY_IMMEDIATE, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 51 | IOTHUB_CLIENT_RETRY_INTERVAL, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 52 | IOTHUB_CLIENT_RETRY_LINEAR_BACKOFF, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 53 | IOTHUB_CLIENT_RETRY_EXPONENTIAL_BACKOFF, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 54 | IOTHUB_CLIENT_RETRY_EXPONENTIAL_BACKOFF_WITH_JITTER, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 55 | IOTHUB_CLIENT_RETRY_RANDOM |
AzureIoTClient | 53:1e5a1ca1f274 | 56 | |
AzureIoTClient | 53:1e5a1ca1f274 | 57 | /** @brief Enumeration passed in by the IoT Hub when the event confirmation |
AzureIoTClient | 53:1e5a1ca1f274 | 58 | * callback is invoked to indicate status of the event processing in |
AzureIoTClient | 53:1e5a1ca1f274 | 59 | * the hub. |
AzureIoTClient | 53:1e5a1ca1f274 | 60 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 61 | DEFINE_ENUM(IOTHUB_CLIENT_RETRY_POLICY, IOTHUB_CLIENT_RETRY_POLICY_VALUES); |
AzureIoTClient | 53:1e5a1ca1f274 | 62 | |
AzureIoTClient | 48:cc5d91f2b06d | 63 | struct IOTHUBTRANSPORT_CONFIG_TAG; |
AzureIoTClient | 43:038d8511e817 | 64 | typedef struct IOTHUBTRANSPORT_CONFIG_TAG IOTHUBTRANSPORT_CONFIG; |
AzureIoTClient | 43:038d8511e817 | 65 | |
AzureIoTClient | 43:038d8511e817 | 66 | typedef struct IOTHUB_CLIENT_LL_HANDLE_DATA_TAG* IOTHUB_CLIENT_LL_HANDLE; |
AzureIoTClient | 43:038d8511e817 | 67 | |
AzureIoTClient | 43:038d8511e817 | 68 | #define IOTHUB_CLIENT_STATUS_VALUES \ |
AzureIoTClient | 43:038d8511e817 | 69 | IOTHUB_CLIENT_SEND_STATUS_IDLE, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 70 | IOTHUB_CLIENT_SEND_STATUS_BUSY |
AzureIoTClient | 43:038d8511e817 | 71 | |
AzureIoTClient | 43:038d8511e817 | 72 | /** @brief Enumeration returned by the ::IoTHubClient_LL_GetSendStatus |
AzureIoTClient | 43:038d8511e817 | 73 | * API to indicate the current sending status of the IoT Hub client. |
AzureIoTClient | 43:038d8511e817 | 74 | */ |
AzureIoTClient | 43:038d8511e817 | 75 | DEFINE_ENUM(IOTHUB_CLIENT_STATUS, IOTHUB_CLIENT_STATUS_VALUES); |
AzureIoTClient | 43:038d8511e817 | 76 | |
AzureIoTClient | 53:1e5a1ca1f274 | 77 | #define IOTHUB_IDENTITY_TYPE_VALUE \ |
AzureIoTClient | 53:1e5a1ca1f274 | 78 | IOTHUB_TYPE_TELEMETRY, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 79 | IOTHUB_TYPE_DEVICE_TWIN, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 80 | IOTHUB_TYPE_DEVICE_METHODS |
AzureIoTClient | 53:1e5a1ca1f274 | 81 | DEFINE_ENUM(IOTHUB_IDENTITY_TYPE, IOTHUB_IDENTITY_TYPE_VALUE); |
AzureIoTClient | 53:1e5a1ca1f274 | 82 | |
AzureIoTClient | 53:1e5a1ca1f274 | 83 | #define IOTHUB_PROCESS_ITEM_RESULT_VALUE \ |
AzureIoTClient | 53:1e5a1ca1f274 | 84 | IOTHUB_PROCESS_OK, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 85 | IOTHUB_PROCESS_ERROR, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 86 | IOTHUB_PROCESS_NOT_CONNECTED, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 87 | IOTHUB_PROCESS_CONTINUE |
AzureIoTClient | 53:1e5a1ca1f274 | 88 | DEFINE_ENUM(IOTHUB_PROCESS_ITEM_RESULT, IOTHUB_PROCESS_ITEM_RESULT_VALUE); |
AzureIoTClient | 53:1e5a1ca1f274 | 89 | |
AzureIoTClient | 61:8b85a4e797cf | 90 | #define IOTHUBMESSAGE_DISPOSITION_RESULT_VALUES \ |
AzureIoTClient | 61:8b85a4e797cf | 91 | IOTHUBMESSAGE_ACCEPTED, \ |
AzureIoTClient | 61:8b85a4e797cf | 92 | IOTHUBMESSAGE_REJECTED, \ |
AzureIoTClient | 61:8b85a4e797cf | 93 | IOTHUBMESSAGE_ABANDONED |
AzureIoTClient | 61:8b85a4e797cf | 94 | |
AzureIoTClient | 61:8b85a4e797cf | 95 | /** @brief Enumeration returned by the callback which is invoked whenever the |
AzureIoTClient | 61:8b85a4e797cf | 96 | * IoT Hub sends a message to the device. |
AzureIoTClient | 61:8b85a4e797cf | 97 | */ |
AzureIoTClient | 61:8b85a4e797cf | 98 | DEFINE_ENUM(IOTHUBMESSAGE_DISPOSITION_RESULT, IOTHUBMESSAGE_DISPOSITION_RESULT_VALUES); |
AzureIoTClient | 61:8b85a4e797cf | 99 | |
AzureIoTClient | 43:038d8511e817 | 100 | #include "azure_c_shared_utility/agenttime.h" |
AzureIoTClient | 43:038d8511e817 | 101 | #include "azure_c_shared_utility/xio.h" |
AzureIoTClient | 43:038d8511e817 | 102 | #include "azure_c_shared_utility/doublylinkedlist.h" |
AzureIoTClient | 43:038d8511e817 | 103 | #include "iothub_message.h" |
AzureIoTClient | 43:038d8511e817 | 104 | #include "iothub_transport_ll.h" |
AzureIoTClient | 63:1bf1c2d60aab | 105 | #include "iothub_client_authorization.h" |
AzureIoTClient | 53:1e5a1ca1f274 | 106 | #include <stddef.h> |
AzureIoTClient | 53:1e5a1ca1f274 | 107 | #include <stdint.h> |
AzureIoTClient | 53:1e5a1ca1f274 | 108 | |
AzureIoTClient | 53:1e5a1ca1f274 | 109 | #define IOTHUB_CLIENT_IOTHUB_METHOD_STATUS_VALUES \ |
AzureIoTClient | 53:1e5a1ca1f274 | 110 | IOTHUB_CLIENT_IOTHUB_METHOD_STATUS_SUCCESS, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 111 | IOTHUB_CLIENT_IOTHUB_METHOD_STATUS_ERROR \ |
AzureIoTClient | 53:1e5a1ca1f274 | 112 | |
AzureIoTClient | 53:1e5a1ca1f274 | 113 | /** @brief Enumeration returned by remotely executed functions |
AzureIoTClient | 53:1e5a1ca1f274 | 114 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 115 | DEFINE_ENUM(IOTHUB_CLIENT_IOTHUB_METHOD_STATUS, IOTHUB_CLIENT_IOTHUB_METHOD_STATUS_VALUES); |
AzureIoTClient | 43:038d8511e817 | 116 | |
AzureIoTClient | 43:038d8511e817 | 117 | #ifdef __cplusplus |
AzureIoTClient | 43:038d8511e817 | 118 | extern "C" |
AzureIoTClient | 43:038d8511e817 | 119 | { |
AzureIoTClient | 43:038d8511e817 | 120 | #endif |
AzureIoTClient | 16:deba40344375 | 121 | |
AzureIoTClient | 16:deba40344375 | 122 | #define IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES \ |
AzureIoTClient | 16:deba40344375 | 123 | IOTHUB_CLIENT_CONFIRMATION_OK, \ |
AzureIoTClient | 16:deba40344375 | 124 | IOTHUB_CLIENT_CONFIRMATION_BECAUSE_DESTROY, \ |
Azure.IoT Build | 36:67300d5a4c1f | 125 | IOTHUB_CLIENT_CONFIRMATION_MESSAGE_TIMEOUT, \ |
AzureIoTClient | 16:deba40344375 | 126 | IOTHUB_CLIENT_CONFIRMATION_ERROR \ |
AzureIoTClient | 16:deba40344375 | 127 | |
AzureIoTClient | 53:1e5a1ca1f274 | 128 | /** @brief Enumeration passed in by the IoT Hub when the event confirmation |
AzureIoTClient | 53:1e5a1ca1f274 | 129 | * callback is invoked to indicate status of the event processing in |
AzureIoTClient | 53:1e5a1ca1f274 | 130 | * the hub. |
AzureIoTClient | 53:1e5a1ca1f274 | 131 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 132 | DEFINE_ENUM(IOTHUB_CLIENT_CONFIRMATION_RESULT, IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES); |
AzureIoTClient | 16:deba40344375 | 133 | |
AzureIoTClient | 53:1e5a1ca1f274 | 134 | #define IOTHUB_CLIENT_CONNECTION_STATUS_VALUES \ |
AzureIoTClient | 53:1e5a1ca1f274 | 135 | IOTHUB_CLIENT_CONNECTION_AUTHENTICATED, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 136 | IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED \ |
AzureIoTClient | 53:1e5a1ca1f274 | 137 | |
AzureIoTClient | 52:1cc3c6d07cad | 138 | |
AzureIoTClient | 52:1cc3c6d07cad | 139 | /** @brief Enumeration passed in by the IoT Hub when the connection status |
AzureIoTClient | 52:1cc3c6d07cad | 140 | * callback is invoked to indicate status of the connection in |
AzureIoTClient | 52:1cc3c6d07cad | 141 | * the hub. |
AzureIoTClient | 52:1cc3c6d07cad | 142 | */ |
AzureIoTClient | 52:1cc3c6d07cad | 143 | DEFINE_ENUM(IOTHUB_CLIENT_CONNECTION_STATUS, IOTHUB_CLIENT_CONNECTION_STATUS_VALUES); |
AzureIoTClient | 52:1cc3c6d07cad | 144 | |
AzureIoTClient | 53:1e5a1ca1f274 | 145 | #define IOTHUB_CLIENT_CONNECTION_STATUS_REASON_VALUES \ |
AzureIoTClient | 53:1e5a1ca1f274 | 146 | IOTHUB_CLIENT_CONNECTION_EXPIRED_SAS_TOKEN, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 147 | IOTHUB_CLIENT_CONNECTION_DEVICE_DISABLED, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 148 | IOTHUB_CLIENT_CONNECTION_BAD_CREDENTIAL, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 149 | IOTHUB_CLIENT_CONNECTION_RETRY_EXPIRED, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 150 | IOTHUB_CLIENT_CONNECTION_NO_NETWORK, \ |
AzureIoTClient | 62:5a4cdacf5090 | 151 | IOTHUB_CLIENT_CONNECTION_COMMUNICATION_ERROR, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 152 | IOTHUB_CLIENT_CONNECTION_OK \ |
AzureIoTClient | 52:1cc3c6d07cad | 153 | |
AzureIoTClient | 52:1cc3c6d07cad | 154 | /** @brief Enumeration passed in by the IoT Hub when the connection status |
AzureIoTClient | 52:1cc3c6d07cad | 155 | * callback is invoked to indicate status of the connection in |
AzureIoTClient | 52:1cc3c6d07cad | 156 | * the hub. |
AzureIoTClient | 52:1cc3c6d07cad | 157 | */ |
AzureIoTClient | 52:1cc3c6d07cad | 158 | DEFINE_ENUM(IOTHUB_CLIENT_CONNECTION_STATUS_REASON, IOTHUB_CLIENT_CONNECTION_STATUS_REASON_VALUES); |
AzureIoTClient | 52:1cc3c6d07cad | 159 | |
AzureIoTClient | 16:deba40344375 | 160 | #define TRANSPORT_TYPE_VALUES \ |
AzureIoTClient | 16:deba40344375 | 161 | TRANSPORT_LL, /*LL comes from "LowLevel" */ \ |
AzureIoTClient | 16:deba40344375 | 162 | TRANSPORT_THREADED |
AzureIoTClient | 16:deba40344375 | 163 | |
AzureIoTClient | 53:1e5a1ca1f274 | 164 | DEFINE_ENUM(TRANSPORT_TYPE, TRANSPORT_TYPE_VALUES); |
AzureIoTClient | 16:deba40344375 | 165 | |
AzureIoTClient | 53:1e5a1ca1f274 | 166 | #define DEVICE_TWIN_UPDATE_STATE_VALUES \ |
AzureIoTClient | 53:1e5a1ca1f274 | 167 | DEVICE_TWIN_UPDATE_COMPLETE, \ |
AzureIoTClient | 53:1e5a1ca1f274 | 168 | DEVICE_TWIN_UPDATE_PARTIAL |
AzureIoTClient | 16:deba40344375 | 169 | |
AzureIoTClient | 53:1e5a1ca1f274 | 170 | DEFINE_ENUM(DEVICE_TWIN_UPDATE_STATE, DEVICE_TWIN_UPDATE_STATE_VALUES); |
AzureIoTClient | 52:1cc3c6d07cad | 171 | |
AzureIoTClient | 53:1e5a1ca1f274 | 172 | typedef void(*IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK)(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 173 | typedef void(*IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK)(IOTHUB_CLIENT_CONNECTION_STATUS result, IOTHUB_CLIENT_CONNECTION_STATUS_REASON reason, void* userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 174 | typedef IOTHUBMESSAGE_DISPOSITION_RESULT (*IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC)(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 175 | typedef const TRANSPORT_PROVIDER*(*IOTHUB_CLIENT_TRANSPORT_PROVIDER)(void); |
AzureIoTClient | 53:1e5a1ca1f274 | 176 | |
AzureIoTClient | 53:1e5a1ca1f274 | 177 | typedef void(*IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK)(DEVICE_TWIN_UPDATE_STATE update_state, const unsigned char* payLoad, size_t size, void* userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 178 | typedef void(*IOTHUB_CLIENT_REPORTED_STATE_CALLBACK)(int status_code, void* userContextCallback); |
AzureIoTClient | 55:59b527ab3452 | 179 | typedef int(*IOTHUB_CLIENT_DEVICE_METHOD_CALLBACK_ASYNC)(const char* method_name, const unsigned char* payload, size_t size, unsigned char** response, size_t* response_size, void* userContextCallback); |
AzureIoTClient | 55:59b527ab3452 | 180 | typedef int(*IOTHUB_CLIENT_INBOUND_DEVICE_METHOD_CALLBACK)(const char* method_name, const unsigned char* payload, size_t size, METHOD_HANDLE method_id, void* userContextCallback); |
AzureIoTClient | 52:1cc3c6d07cad | 181 | |
AzureIoTClient | 80:db5f5237bc95 | 182 | #ifndef DONT_USE_UPLOADTOBLOB |
AzureIoTClient | 80:db5f5237bc95 | 183 | |
AzureIoTClient | 80:db5f5237bc95 | 184 | #define BLOCK_SIZE (4*1024*1024) |
AzureIoTClient | 80:db5f5237bc95 | 185 | |
AzureIoTClient | 80:db5f5237bc95 | 186 | /** |
AzureIoTClient | 80:db5f5237bc95 | 187 | * @brief Callback invoked by IoTHubClient_UploadMultipleBlocksToBlobAsync requesting the chunks of data to be uploaded. |
AzureIoTClient | 80:db5f5237bc95 | 188 | * @param result The result of the upload of the previous block of data provided by the user. |
AzureIoTClient | 80:db5f5237bc95 | 189 | * @param data Next block of data to be uploaded, to be provided by the user when this callback is invoked. |
AzureIoTClient | 80:db5f5237bc95 | 190 | * @param size Size of the data parameter. |
AzureIoTClient | 80:db5f5237bc95 | 191 | * @param context User context provided on the call to IoTHubClient_UploadMultipleBlocksToBlobAsync. |
AzureIoTClient | 80:db5f5237bc95 | 192 | * @remarks If a NULL is provided for parameter "data" and/or zero is provided for "size", the user indicates to the client that the complete file has been uploaded. |
AzureIoTClient | 80:db5f5237bc95 | 193 | * In such case this callback will be invoked only once more to indicate the status of the final block upload. |
AzureIoTClient | 80:db5f5237bc95 | 194 | * If result is not FILE_UPLOAD_OK, the download is cancelled and this callback stops being invoked. |
AzureIoTClient | 80:db5f5237bc95 | 195 | * When this callback is called for the last time, no data or size is expected, so data and size are set to NULL |
AzureIoTClient | 80:db5f5237bc95 | 196 | */ |
AzureIoTClient | 80:db5f5237bc95 | 197 | typedef void(*IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK)(IOTHUB_CLIENT_FILE_UPLOAD_RESULT result, unsigned char const ** data, size_t* size, void* context); |
AzureIoTClient | 80:db5f5237bc95 | 198 | #endif /* DONT_USE_UPLOADTOBLOB */ |
AzureIoTClient | 80:db5f5237bc95 | 199 | |
AzureIoTClient | 53:1e5a1ca1f274 | 200 | /** @brief This struct captures IoTHub client configuration. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 201 | typedef struct IOTHUB_CLIENT_CONFIG_TAG |
AzureIoTClient | 53:1e5a1ca1f274 | 202 | { |
AzureIoTClient | 53:1e5a1ca1f274 | 203 | /** @brief A function pointer that is passed into the @c IoTHubClientCreate. |
AzureIoTClient | 53:1e5a1ca1f274 | 204 | * A function definition for AMQP is defined in the include @c iothubtransportamqp.h. |
AzureIoTClient | 53:1e5a1ca1f274 | 205 | * A function definition for HTTP is defined in the include @c iothubtransporthttp.h |
AzureIoTClient | 53:1e5a1ca1f274 | 206 | * A function definition for MQTT is defined in the include @c iothubtransportmqtt.h */ |
AzureIoTClient | 53:1e5a1ca1f274 | 207 | IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol; |
AzureIoTClient | 16:deba40344375 | 208 | |
AzureIoTClient | 53:1e5a1ca1f274 | 209 | /** @brief A string that identifies the device. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 210 | const char* deviceId; |
AzureIoTClient | 16:deba40344375 | 211 | |
AzureIoTClient | 53:1e5a1ca1f274 | 212 | /** @brief The device key used to authenticate the device. |
AzureIoTClient | 53:1e5a1ca1f274 | 213 | If neither deviceSasToken nor deviceKey is present then the authentication is assumed x509.*/ |
AzureIoTClient | 53:1e5a1ca1f274 | 214 | const char* deviceKey; |
AzureIoTClient | 40:1a94db9139ea | 215 | |
AzureIoTClient | 53:1e5a1ca1f274 | 216 | /** @brief The device SAS Token used to authenticate the device in place of device key. |
Azure.IoT Build | 45:54c11b1b1407 | 217 | If neither deviceSasToken nor deviceKey is present then the authentication is assumed x509.*/ |
AzureIoTClient | 53:1e5a1ca1f274 | 218 | const char* deviceSasToken; |
AzureIoTClient | 40:1a94db9139ea | 219 | |
AzureIoTClient | 53:1e5a1ca1f274 | 220 | /** @brief The IoT Hub name to which the device is connecting. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 221 | const char* iotHubName; |
AzureIoTClient | 40:1a94db9139ea | 222 | |
AzureIoTClient | 53:1e5a1ca1f274 | 223 | /** @brief IoT Hub suffix goes here, e.g., private.azure-devices-int.net. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 224 | const char* iotHubSuffix; |
AzureIoTClient | 16:deba40344375 | 225 | |
AzureIoTClient | 53:1e5a1ca1f274 | 226 | const char* protocolGatewayHostName; |
AzureIoTClient | 53:1e5a1ca1f274 | 227 | } IOTHUB_CLIENT_CONFIG; |
AzureIoTClient | 16:deba40344375 | 228 | |
AzureIoTClient | 53:1e5a1ca1f274 | 229 | /** @brief This struct captures IoTHub client device configuration. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 230 | typedef struct IOTHUB_CLIENT_DEVICE_CONFIG_TAG |
AzureIoTClient | 53:1e5a1ca1f274 | 231 | { |
AzureIoTClient | 53:1e5a1ca1f274 | 232 | /** @brief A function pointer that is passed into the @c IoTHubClientCreate. |
AzureIoTClient | 53:1e5a1ca1f274 | 233 | * A function definition for AMQP is defined in the include @c iothubtransportamqp.h. |
AzureIoTClient | 53:1e5a1ca1f274 | 234 | * A function definition for HTTP is defined in the include @c iothubtransporthttp.h |
AzureIoTClient | 53:1e5a1ca1f274 | 235 | * A function definition for MQTT is defined in the include @c iothubtransportmqtt.h */ |
AzureIoTClient | 53:1e5a1ca1f274 | 236 | IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol; |
Azure.IoT Build | 36:67300d5a4c1f | 237 | |
AzureIoTClient | 53:1e5a1ca1f274 | 238 | /** @brief a transport handle implementing the protocol */ |
AzureIoTClient | 53:1e5a1ca1f274 | 239 | void * transportHandle; |
Azure.IoT Build | 36:67300d5a4c1f | 240 | |
AzureIoTClient | 53:1e5a1ca1f274 | 241 | /** @brief A string that identifies the device. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 242 | const char* deviceId; |
Azure.IoT Build | 36:67300d5a4c1f | 243 | |
AzureIoTClient | 53:1e5a1ca1f274 | 244 | /** @brief The device key used to authenticate the device. |
Azure.IoT Build | 45:54c11b1b1407 | 245 | x509 authentication is is not supported for multiplexed connections*/ |
AzureIoTClient | 53:1e5a1ca1f274 | 246 | const char* deviceKey; |
Azure.IoT Build | 36:67300d5a4c1f | 247 | |
AzureIoTClient | 53:1e5a1ca1f274 | 248 | /** @brief The device SAS Token used to authenticate the device in place of device key. |
Azure.IoT Build | 45:54c11b1b1407 | 249 | x509 authentication is is not supported for multiplexed connections.*/ |
AzureIoTClient | 53:1e5a1ca1f274 | 250 | const char* deviceSasToken; |
AzureIoTClient | 53:1e5a1ca1f274 | 251 | } IOTHUB_CLIENT_DEVICE_CONFIG; |
Azure.IoT Build | 36:67300d5a4c1f | 252 | |
AzureIoTClient | 53:1e5a1ca1f274 | 253 | /** @brief This struct captures IoTHub transport configuration. */ |
AzureIoTClient | 53:1e5a1ca1f274 | 254 | struct IOTHUBTRANSPORT_CONFIG_TAG |
AzureIoTClient | 53:1e5a1ca1f274 | 255 | { |
AzureIoTClient | 53:1e5a1ca1f274 | 256 | const IOTHUB_CLIENT_CONFIG* upperConfig; |
AzureIoTClient | 53:1e5a1ca1f274 | 257 | PDLIST_ENTRY waitingToSend; |
AzureIoTClient | 63:1bf1c2d60aab | 258 | IOTHUB_AUTHORIZATION_HANDLE auth_module_handle; |
AzureIoTClient | 53:1e5a1ca1f274 | 259 | }; |
Azure.IoT Build | 37:18310e4d888d | 260 | |
Azure.IoT Build | 37:18310e4d888d | 261 | |
AzureIoTClient | 53:1e5a1ca1f274 | 262 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 263 | * @brief Creates a IoT Hub client for communication with an existing |
AzureIoTClient | 53:1e5a1ca1f274 | 264 | * IoT Hub using the specified connection string parameter. |
AzureIoTClient | 53:1e5a1ca1f274 | 265 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 266 | * @param connectionString Pointer to a character string |
AzureIoTClient | 53:1e5a1ca1f274 | 267 | * @param protocol Function pointer for protocol implementation |
AzureIoTClient | 53:1e5a1ca1f274 | 268 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 269 | * Sample connection string: |
AzureIoTClient | 53:1e5a1ca1f274 | 270 | * <blockquote> |
AzureIoTClient | 53:1e5a1ca1f274 | 271 | * <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 | 53:1e5a1ca1f274 | 272 | * </blockquote> |
AzureIoTClient | 53:1e5a1ca1f274 | 273 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 274 | * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when |
AzureIoTClient | 53:1e5a1ca1f274 | 275 | * invoking other functions for IoT Hub client and @c NULL on failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 276 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 277 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_LL_HANDLE, IoTHubClient_LL_CreateFromConnectionString, const char*, connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol); |
AzureIoTClient | 16:deba40344375 | 278 | |
AzureIoTClient | 53:1e5a1ca1f274 | 279 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 280 | * @brief Creates a IoT Hub client for communication with an existing IoT |
AzureIoTClient | 53:1e5a1ca1f274 | 281 | * Hub using the specified parameters. |
AzureIoTClient | 53:1e5a1ca1f274 | 282 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 283 | * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure |
AzureIoTClient | 53:1e5a1ca1f274 | 284 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 285 | * The API does not allow sharing of a connection across multiple |
AzureIoTClient | 53:1e5a1ca1f274 | 286 | * devices. This is a blocking call. |
AzureIoTClient | 53:1e5a1ca1f274 | 287 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 288 | * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when |
AzureIoTClient | 53:1e5a1ca1f274 | 289 | * invoking other functions for IoT Hub client and @c NULL on failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 290 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 291 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_LL_HANDLE, IoTHubClient_LL_Create, const IOTHUB_CLIENT_CONFIG*, config); |
AzureIoTClient | 16:deba40344375 | 292 | |
AzureIoTClient | 53:1e5a1ca1f274 | 293 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 294 | * @brief Creates a IoT Hub client for communication with an existing IoT |
AzureIoTClient | 53:1e5a1ca1f274 | 295 | * Hub using an existing transport. |
AzureIoTClient | 53:1e5a1ca1f274 | 296 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 297 | * @param config Pointer to an @c IOTHUB_CLIENT_DEVICE_CONFIG structure |
AzureIoTClient | 53:1e5a1ca1f274 | 298 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 299 | * The API *allows* sharing of a connection across multiple |
AzureIoTClient | 53:1e5a1ca1f274 | 300 | * devices. This is a blocking call. |
AzureIoTClient | 53:1e5a1ca1f274 | 301 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 302 | * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when |
AzureIoTClient | 53:1e5a1ca1f274 | 303 | * invoking other functions for IoT Hub client and @c NULL on failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 304 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 305 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_LL_HANDLE, IoTHubClient_LL_CreateWithTransport, const IOTHUB_CLIENT_DEVICE_CONFIG*, config); |
Azure.IoT Build | 36:67300d5a4c1f | 306 | |
AzureIoTClient | 53:1e5a1ca1f274 | 307 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 308 | * @brief Disposes of resources allocated by the IoT Hub client. This is a |
AzureIoTClient | 53:1e5a1ca1f274 | 309 | * blocking call. |
AzureIoTClient | 53:1e5a1ca1f274 | 310 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 311 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 312 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 313 | MOCKABLE_FUNCTION(, void, IoTHubClient_LL_Destroy, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle); |
AzureIoTClient | 16:deba40344375 | 314 | |
AzureIoTClient | 53:1e5a1ca1f274 | 315 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 316 | * @brief Asynchronous call to send the message specified by @p eventMessageHandle. |
AzureIoTClient | 53:1e5a1ca1f274 | 317 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 318 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 319 | * @param eventMessageHandle The handle to an IoT Hub message. |
AzureIoTClient | 53:1e5a1ca1f274 | 320 | * @param eventConfirmationCallback The callback specified by the device for receiving |
AzureIoTClient | 53:1e5a1ca1f274 | 321 | * confirmation of the delivery of the IoT Hub message. |
AzureIoTClient | 53:1e5a1ca1f274 | 322 | * This callback can be expected to invoke the |
AzureIoTClient | 53:1e5a1ca1f274 | 323 | * ::IoTHubClient_LL_SendEventAsync function for the |
AzureIoTClient | 53:1e5a1ca1f274 | 324 | * same message in an attempt to retry sending a failing |
AzureIoTClient | 53:1e5a1ca1f274 | 325 | * message. The user can specify a @c NULL value here to |
AzureIoTClient | 53:1e5a1ca1f274 | 326 | * indicate that no callback is required. |
AzureIoTClient | 53:1e5a1ca1f274 | 327 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 53:1e5a1ca1f274 | 328 | * callback. This can be @c NULL. |
AzureIoTClient | 53:1e5a1ca1f274 | 329 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 330 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 53:1e5a1ca1f274 | 331 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 53:1e5a1ca1f274 | 332 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 333 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 334 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 335 | 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 | 336 | |
AzureIoTClient | 53:1e5a1ca1f274 | 337 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 338 | * @brief This function returns the current sending status for IoTHubClient. |
AzureIoTClient | 53:1e5a1ca1f274 | 339 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 340 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 341 | * @param iotHubClientStatus The sending state is populated at the address pointed |
AzureIoTClient | 53:1e5a1ca1f274 | 342 | * at by this parameter. The value will be set to |
AzureIoTClient | 53:1e5a1ca1f274 | 343 | * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently |
AzureIoTClient | 53:1e5a1ca1f274 | 344 | * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY |
AzureIoTClient | 53:1e5a1ca1f274 | 345 | * if there are. |
AzureIoTClient | 53:1e5a1ca1f274 | 346 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 347 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 348 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 349 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_GetSendStatus, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_STATUS*, iotHubClientStatus); |
AzureIoTClient | 16:deba40344375 | 350 | |
AzureIoTClient | 53:1e5a1ca1f274 | 351 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 352 | * @brief Sets up the message callback to be invoked when IoT Hub issues a |
AzureIoTClient | 53:1e5a1ca1f274 | 353 | * message to the device. This is a blocking call. |
AzureIoTClient | 53:1e5a1ca1f274 | 354 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 355 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 356 | * @param messageCallback The callback specified by the device for receiving |
AzureIoTClient | 53:1e5a1ca1f274 | 357 | * messages from IoT Hub. |
AzureIoTClient | 53:1e5a1ca1f274 | 358 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 53:1e5a1ca1f274 | 359 | * callback. This can be @c NULL. |
AzureIoTClient | 53:1e5a1ca1f274 | 360 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 361 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 53:1e5a1ca1f274 | 362 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 53:1e5a1ca1f274 | 363 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 364 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 365 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 366 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetMessageCallback, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC, messageCallback, void*, userContextCallback); |
AzureIoTClient | 16:deba40344375 | 367 | |
AzureIoTClient | 52:1cc3c6d07cad | 368 | /** |
AzureIoTClient | 52:1cc3c6d07cad | 369 | * @brief Sets up the connection status callback to be invoked representing the status of |
AzureIoTClient | 52:1cc3c6d07cad | 370 | * the connection to IOT Hub. This is a blocking call. |
AzureIoTClient | 52:1cc3c6d07cad | 371 | * |
AzureIoTClient | 52:1cc3c6d07cad | 372 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 52:1cc3c6d07cad | 373 | * @param connectionStatusCallback The callback specified by the device for receiving |
AzureIoTClient | 52:1cc3c6d07cad | 374 | * updates about the status of the connection to IoT Hub. |
AzureIoTClient | 52:1cc3c6d07cad | 375 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 52:1cc3c6d07cad | 376 | * callback. This can be @c NULL. |
AzureIoTClient | 52:1cc3c6d07cad | 377 | * |
AzureIoTClient | 52:1cc3c6d07cad | 378 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 52:1cc3c6d07cad | 379 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 52:1cc3c6d07cad | 380 | * |
AzureIoTClient | 52:1cc3c6d07cad | 381 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 52:1cc3c6d07cad | 382 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 383 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetConnectionStatusCallback, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK, connectionStatusCallback, void*, userContextCallback); |
AzureIoTClient | 52:1cc3c6d07cad | 384 | |
AzureIoTClient | 52:1cc3c6d07cad | 385 | /** |
AzureIoTClient | 52:1cc3c6d07cad | 386 | * @brief Sets up the connection status callback to be invoked representing the status of |
AzureIoTClient | 52:1cc3c6d07cad | 387 | * the connection to IOT Hub. This is a blocking call. |
AzureIoTClient | 52:1cc3c6d07cad | 388 | * |
AzureIoTClient | 52:1cc3c6d07cad | 389 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 52:1cc3c6d07cad | 390 | * @param retryPolicy The policy to use to reconnect to IoT Hub when a |
AzureIoTClient | 52:1cc3c6d07cad | 391 | * connection drops. |
AzureIoTClient | 53:1e5a1ca1f274 | 392 | * @param retryTimeoutLimitInSeconds Maximum amount of time(seconds) to attempt reconnection when a |
AzureIoTClient | 52:1cc3c6d07cad | 393 | * connection drops to IOT Hub. |
AzureIoTClient | 52:1cc3c6d07cad | 394 | * |
AzureIoTClient | 52:1cc3c6d07cad | 395 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 52:1cc3c6d07cad | 396 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 52:1cc3c6d07cad | 397 | * |
AzureIoTClient | 52:1cc3c6d07cad | 398 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 52:1cc3c6d07cad | 399 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 400 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetRetryPolicy, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY, retryPolicy, size_t, retryTimeoutLimitInSeconds); |
AzureIoTClient | 52:1cc3c6d07cad | 401 | |
AzureIoTClient | 52:1cc3c6d07cad | 402 | |
AzureIoTClient | 52:1cc3c6d07cad | 403 | /** |
AzureIoTClient | 52:1cc3c6d07cad | 404 | * @brief Sets up the connection status callback to be invoked representing the status of |
AzureIoTClient | 52:1cc3c6d07cad | 405 | * the connection to IOT Hub. This is a blocking call. |
AzureIoTClient | 52:1cc3c6d07cad | 406 | * |
AzureIoTClient | 52:1cc3c6d07cad | 407 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 52:1cc3c6d07cad | 408 | * @param retryPolicy Out parameter containing the policy to use to reconnect to IoT Hub. |
AzureIoTClient | 53:1e5a1ca1f274 | 409 | * @param retryTimeoutLimitInSeconds Out parameter containing maximum amount of time in seconds to attempt reconnection |
AzureIoTClient | 52:1cc3c6d07cad | 410 | to IOT Hub. |
AzureIoTClient | 52:1cc3c6d07cad | 411 | * |
AzureIoTClient | 52:1cc3c6d07cad | 412 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 52:1cc3c6d07cad | 413 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 52:1cc3c6d07cad | 414 | * |
AzureIoTClient | 52:1cc3c6d07cad | 415 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 52:1cc3c6d07cad | 416 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 417 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_GetRetryPolicy, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY*, retryPolicy, size_t*, retryTimeoutLimitInSeconds); |
AzureIoTClient | 52:1cc3c6d07cad | 418 | |
AzureIoTClient | 53:1e5a1ca1f274 | 419 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 420 | * @brief This function returns in the out parameter @p lastMessageReceiveTime |
AzureIoTClient | 53:1e5a1ca1f274 | 421 | * what was the value of the @c time function when the last message was |
AzureIoTClient | 53:1e5a1ca1f274 | 422 | * received at the client. |
AzureIoTClient | 53:1e5a1ca1f274 | 423 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 424 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 425 | * @param lastMessageReceiveTime Out parameter containing the value of @c time function |
AzureIoTClient | 53:1e5a1ca1f274 | 426 | * when the last message was received. |
AzureIoTClient | 53:1e5a1ca1f274 | 427 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 428 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 429 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 430 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_GetLastMessageReceiveTime, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, time_t*, lastMessageReceiveTime); |
AzureIoTClient | 16:deba40344375 | 431 | |
AzureIoTClient | 53:1e5a1ca1f274 | 432 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 433 | * @brief This function is meant to be called by the user when work |
AzureIoTClient | 53:1e5a1ca1f274 | 434 | * (sending/receiving) can be done by the IoTHubClient. |
AzureIoTClient | 53:1e5a1ca1f274 | 435 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 436 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 437 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 438 | * All IoTHubClient interactions (in regards to network traffic |
AzureIoTClient | 53:1e5a1ca1f274 | 439 | * and/or user level callbacks) are the effect of calling this |
AzureIoTClient | 53:1e5a1ca1f274 | 440 | * function and they take place synchronously inside _DoWork. |
AzureIoTClient | 53:1e5a1ca1f274 | 441 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 442 | MOCKABLE_FUNCTION(, void, IoTHubClient_LL_DoWork, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle); |
AzureIoTClient | 16:deba40344375 | 443 | |
AzureIoTClient | 53:1e5a1ca1f274 | 444 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 445 | * @brief This API sets a runtime option identified by parameter @p optionName |
AzureIoTClient | 53:1e5a1ca1f274 | 446 | * to a value pointed to by @p value. @p optionName and the data type |
AzureIoTClient | 53:1e5a1ca1f274 | 447 | * @p value is pointing to are specific for every option. |
AzureIoTClient | 53:1e5a1ca1f274 | 448 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 449 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 450 | * @param optionName Name of the option. |
AzureIoTClient | 53:1e5a1ca1f274 | 451 | * @param value The value. |
AzureIoTClient | 53:1e5a1ca1f274 | 452 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 453 | * The options that can be set via this API are: |
AzureIoTClient | 53:1e5a1ca1f274 | 454 | * - @b timeout - the maximum time in milliseconds a communication is |
AzureIoTClient | 53:1e5a1ca1f274 | 455 | * allowed to use. @p value is a pointer to an @c unsigned @c int with |
AzureIoTClient | 53:1e5a1ca1f274 | 456 | * the timeout value in milliseconds. This is only supported for the HTTP |
AzureIoTClient | 53:1e5a1ca1f274 | 457 | * protocol as of now. When the HTTP protocol uses CURL, the meaning of |
AzureIoTClient | 53:1e5a1ca1f274 | 458 | * the parameter is <em>total request time</em>. When the HTTP protocol uses |
AzureIoTClient | 53:1e5a1ca1f274 | 459 | * winhttp, the meaning is the same as the @c dwSendTimeout and |
AzureIoTClient | 53:1e5a1ca1f274 | 460 | * @c dwReceiveTimeout parameters of the |
AzureIoTClient | 53:1e5a1ca1f274 | 461 | * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx"> |
AzureIoTClient | 53:1e5a1ca1f274 | 462 | * WinHttpSetTimeouts</a> API. |
AzureIoTClient | 53:1e5a1ca1f274 | 463 | * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only |
AzureIoTClient | 53:1e5a1ca1f274 | 464 | * when CURL is used. It has the same meaning as CURL's option with the same |
AzureIoTClient | 53:1e5a1ca1f274 | 465 | * name. @p value is pointer to a long. |
AzureIoTClient | 53:1e5a1ca1f274 | 466 | * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only |
AzureIoTClient | 53:1e5a1ca1f274 | 467 | * when CURL is used. It has the same meaning as CURL's option with the same |
AzureIoTClient | 53:1e5a1ca1f274 | 468 | * name. @p value is pointer to a long. |
AzureIoTClient | 53:1e5a1ca1f274 | 469 | * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only |
AzureIoTClient | 53:1e5a1ca1f274 | 470 | * when CURL is used. It has the same meaning as CURL's option with the same |
AzureIoTClient | 53:1e5a1ca1f274 | 471 | * name. @p value is pointer to a long. |
AzureIoTClient | 53:1e5a1ca1f274 | 472 | * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only |
AzureIoTClient | 53:1e5a1ca1f274 | 473 | * when CURL is used. It has the same meaning as CURL's option with the same |
AzureIoTClient | 53:1e5a1ca1f274 | 474 | * name. @p value is pointer to a long. |
AzureIoTClient | 53:1e5a1ca1f274 | 475 | * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only |
AzureIoTClient | 53:1e5a1ca1f274 | 476 | * when CURL is used. It has the same meaning as CURL's option with the same |
AzureIoTClient | 53:1e5a1ca1f274 | 477 | * name. @p value is pointer to a long. |
AzureIoTClient | 53:1e5a1ca1f274 | 478 | * - @b keepalive - available for MQTT protocol. Integer value that sets the |
AzureIoTClient | 53:1e5a1ca1f274 | 479 | * interval in seconds when pings are sent to the server. |
AzureIoTClient | 53:1e5a1ca1f274 | 480 | * - @b logtrace - available for MQTT protocol. Boolean value that turns on and |
AzureIoTClient | 53:1e5a1ca1f274 | 481 | * off the diagnostic logging. |
AzureIoTClient | 76:943524fee0b7 | 482 | * - @b sas_token_lifetime - available for MQTT & AMQP protocol. size_t value that that determines the |
AzureIoTClient | 76:943524fee0b7 | 483 | * sas token timeout length. |
AzureIoTClient | 53:1e5a1ca1f274 | 484 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 485 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 486 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 487 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetOption, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, optionName, const void*, value); |
AzureIoTClient | 53:1e5a1ca1f274 | 488 | |
AzureIoTClient | 53:1e5a1ca1f274 | 489 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 490 | * @brief This API specifies a call back to be used when the device receives a desired state update. |
AzureIoTClient | 53:1e5a1ca1f274 | 491 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 492 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 493 | * @param deviceTwinCallback The callback specified by the device client to be used for updating |
AzureIoTClient | 53:1e5a1ca1f274 | 494 | * the desired state. The callback will be called in response to patch |
AzureIoTClient | 53:1e5a1ca1f274 | 495 | * request send by the IoTHub services. The payload will be passed to the |
AzureIoTClient | 53:1e5a1ca1f274 | 496 | * callback, along with two version numbers: |
AzureIoTClient | 53:1e5a1ca1f274 | 497 | * - Desired: |
AzureIoTClient | 53:1e5a1ca1f274 | 498 | * - LastSeenReported: |
AzureIoTClient | 53:1e5a1ca1f274 | 499 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 53:1e5a1ca1f274 | 500 | * callback. This can be @c NULL. |
AzureIoTClient | 53:1e5a1ca1f274 | 501 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 502 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 53:1e5a1ca1f274 | 503 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 53:1e5a1ca1f274 | 504 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 505 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 506 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 507 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetDeviceTwinCallback, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK, deviceTwinCallback, void*, userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 508 | |
AzureIoTClient | 53:1e5a1ca1f274 | 509 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 510 | * @brief This API sneds a report of the device's properties and their current values. |
AzureIoTClient | 53:1e5a1ca1f274 | 511 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 512 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 513 | * @param reportedState The current device property values to be 'reported' to the IoTHub. |
AzureIoTClient | 53:1e5a1ca1f274 | 514 | * @param reportedStateCallback The callback specified by the device client to be called with the |
AzureIoTClient | 53:1e5a1ca1f274 | 515 | * result of the transaction. |
AzureIoTClient | 53:1e5a1ca1f274 | 516 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 53:1e5a1ca1f274 | 517 | * callback. This can be @c NULL. |
AzureIoTClient | 53:1e5a1ca1f274 | 518 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 519 | * @b NOTE: The application behavior is undefined if the user calls |
AzureIoTClient | 53:1e5a1ca1f274 | 520 | * the ::IoTHubClient_LL_Destroy function from within any callback. |
AzureIoTClient | 53:1e5a1ca1f274 | 521 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 522 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 523 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 524 | 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 | 525 | |
AzureIoTClient | 53:1e5a1ca1f274 | 526 | /** |
AzureIoTClient | 53:1e5a1ca1f274 | 527 | * @brief This API sets callback for cloud to device method call. |
AzureIoTClient | 53:1e5a1ca1f274 | 528 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 529 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 53:1e5a1ca1f274 | 530 | * @param deviceMethodCallback The callback which will be called by IoTHub. |
AzureIoTClient | 53:1e5a1ca1f274 | 531 | * @param userContextCallback User specified context that will be provided to the |
AzureIoTClient | 53:1e5a1ca1f274 | 532 | * callback. This can be @c NULL. |
AzureIoTClient | 53:1e5a1ca1f274 | 533 | * |
AzureIoTClient | 53:1e5a1ca1f274 | 534 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 53:1e5a1ca1f274 | 535 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 536 | 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 | 537 | |
Azure.IoT.Build | 54:6dcad9019a64 | 538 | /** |
Azure.IoT.Build | 54:6dcad9019a64 | 539 | * @brief This API sets callback for async cloud to device method call. |
Azure.IoT.Build | 54:6dcad9019a64 | 540 | * |
Azure.IoT.Build | 54:6dcad9019a64 | 541 | * @param iotHubClientHandle The handle created by a call to the create function. |
Azure.IoT.Build | 54:6dcad9019a64 | 542 | * @param inboundDeviceMethodCallback The callback which will be called by IoTHub. |
Azure.IoT.Build | 54:6dcad9019a64 | 543 | * @param userContextCallback User specified context that will be provided to the |
Azure.IoT.Build | 54:6dcad9019a64 | 544 | * callback. This can be @c NULL. |
Azure.IoT.Build | 54:6dcad9019a64 | 545 | * |
Azure.IoT.Build | 54:6dcad9019a64 | 546 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
Azure.IoT.Build | 54:6dcad9019a64 | 547 | */ |
AzureIoTClient | 55:59b527ab3452 | 548 | 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 | 549 | |
Azure.IoT.Build | 54:6dcad9019a64 | 550 | /** |
Azure.IoT.Build | 54:6dcad9019a64 | 551 | * @brief This API responses to a asnyc method callback identified the methodId. |
Azure.IoT.Build | 54:6dcad9019a64 | 552 | * |
Azure.IoT.Build | 54:6dcad9019a64 | 553 | * @param iotHubClientHandle The handle created by a call to the create function. |
Azure.IoT.Build | 54:6dcad9019a64 | 554 | * @param methodId The methodId of the Device Method callback. |
Azure.IoT.Build | 54:6dcad9019a64 | 555 | * @param response The response data for the method callback. |
AzureIoTClient | 55:59b527ab3452 | 556 | * @param response_size The size of the response data buffer. |
Azure.IoT.Build | 54:6dcad9019a64 | 557 | * @param status_response The status response of the method callback. |
Azure.IoT.Build | 54:6dcad9019a64 | 558 | * |
Azure.IoT.Build | 54:6dcad9019a64 | 559 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
Azure.IoT.Build | 54:6dcad9019a64 | 560 | */ |
AzureIoTClient | 55:59b527ab3452 | 561 | 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 | 562 | |
AzureIoTClient | 44:33dd78697616 | 563 | #ifndef DONT_USE_UPLOADTOBLOB |
AzureIoTClient | 43:038d8511e817 | 564 | /** |
AzureIoTClient | 43:038d8511e817 | 565 | * @brief This API uploads to Azure Storage the content pointed to by @p source having the size @p size |
AzureIoTClient | 43:038d8511e817 | 566 | * under the blob name devicename/@pdestinationFileName |
AzureIoTClient | 43:038d8511e817 | 567 | * |
AzureIoTClient | 43:038d8511e817 | 568 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 43:038d8511e817 | 569 | * @param destinationFileName name of the file. |
AzureIoTClient | 43:038d8511e817 | 570 | * @param source pointer to the source for file content (can be NULL) |
AzureIoTClient | 43:038d8511e817 | 571 | * @param size the size of the source in memory (if @p source is NULL then size needs to be 0). |
AzureIoTClient | 43:038d8511e817 | 572 | * |
AzureIoTClient | 43:038d8511e817 | 573 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 43:038d8511e817 | 574 | */ |
AzureIoTClient | 53:1e5a1ca1f274 | 575 | 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 | 576 | |
AzureIoTClient | 80:db5f5237bc95 | 577 | /** |
AzureIoTClient | 80:db5f5237bc95 | 578 | * @brief This API uploads to Azure Storage the content provided block by block by @p getDataCallback |
AzureIoTClient | 80:db5f5237bc95 | 579 | * under the blob name devicename/@pdestinationFileName |
AzureIoTClient | 80:db5f5237bc95 | 580 | * |
AzureIoTClient | 80:db5f5237bc95 | 581 | * @param iotHubClientHandle The handle created by a call to the create function. |
AzureIoTClient | 80:db5f5237bc95 | 582 | * @param destinationFileName name of the file. |
AzureIoTClient | 80:db5f5237bc95 | 583 | * @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 | 584 | * @param context Any data provided by the user to serve as context on getDataCallback. |
AzureIoTClient | 80:db5f5237bc95 | 585 | * |
AzureIoTClient | 80:db5f5237bc95 | 586 | * @return IOTHUB_CLIENT_OK upon success or an error code upon failure. |
AzureIoTClient | 80:db5f5237bc95 | 587 | */ |
AzureIoTClient | 80:db5f5237bc95 | 588 | 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 | 44:33dd78697616 | 589 | #endif /*DONT_USE_UPLOADTOBLOB*/ |
AzureIoTClient | 43:038d8511e817 | 590 | |
AzureIoTClient | 16:deba40344375 | 591 | #ifdef __cplusplus |
AzureIoTClient | 16:deba40344375 | 592 | } |
AzureIoTClient | 16:deba40344375 | 593 | #endif |
AzureIoTClient | 16:deba40344375 | 594 | |
AzureIoTClient | 16:deba40344375 | 595 | #endif /* IOTHUB_CLIENT_LL_H */ |