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 Sep 22 20:36:48 2015 -0700
Revision:
9:3ec7e2695f98
Parent:
0:e393db310d89
Child:
10:38383e246675
New release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzureIoTClient 0:e393db310d89 1 // Copyright (c) Microsoft. All rights reserved.
AzureIoTClient 0:e393db310d89 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
AzureIoTClient 0:e393db310d89 3
AzureIoTClient 9:3ec7e2695f98 4 /** @file iothub_client.h
AzureIoTClient 9:3ec7e2695f98 5 * @brief Extends the IoTHubCLient_LL module with additional features.
AzureIoTClient 9:3ec7e2695f98 6 *
AzureIoTClient 9:3ec7e2695f98 7 * @details IoTHubClient is a module that extends the IoTHubCLient_LL
AzureIoTClient 9:3ec7e2695f98 8 * module with 2 features:
AzureIoTClient 9:3ec7e2695f98 9 * - scheduling the work for the IoTHubCLient from a
AzureIoTClient 9:3ec7e2695f98 10 * thread, so that the user does not need to create their
AzureIoTClient 9:3ec7e2695f98 11 * own thread
AzureIoTClient 9:3ec7e2695f98 12 * - thread-safe APIs
AzureIoTClient 9:3ec7e2695f98 13 */
AzureIoTClient 9:3ec7e2695f98 14
AzureIoTClient 0:e393db310d89 15 #ifndef IOTHUB_CLIENT_H
AzureIoTClient 0:e393db310d89 16
AzureIoTClient 0:e393db310d89 17 #include "iothub_client_ll.h"
AzureIoTClient 0:e393db310d89 18
AzureIoTClient 0:e393db310d89 19 #ifdef __cplusplus
AzureIoTClient 0:e393db310d89 20 extern "C"
AzureIoTClient 0:e393db310d89 21 {
AzureIoTClient 0:e393db310d89 22 #endif
AzureIoTClient 0:e393db310d89 23
AzureIoTClient 0:e393db310d89 24 typedef void* IOTHUB_CLIENT_HANDLE;
AzureIoTClient 0:e393db310d89 25
AzureIoTClient 9:3ec7e2695f98 26 /**
AzureIoTClient 9:3ec7e2695f98 27 * @brief Creates a IoT Hub client for communication with an existing
AzureIoTClient 9:3ec7e2695f98 28 * IoT Hub using the specified connection string parameter.
AzureIoTClient 9:3ec7e2695f98 29 *
AzureIoTClient 9:3ec7e2695f98 30 * @param connectionString Pointer to a character string
AzureIoTClient 9:3ec7e2695f98 31 * @param protocol Function pointer for protocol implementation
AzureIoTClient 9:3ec7e2695f98 32 *
AzureIoTClient 9:3ec7e2695f98 33 * Sample connection string:
AzureIoTClient 9:3ec7e2695f98 34 * <blockquote>
AzureIoTClient 9:3ec7e2695f98 35 * <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 9:3ec7e2695f98 36 * </blockquote>
AzureIoTClient 9:3ec7e2695f98 37 *
AzureIoTClient 9:3ec7e2695f98 38 * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 9:3ec7e2695f98 39 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 9:3ec7e2695f98 40 */
AzureIoTClient 0:e393db310d89 41 extern IOTHUB_CLIENT_HANDLE IoTHubClient_CreateFromConnectionString(const char* connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol);
AzureIoTClient 9:3ec7e2695f98 42
AzureIoTClient 9:3ec7e2695f98 43 /**
AzureIoTClient 9:3ec7e2695f98 44 * @brief Creates a IoT Hub client for communication with an existing IoT
AzureIoTClient 9:3ec7e2695f98 45 * Hub using the specified parameters.
AzureIoTClient 9:3ec7e2695f98 46 *
AzureIoTClient 9:3ec7e2695f98 47 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
AzureIoTClient 9:3ec7e2695f98 48 *
AzureIoTClient 9:3ec7e2695f98 49 * The API does not allow sharing of a connection across multiple
AzureIoTClient 9:3ec7e2695f98 50 * devices. This is a blocking call.
AzureIoTClient 9:3ec7e2695f98 51 *
AzureIoTClient 9:3ec7e2695f98 52 * @return A non-NULL @c IOTHUB_CLIENT_LL_HANDLE value that is used when
AzureIoTClient 9:3ec7e2695f98 53 * invoking other functions for IoT Hub client and @c NULL on failure.
AzureIoTClient 9:3ec7e2695f98 54 */
AzureIoTClient 0:e393db310d89 55 extern IOTHUB_CLIENT_HANDLE IoTHubClient_Create(const IOTHUB_CLIENT_CONFIG* config);
AzureIoTClient 9:3ec7e2695f98 56
AzureIoTClient 9:3ec7e2695f98 57 /**
AzureIoTClient 9:3ec7e2695f98 58 * @brief Disposes of resources allocated by the IoT Hub client. This is a
AzureIoTClient 9:3ec7e2695f98 59 * blocking call.
AzureIoTClient 9:3ec7e2695f98 60 *
AzureIoTClient 9:3ec7e2695f98 61 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 62 */
AzureIoTClient 0:e393db310d89 63 extern void IoTHubClient_Destroy(IOTHUB_CLIENT_HANDLE iotHubClientHandle);
AzureIoTClient 0:e393db310d89 64
AzureIoTClient 9:3ec7e2695f98 65 /**
AzureIoTClient 9:3ec7e2695f98 66 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
AzureIoTClient 9:3ec7e2695f98 67 *
AzureIoTClient 9:3ec7e2695f98 68 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 69 * @param eventMessageHandle The handle to an IoT Hub message.
AzureIoTClient 9:3ec7e2695f98 70 * @param eventConfirmationCallback The callback specified by the device for receiving
AzureIoTClient 9:3ec7e2695f98 71 * confirmation of the delivery of the IoT Hub message.
AzureIoTClient 9:3ec7e2695f98 72 * This callback can be expected to invoke the
AzureIoTClient 9:3ec7e2695f98 73 * ::IoTHubClient_LL_SendEventAsync function for the
AzureIoTClient 9:3ec7e2695f98 74 * same message in an attempt to retry sending a failing
AzureIoTClient 9:3ec7e2695f98 75 * message. The user can specify a @c NULL value here to
AzureIoTClient 9:3ec7e2695f98 76 * indicate that no callback is required.
AzureIoTClient 9:3ec7e2695f98 77 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 9:3ec7e2695f98 78 * callback. This can be @c NULL.
AzureIoTClient 9:3ec7e2695f98 79 *
AzureIoTClient 9:3ec7e2695f98 80 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 9:3ec7e2695f98 81 * the ::IoTHubClient_LL_Destroy function from within any callback.
AzureIoTClient 9:3ec7e2695f98 82 *
AzureIoTClient 9:3ec7e2695f98 83 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 9:3ec7e2695f98 84 */
AzureIoTClient 0:e393db310d89 85 extern IOTHUB_CLIENT_RESULT IoTHubClient_SendEventAsync(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_MESSAGE_HANDLE eventMessageHandle, IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK eventConfirmationCallback, void* userContextCallback);
AzureIoTClient 9:3ec7e2695f98 86
AzureIoTClient 9:3ec7e2695f98 87 /**
AzureIoTClient 9:3ec7e2695f98 88 * @brief This function returns the current sending status for IoTHubClient.
AzureIoTClient 9:3ec7e2695f98 89 *
AzureIoTClient 9:3ec7e2695f98 90 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 91 * @param iotHubClientStatus The sending state is populated at the address pointed
AzureIoTClient 9:3ec7e2695f98 92 * at by this parameter. The value will be set to
AzureIoTClient 9:3ec7e2695f98 93 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
AzureIoTClient 9:3ec7e2695f98 94 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
AzureIoTClient 9:3ec7e2695f98 95 * if there are.
AzureIoTClient 9:3ec7e2695f98 96 *
AzureIoTClient 9:3ec7e2695f98 97 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 9:3ec7e2695f98 98 */
AzureIoTClient 0:e393db310d89 99 extern IOTHUB_CLIENT_RESULT IoTHubClient_GetSendStatus(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, IOTHUB_CLIENT_STATUS *iotHubClientStatus);
AzureIoTClient 9:3ec7e2695f98 100
AzureIoTClient 9:3ec7e2695f98 101 /**
AzureIoTClient 9:3ec7e2695f98 102 * @brief Sets up the message callback to be invoked when IoT Hub issues a
AzureIoTClient 9:3ec7e2695f98 103 * message to the device. This is a blocking call.
AzureIoTClient 9:3ec7e2695f98 104 *
AzureIoTClient 9:3ec7e2695f98 105 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 106 * @param messageCallback The callback specified by the device for receiving
AzureIoTClient 9:3ec7e2695f98 107 * messages from IoT Hub.
AzureIoTClient 9:3ec7e2695f98 108 * @param userContextCallback User specified context that will be provided to the
AzureIoTClient 9:3ec7e2695f98 109 * callback. This can be @c NULL.
AzureIoTClient 9:3ec7e2695f98 110 *
AzureIoTClient 9:3ec7e2695f98 111 * @b NOTE: The application behavior is undefined if the user calls
AzureIoTClient 9:3ec7e2695f98 112 * the ::IoTHubClient_LL_Destroy function from within any callback.
AzureIoTClient 9:3ec7e2695f98 113 *
AzureIoTClient 9:3ec7e2695f98 114 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 9:3ec7e2695f98 115 */
AzureIoTClient 9:3ec7e2695f98 116 extern IOTHUB_CLIENT_RESULT IoTHubClient_SetMessageCallback(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC messageCallback, void* userContextCallback);
AzureIoTClient 9:3ec7e2695f98 117
AzureIoTClient 9:3ec7e2695f98 118 /**
AzureIoTClient 9:3ec7e2695f98 119 * @brief This function returns in the out parameter @p lastMessageReceiveTime
AzureIoTClient 9:3ec7e2695f98 120 * what was the value of the @c time function when the last message was
AzureIoTClient 9:3ec7e2695f98 121 * received at the client.
AzureIoTClient 9:3ec7e2695f98 122 *
AzureIoTClient 9:3ec7e2695f98 123 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 124 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
AzureIoTClient 9:3ec7e2695f98 125 * when the last message was received.
AzureIoTClient 9:3ec7e2695f98 126 *
AzureIoTClient 9:3ec7e2695f98 127 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 9:3ec7e2695f98 128 */
AzureIoTClient 9:3ec7e2695f98 129 extern IOTHUB_CLIENT_RESULT IoTHubClient_GetLastMessageReceiveTime(IOTHUB_CLIENT_HANDLE iotHubClientHandle, time_t* lastMessageReceiveTime);
AzureIoTClient 9:3ec7e2695f98 130
AzureIoTClient 9:3ec7e2695f98 131 /**
AzureIoTClient 9:3ec7e2695f98 132 * @brief This API sets a runtime option identified by parameter @p optionName
AzureIoTClient 9:3ec7e2695f98 133 * to a value pointed to by @p value. @p optionName and the data type
AzureIoTClient 9:3ec7e2695f98 134 * @p value is pointing to are specific for every option.
AzureIoTClient 9:3ec7e2695f98 135 *
AzureIoTClient 9:3ec7e2695f98 136 * @param iotHubClientHandle The handle created by a call to the create function.
AzureIoTClient 9:3ec7e2695f98 137 * @param optionName Name of the option.
AzureIoTClient 9:3ec7e2695f98 138 * @param value The value.
AzureIoTClient 9:3ec7e2695f98 139 *
AzureIoTClient 9:3ec7e2695f98 140 * The options that can be set via this API are:
AzureIoTClient 9:3ec7e2695f98 141 * - @b timeout - the maximum time in milliseconds a communication is
AzureIoTClient 9:3ec7e2695f98 142 * allowed to use. @p value is a pointer to an @c unsigned @c int with
AzureIoTClient 9:3ec7e2695f98 143 * the timeout value in milliseconds. This is only supported for the HTTP
AzureIoTClient 9:3ec7e2695f98 144 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
AzureIoTClient 9:3ec7e2695f98 145 * the parameter is <em>total request time</em>. When the HTTP protocol uses
AzureIoTClient 9:3ec7e2695f98 146 * winhttp, the meaning is the same as the @c dwSendTimeout and
AzureIoTClient 9:3ec7e2695f98 147 * @c dwReceiveTimeout parameters of the
AzureIoTClient 9:3ec7e2695f98 148 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
AzureIoTClient 9:3ec7e2695f98 149 * WinHttpSetTimeouts</a> API.
AzureIoTClient 9:3ec7e2695f98 150 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
AzureIoTClient 9:3ec7e2695f98 151 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 9:3ec7e2695f98 152 * name. @p value is pointer to a long.
AzureIoTClient 9:3ec7e2695f98 153 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
AzureIoTClient 9:3ec7e2695f98 154 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 9:3ec7e2695f98 155 * name. @p value is pointer to a long.
AzureIoTClient 9:3ec7e2695f98 156 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
AzureIoTClient 9:3ec7e2695f98 157 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 9:3ec7e2695f98 158 * name. @p value is pointer to a long.
AzureIoTClient 9:3ec7e2695f98 159 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
AzureIoTClient 9:3ec7e2695f98 160 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 9:3ec7e2695f98 161 * name. @p value is pointer to a long.
AzureIoTClient 9:3ec7e2695f98 162 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
AzureIoTClient 9:3ec7e2695f98 163 * when CURL is used. It has the same meaning as CURL's option with the same
AzureIoTClient 9:3ec7e2695f98 164 * name. @p value is pointer to a long.
AzureIoTClient 9:3ec7e2695f98 165 *
AzureIoTClient 9:3ec7e2695f98 166 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
AzureIoTClient 9:3ec7e2695f98 167 */
AzureIoTClient 0:e393db310d89 168 extern IOTHUB_CLIENT_RESULT IoTHubClient_SetOption(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const char* optionName, const void* value);
AzureIoTClient 0:e393db310d89 169
AzureIoTClient 0:e393db310d89 170 #ifdef __cplusplus
AzureIoTClient 0:e393db310d89 171 }
AzureIoTClient 0:e393db310d89 172 #endif
AzureIoTClient 0:e393db310d89 173
AzureIoTClient 0:e393db310d89 174 #endif /* IOTHUB_CLIENT_H */