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:
Azure.IoT.Build
Date:
Wed Dec 14 15:59:51 2016 -0800
Revision:
54:6dcad9019a64
Parent:
53:1e5a1ca1f274
Child:
55:59b527ab3452
1.1.2

Who changed what in which revision?

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