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:
Thu Oct 22 18:32:36 2015 -0700
Revision:
16:deba40344375
Child:
22:b8732db970af
v1.0.0-preview.4

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