corrected version (with typedef struct IOTHUB_CLIENT_LL_UPLOADTOBLOB_HANDLE_DATA* IOTHUB_CLIENT_LL_UPLOADTOBLOB_HANDLE;) included in the sources

Dependents:   STM32F746_iothub_client_sample_mqtt

Fork of iothub_client by Azure IoT

Committer:
AzureIoTClient
Date:
Tue Jun 07 10:49:08 2016 -0700
Revision:
42:448eecc3676e
Parent:
40:1a94db9139ea
Child:
43:038d8511e817
1.0.8

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/agenttime.h"
Azure.IoT Build 38:a05929a75111 27 #include "azure_c_shared_utility/macro_utils.h"
Azure.IoT Build 38:a05929a75111 28 #include "azure_c_shared_utility/xio.h"
Azure.IoT Build 38:a05929a75111 29 #include "azure_c_shared_utility/doublylinkedlist.h"
AzureIoTClient 16:deba40344375 30 #include "iothub_message.h"
AzureIoTClient 16:deba40344375 31
AzureIoTClient 16:deba40344375 32 #ifdef __cplusplus
AzureIoTClient 16:deba40344375 33 extern "C"
AzureIoTClient 16:deba40344375 34 {
AzureIoTClient 16:deba40344375 35 #endif
AzureIoTClient 16:deba40344375 36
AzureIoTClient 16:deba40344375 37 #define IOTHUB_CLIENT_RESULT_VALUES \
AzureIoTClient 16:deba40344375 38 IOTHUB_CLIENT_OK, \
AzureIoTClient 16:deba40344375 39 IOTHUB_CLIENT_INVALID_ARG, \
AzureIoTClient 16:deba40344375 40 IOTHUB_CLIENT_ERROR, \
AzureIoTClient 16:deba40344375 41 IOTHUB_CLIENT_INVALID_SIZE, \
AzureIoTClient 16:deba40344375 42 IOTHUB_CLIENT_INDEFINITE_TIME \
AzureIoTClient 16:deba40344375 43
AzureIoTClient 40:1a94db9139ea 44 /** @brief Enumeration specifying the status of calls to various APIs in this module.
AzureIoTClient 40:1a94db9139ea 45 */
AzureIoTClient 40:1a94db9139ea 46 DEFINE_ENUM(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_RESULT_VALUES);
AzureIoTClient 16:deba40344375 47
AzureIoTClient 16:deba40344375 48 #define IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES \
AzureIoTClient 16:deba40344375 49 IOTHUB_CLIENT_CONFIRMATION_OK, \
AzureIoTClient 16:deba40344375 50 IOTHUB_CLIENT_CONFIRMATION_BECAUSE_DESTROY, \
Azure.IoT Build 36:67300d5a4c1f 51 IOTHUB_CLIENT_CONFIRMATION_MESSAGE_TIMEOUT, \
AzureIoTClient 16:deba40344375 52 IOTHUB_CLIENT_CONFIRMATION_ERROR \
AzureIoTClient 16:deba40344375 53
AzureIoTClient 40:1a94db9139ea 54 /** @brief Enumeration passed in by the IoT Hub when the event confirmation
AzureIoTClient 40:1a94db9139ea 55 * callback is invoked to indicate status of the event processing in
AzureIoTClient 40:1a94db9139ea 56 * the hub.
AzureIoTClient 40:1a94db9139ea 57 */
AzureIoTClient 40:1a94db9139ea 58 DEFINE_ENUM(IOTHUB_CLIENT_CONFIRMATION_RESULT, IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES);
AzureIoTClient 16:deba40344375 59
AzureIoTClient 16:deba40344375 60 #define IOTHUB_CLIENT_STATUS_VALUES \
AzureIoTClient 16:deba40344375 61 IOTHUB_CLIENT_SEND_STATUS_IDLE, \
AzureIoTClient 16:deba40344375 62 IOTHUB_CLIENT_SEND_STATUS_BUSY \
AzureIoTClient 16:deba40344375 63
AzureIoTClient 40:1a94db9139ea 64 /** @brief Enumeration returned by the ::IoTHubClient_LL_GetSendStatus
AzureIoTClient 40:1a94db9139ea 65 * API to indicate the current sending status of the IoT Hub client.
AzureIoTClient 40:1a94db9139ea 66 */
AzureIoTClient 40:1a94db9139ea 67 DEFINE_ENUM(IOTHUB_CLIENT_STATUS, IOTHUB_CLIENT_STATUS_VALUES);
AzureIoTClient 16:deba40344375 68
AzureIoTClient 16:deba40344375 69 #define TRANSPORT_TYPE_VALUES \
AzureIoTClient 16:deba40344375 70 TRANSPORT_LL, /*LL comes from "LowLevel" */ \
AzureIoTClient 16:deba40344375 71 TRANSPORT_THREADED
AzureIoTClient 16:deba40344375 72
AzureIoTClient 40:1a94db9139ea 73 DEFINE_ENUM(TRANSPORT_TYPE, TRANSPORT_TYPE_VALUES);
AzureIoTClient 16:deba40344375 74
AzureIoTClient 16:deba40344375 75 #define IOTHUBMESSAGE_DISPOSITION_RESULT_VALUES \
AzureIoTClient 16:deba40344375 76 IOTHUBMESSAGE_ACCEPTED, \
AzureIoTClient 16:deba40344375 77 IOTHUBMESSAGE_REJECTED, \
AzureIoTClient 16:deba40344375 78 IOTHUBMESSAGE_ABANDONED
AzureIoTClient 16:deba40344375 79
AzureIoTClient 40:1a94db9139ea 80 /** @brief Enumeration returned by the callback which is invoked whenever the
AzureIoTClient 40:1a94db9139ea 81 * IoT Hub sends a message to the device.
AzureIoTClient 40:1a94db9139ea 82 */
AzureIoTClient 40:1a94db9139ea 83 DEFINE_ENUM(IOTHUBMESSAGE_DISPOSITION_RESULT, IOTHUBMESSAGE_DISPOSITION_RESULT_VALUES);
AzureIoTClient 16:deba40344375 84
AzureIoTClient 40:1a94db9139ea 85 typedef struct IOTHUB_CLIENT_LL_HANDLE_DATA_TAG* IOTHUB_CLIENT_LL_HANDLE;
AzureIoTClient 40:1a94db9139ea 86 typedef void(*IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK)(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback);
AzureIoTClient 40:1a94db9139ea 87 typedef IOTHUBMESSAGE_DISPOSITION_RESULT (*IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC)(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback);
AzureIoTClient 40:1a94db9139ea 88 typedef const void*(*IOTHUB_CLIENT_TRANSPORT_PROVIDER)(void);
AzureIoTClient 16:deba40344375 89
AzureIoTClient 40:1a94db9139ea 90 /** @brief This struct captures IoTHub client configuration. */
AzureIoTClient 40:1a94db9139ea 91 typedef struct IOTHUB_CLIENT_CONFIG_TAG
AzureIoTClient 40:1a94db9139ea 92 {
AzureIoTClient 40:1a94db9139ea 93 /** @brief A function pointer that is passed into the @c IoTHubClientCreate.
AzureIoTClient 40:1a94db9139ea 94 * A function definition for AMQP is defined in the include @c iothubtransportamqp.h.
AzureIoTClient 40:1a94db9139ea 95 * A function definition for HTTP is defined in the include @c iothubtransporthttp.h
AzureIoTClient 40:1a94db9139ea 96 * A function definition for MQTT is defined in the include @c iothubtransportmqtt.h */
AzureIoTClient 40:1a94db9139ea 97 IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol;
AzureIoTClient 16:deba40344375 98
AzureIoTClient 40:1a94db9139ea 99 /** @brief A string that identifies the device. */
AzureIoTClient 40:1a94db9139ea 100 const char* deviceId;
AzureIoTClient 40:1a94db9139ea 101
AzureIoTClient 40:1a94db9139ea 102 /** @brief The device key used to authenticate the device. */
AzureIoTClient 40:1a94db9139ea 103 const char* deviceKey;
AzureIoTClient 40:1a94db9139ea 104
AzureIoTClient 40:1a94db9139ea 105 /** @brief The device SAS Token used to authenticate the device in place of device key. */
AzureIoTClient 40:1a94db9139ea 106 const char* deviceSasToken;
AzureIoTClient 40:1a94db9139ea 107
AzureIoTClient 40:1a94db9139ea 108 /** @brief The IoT Hub name to which the device is connecting. */
AzureIoTClient 40:1a94db9139ea 109 const char* iotHubName;
AzureIoTClient 16:deba40344375 110
AzureIoTClient 40:1a94db9139ea 111 /** @brief IoT Hub suffix goes here, e.g., private.azure-devices-int.net. */
AzureIoTClient 40:1a94db9139ea 112 const char* iotHubSuffix;
AzureIoTClient 16:deba40344375 113
AzureIoTClient 40:1a94db9139ea 114 const char* protocolGatewayHostName;
AzureIoTClient 40:1a94db9139ea 115 } IOTHUB_CLIENT_CONFIG;
AzureIoTClient 16:deba40344375 116
AzureIoTClient 40:1a94db9139ea 117 /** @brief This struct captures IoTHub client device configuration. */
AzureIoTClient 40:1a94db9139ea 118 typedef struct IOTHUB_CLIENT_DEVICE_CONFIG_TAG
AzureIoTClient 40:1a94db9139ea 119 {
AzureIoTClient 40:1a94db9139ea 120 /** @brief A function pointer that is passed into the @c IoTHubClientCreate.
AzureIoTClient 40:1a94db9139ea 121 * A function definition for AMQP is defined in the include @c iothubtransportamqp.h.
AzureIoTClient 40:1a94db9139ea 122 * A function definition for HTTP is defined in the include @c iothubtransporthttp.h
AzureIoTClient 40:1a94db9139ea 123 * A function definition for MQTT is defined in the include @c iothubtransportmqtt.h */
AzureIoTClient 40:1a94db9139ea 124 IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol;
Azure.IoT Build 36:67300d5a4c1f 125
AzureIoTClient 40:1a94db9139ea 126 /** @brief a transport handle implementing the protocol */
AzureIoTClient 40:1a94db9139ea 127 void * transportHandle;
Azure.IoT Build 36:67300d5a4c1f 128
AzureIoTClient 40:1a94db9139ea 129 /** @brief A string that identifies the device. */
AzureIoTClient 40:1a94db9139ea 130 const char* deviceId;
Azure.IoT Build 36:67300d5a4c1f 131
AzureIoTClient 40:1a94db9139ea 132 /** @brief The device key used to authenticate the device. */
AzureIoTClient 40:1a94db9139ea 133 const char* deviceKey;
Azure.IoT Build 36:67300d5a4c1f 134
AzureIoTClient 40:1a94db9139ea 135 /** @brief The device SAS Token used to authenticate the device in place of device key. */
AzureIoTClient 40:1a94db9139ea 136 const char* deviceSasToken;
AzureIoTClient 40:1a94db9139ea 137 } IOTHUB_CLIENT_DEVICE_CONFIG;
Azure.IoT Build 36:67300d5a4c1f 138
AzureIoTClient 40:1a94db9139ea 139 /** @brief This struct captures IoTHub transport configuration. */
AzureIoTClient 40:1a94db9139ea 140 typedef struct IOTHUBTRANSPORT_CONFIG_TAG
AzureIoTClient 40:1a94db9139ea 141 {
AzureIoTClient 40:1a94db9139ea 142 const IOTHUB_CLIENT_CONFIG* upperConfig;
AzureIoTClient 40:1a94db9139ea 143 PDLIST_ENTRY waitingToSend;
AzureIoTClient 40:1a94db9139ea 144 }IOTHUBTRANSPORT_CONFIG;
Azure.IoT Build 37:18310e4d888d 145
Azure.IoT Build 37:18310e4d888d 146
AzureIoTClient 40:1a94db9139ea 147 /**
AzureIoTClient 40:1a94db9139ea 148 * @brief Creates a IoT Hub client for communication with an existing
AzureIoTClient 40:1a94db9139ea 149 * IoT Hub using the specified connection string parameter.
AzureIoTClient 40:1a94db9139ea 150 *
AzureIoTClient 40:1a94db9139ea 151 * @param connectionString Pointer to a character string
AzureIoTClient 40:1a94db9139ea 152 * @param protocol Function pointer for protocol implementation
AzureIoTClient 40:1a94db9139ea 153 *
AzureIoTClient 40:1a94db9139ea 154 * Sample connection string:
AzureIoTClient 40:1a94db9139ea 155 * <blockquote>
AzureIoTClient 40:1a94db9139ea 156 * <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 40:1a94db9139ea 157 * </blockquote>
AzureIoTClient 40:1a94db9139ea 158 *
AzureIoTClient 40:1a94db9139ea 159 * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 40:1a94db9139ea 160 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 40:1a94db9139ea 161 */
AzureIoTClient 40:1a94db9139ea 162 extern IOTHUB_CLIENT_LL_HANDLE IoTHubClient_LL_CreateFromConnectionString(const char* connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol);
AzureIoTClient 16:deba40344375 163
AzureIoTClient 40:1a94db9139ea 164 /**
AzureIoTClient 40:1a94db9139ea 165 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 40:1a94db9139ea 166 * Hub using the specified parameters.
AzureIoTClient 40:1a94db9139ea 167 *
AzureIoTClient 40:1a94db9139ea 168 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 40:1a94db9139ea 169 *
AzureIoTClient 40:1a94db9139ea 170 * The API does not allow sharing of a connection across multiple
AzureIoTClient 40:1a94db9139ea 171 * devices. This is a blocking call.
AzureIoTClient 40:1a94db9139ea 172 *
AzureIoTClient 40:1a94db9139ea 173 * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 40:1a94db9139ea 174 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 40:1a94db9139ea 175 */
AzureIoTClient 40:1a94db9139ea 176 extern IOTHUB_CLIENT_LL_HANDLE IoTHubClient_LL_Create(const IOTHUB_CLIENT_CONFIG* config);
AzureIoTClient 16:deba40344375 177
AzureIoTClient 40:1a94db9139ea 178 /**
AzureIoTClient 40:1a94db9139ea 179 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 40:1a94db9139ea 180 * Hub using an existing transport.
AzureIoTClient 40:1a94db9139ea 181 *
AzureIoTClient 40:1a94db9139ea 182 * @param config Pointer to an @c IOTHUB_CLIENT_DEVICE_CONFIG structure
AzureIoTClient 40:1a94db9139ea 183 *
AzureIoTClient 40:1a94db9139ea 184 * The API *allows* sharing of a connection across multiple
AzureIoTClient 40:1a94db9139ea 185 * devices. This is a blocking call.
AzureIoTClient 40:1a94db9139ea 186 *
AzureIoTClient 40:1a94db9139ea 187 * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 40:1a94db9139ea 188 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 40:1a94db9139ea 189 */
AzureIoTClient 40:1a94db9139ea 190 extern IOTHUB_CLIENT_LL_HANDLE IoTHubClient_LL_CreateWithTransport(const IOTHUB_CLIENT_DEVICE_CONFIG * config);
Azure.IoT Build 36:67300d5a4c1f 191
AzureIoTClient 40:1a94db9139ea 192 /**
AzureIoTClient 40:1a94db9139ea 193 * @brief Disposes of resources allocated by the IoT Hub client. This is a
AzureIoTClient 40:1a94db9139ea 194 * blocking call.
AzureIoTClient 40:1a94db9139ea 195 *
AzureIoTClient 40:1a94db9139ea 196 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 197 */
AzureIoTClient 40:1a94db9139ea 198 extern void IoTHubClient_LL_Destroy(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle);
AzureIoTClient 16:deba40344375 199
AzureIoTClient 40:1a94db9139ea 200 /**
AzureIoTClient 40:1a94db9139ea 201 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
AzureIoTClient 40:1a94db9139ea 202 *
AzureIoTClient 40:1a94db9139ea 203 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 204 * @param eventMessageHandle The handle to an IoT Hub message.
AzureIoTClient 40:1a94db9139ea 205 * @param eventConfirmationCallback The callback specified by the device for receiving
AzureIoTClient 40:1a94db9139ea 206 * confirmation of the delivery of the IoT Hub message.
AzureIoTClient 40:1a94db9139ea 207 * This callback can be expected to invoke the
AzureIoTClient 40:1a94db9139ea 208 * ::IoTHubClient_LL_SendEventAsync function for the
AzureIoTClient 40:1a94db9139ea 209 * same message in an attempt to retry sending a failing
AzureIoTClient 40:1a94db9139ea 210 * message. The user can specify a @c NULL value here to
AzureIoTClient 40:1a94db9139ea 211 * indicate that no callback is required.
AzureIoTClient 40:1a94db9139ea 212 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 40:1a94db9139ea 213 * callback. This can be @c NULL.
AzureIoTClient 40:1a94db9139ea 214 *
AzureIoTClient 40:1a94db9139ea 215 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 40:1a94db9139ea 216 * the ::IoTHubClient_LL_Destroy function from within any callback.
AzureIoTClient 40:1a94db9139ea 217 *
AzureIoTClient 40:1a94db9139ea 218 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 40:1a94db9139ea 219 */
AzureIoTClient 40:1a94db9139ea 220 extern 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 221
AzureIoTClient 40:1a94db9139ea 222 /**
AzureIoTClient 40:1a94db9139ea 223 * @brief This function returns the current sending status for IoTHubClient.
AzureIoTClient 40:1a94db9139ea 224 *
AzureIoTClient 40:1a94db9139ea 225 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 226 * @param iotHubClientStatus The sending state is populated at the address pointed
AzureIoTClient 40:1a94db9139ea 227 * at by this parameter. The value will be set to
AzureIoTClient 40:1a94db9139ea 228 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
AzureIoTClient 40:1a94db9139ea 229 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
AzureIoTClient 40:1a94db9139ea 230 * if there are.
AzureIoTClient 40:1a94db9139ea 231 *
AzureIoTClient 40:1a94db9139ea 232 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 40:1a94db9139ea 233 */
AzureIoTClient 40:1a94db9139ea 234 extern IOTHUB_CLIENT_RESULT IoTHubClient_LL_GetSendStatus(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, IOTHUB_CLIENT_STATUS *iotHubClientStatus);
AzureIoTClient 16:deba40344375 235
AzureIoTClient 40:1a94db9139ea 236 /**
AzureIoTClient 40:1a94db9139ea 237 * @brief Sets up the message callback to be invoked when IoT Hub issues a
AzureIoTClient 40:1a94db9139ea 238 * message to the device. This is a blocking call.
AzureIoTClient 40:1a94db9139ea 239 *
AzureIoTClient 40:1a94db9139ea 240 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 241 * @param messageCallback The callback specified by the device for receiving
AzureIoTClient 40:1a94db9139ea 242 * messages from IoT Hub.
AzureIoTClient 40:1a94db9139ea 243 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 40:1a94db9139ea 244 * callback. This can be @c NULL.
AzureIoTClient 40:1a94db9139ea 245 *
AzureIoTClient 40:1a94db9139ea 246 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 40:1a94db9139ea 247 * the ::IoTHubClient_LL_Destroy function from within any callback.
AzureIoTClient 40:1a94db9139ea 248 *
AzureIoTClient 40:1a94db9139ea 249 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 40:1a94db9139ea 250 */
AzureIoTClient 40:1a94db9139ea 251 extern IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetMessageCallback(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC messageCallback, void* userContextCallback);
AzureIoTClient 16:deba40344375 252
AzureIoTClient 40:1a94db9139ea 253 /**
AzureIoTClient 40:1a94db9139ea 254 * @brief This function returns in the out parameter @p lastMessageReceiveTime
AzureIoTClient 40:1a94db9139ea 255 * what was the value of the @c time function when the last message was
AzureIoTClient 40:1a94db9139ea 256 * received at the client.
AzureIoTClient 40:1a94db9139ea 257 *
AzureIoTClient 40:1a94db9139ea 258 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 259 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
AzureIoTClient 40:1a94db9139ea 260 * when the last message was received.
AzureIoTClient 40:1a94db9139ea 261 *
AzureIoTClient 40:1a94db9139ea 262 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 40:1a94db9139ea 263 */
AzureIoTClient 40:1a94db9139ea 264 extern IOTHUB_CLIENT_RESULT IoTHubClient_LL_GetLastMessageReceiveTime(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, time_t* lastMessageReceiveTime);
AzureIoTClient 16:deba40344375 265
AzureIoTClient 40:1a94db9139ea 266 /**
AzureIoTClient 40:1a94db9139ea 267 * @brief This function is meant to be called by the user when work
AzureIoTClient 40:1a94db9139ea 268 * (sending/receiving) can be done by the IoTHubClient.
AzureIoTClient 40:1a94db9139ea 269 *
AzureIoTClient 40:1a94db9139ea 270 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 271 *
AzureIoTClient 40:1a94db9139ea 272 * All IoTHubClient interactions (in regards to network traffic
AzureIoTClient 40:1a94db9139ea 273 * and/or user level callbacks) are the effect of calling this
AzureIoTClient 40:1a94db9139ea 274 * function and they take place synchronously inside _DoWork.
AzureIoTClient 40:1a94db9139ea 275 */
AzureIoTClient 40:1a94db9139ea 276 extern void IoTHubClient_LL_DoWork(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle);
AzureIoTClient 16:deba40344375 277
AzureIoTClient 40:1a94db9139ea 278 /**
AzureIoTClient 40:1a94db9139ea 279 * @brief This API sets a runtime option identified by parameter @p optionName
AzureIoTClient 40:1a94db9139ea 280 * to a value pointed to by @p value. @p optionName and the data type
AzureIoTClient 40:1a94db9139ea 281 * @p value is pointing to are specific for every option.
AzureIoTClient 40:1a94db9139ea 282 *
AzureIoTClient 40:1a94db9139ea 283 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 40:1a94db9139ea 284 * @param optionName Name of the option.
AzureIoTClient 40:1a94db9139ea 285 * @param value The value.
AzureIoTClient 40:1a94db9139ea 286 *
AzureIoTClient 40:1a94db9139ea 287 * The options that can be set via this API are:
AzureIoTClient 40:1a94db9139ea 288 * - @b timeout - the maximum time in milliseconds a communication is
AzureIoTClient 40:1a94db9139ea 289 * allowed to use. @p value is a pointer to an @c unsigned @c int with
AzureIoTClient 40:1a94db9139ea 290 * the timeout value in milliseconds. This is only supported for the HTTP
AzureIoTClient 40:1a94db9139ea 291 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
AzureIoTClient 40:1a94db9139ea 292 * the parameter is <em>total request time</em>. When the HTTP protocol uses
AzureIoTClient 40:1a94db9139ea 293 * winhttp, the meaning is the same as the @c dwSendTimeout and
AzureIoTClient 40:1a94db9139ea 294 * @c dwReceiveTimeout parameters of the
AzureIoTClient 40:1a94db9139ea 295 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
AzureIoTClient 40:1a94db9139ea 296 * WinHttpSetTimeouts</a> API.
AzureIoTClient 40:1a94db9139ea 297 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
AzureIoTClient 40:1a94db9139ea 298 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 40:1a94db9139ea 299 * name. @p value is pointer to a long.
AzureIoTClient 40:1a94db9139ea 300 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
AzureIoTClient 40:1a94db9139ea 301 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 40:1a94db9139ea 302 * name. @p value is pointer to a long.
AzureIoTClient 40:1a94db9139ea 303 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
AzureIoTClient 40:1a94db9139ea 304 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 40:1a94db9139ea 305 * name. @p value is pointer to a long.
AzureIoTClient 40:1a94db9139ea 306 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
AzureIoTClient 40:1a94db9139ea 307 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 40:1a94db9139ea 308 * name. @p value is pointer to a long.
AzureIoTClient 40:1a94db9139ea 309 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
AzureIoTClient 40:1a94db9139ea 310 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 40:1a94db9139ea 311 * name. @p value is pointer to a long.
AzureIoTClient 40:1a94db9139ea 312 * - @b keepalive - available for MQTT protocol. Integer value that sets the
AzureIoTClient 40:1a94db9139ea 313 * interval in seconds when pings are sent to the server.
AzureIoTClient 40:1a94db9139ea 314 * - @b logtrace - available for MQTT protocol. Boolean value that turns on and
AzureIoTClient 40:1a94db9139ea 315 * off the diagnostic logging.
AzureIoTClient 40:1a94db9139ea 316 *
AzureIoTClient 40:1a94db9139ea 317 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 40:1a94db9139ea 318 */
AzureIoTClient 40:1a94db9139ea 319 extern IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetOption(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* optionName, const void* value);
AzureIoTClient 16:deba40344375 320
AzureIoTClient 42:448eecc3676e 321 extern IOTHUB_CLIENT_RESULT IoTHubClient_LL_UploadToBlob(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* destinationFileName, const unsigned char* source, size_t size);
AzureIoTClient 42:448eecc3676e 322
AzureIoTClient 16:deba40344375 323 #ifdef __cplusplus
AzureIoTClient 16:deba40344375 324 }
AzureIoTClient 16:deba40344375 325 #endif
AzureIoTClient 16:deba40344375 326
AzureIoTClient 16:deba40344375 327 #endif /* IOTHUB_CLIENT_LL_H */