WIP. send a large constant string twice a second, in order to test out the transport with something indicative of our required load.

Dependencies:   FXOS8700CQ NTPClient azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Fork of FXOS8700CQ_To_Azure_IoT by Mark Radbourne

Committer:
julianhigginson
Date:
Thu Jan 05 23:40:24 2017 +0000
Revision:
7:0d1a0fe537dc
Parent:
3:c0556ff7b8e3
modified dummy message for minimal data transport

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 3:c0556ff7b8e3 1 // Copyright (c) Microsoft. All rights reserved.
markrad 3:c0556ff7b8e3 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
markrad 3:c0556ff7b8e3 3
markrad 3:c0556ff7b8e3 4 /** @file iothub_client.h
markrad 3:c0556ff7b8e3 5 * @brief Extends the IoTHubCLient_LL module with additional features.
markrad 3:c0556ff7b8e3 6 *
markrad 3:c0556ff7b8e3 7 * @details IoTHubClient is a module that extends the IoTHubCLient_LL
markrad 3:c0556ff7b8e3 8 * module with 2 features:
markrad 3:c0556ff7b8e3 9 * - scheduling the work for the IoTHubCLient from a
markrad 3:c0556ff7b8e3 10 * thread, so that the user does not need to create their
markrad 3:c0556ff7b8e3 11 * own thread
markrad 3:c0556ff7b8e3 12 * - thread-safe APIs
markrad 3:c0556ff7b8e3 13 */
markrad 3:c0556ff7b8e3 14
markrad 3:c0556ff7b8e3 15 #ifndef IOTHUB_CLIENT_H
markrad 3:c0556ff7b8e3 16 #define IOTHUB_CLIENT_H
markrad 3:c0556ff7b8e3 17
markrad 3:c0556ff7b8e3 18 typedef struct IOTHUB_CLIENT_INSTANCE_TAG* IOTHUB_CLIENT_HANDLE;
markrad 3:c0556ff7b8e3 19
markrad 3:c0556ff7b8e3 20
markrad 3:c0556ff7b8e3 21 #include "iothubtransport.h"
markrad 3:c0556ff7b8e3 22 #include <stddef.h>
markrad 3:c0556ff7b8e3 23 #include <stdint.h>
markrad 3:c0556ff7b8e3 24
markrad 3:c0556ff7b8e3 25 #include "iothub_client_ll.h"
markrad 3:c0556ff7b8e3 26 #include "azure_c_shared_utility/umock_c_prod.h"
markrad 3:c0556ff7b8e3 27
markrad 3:c0556ff7b8e3 28 #ifdef __cplusplus
markrad 3:c0556ff7b8e3 29 extern "C"
markrad 3:c0556ff7b8e3 30 {
markrad 3:c0556ff7b8e3 31 #endif
markrad 3:c0556ff7b8e3 32
markrad 3:c0556ff7b8e3 33 #define IOTHUB_CLIENT_FILE_UPLOAD_RESULT_VALUES \
markrad 3:c0556ff7b8e3 34 FILE_UPLOAD_OK ,\
markrad 3:c0556ff7b8e3 35 FILE_UPLOAD_ERROR
markrad 3:c0556ff7b8e3 36
markrad 3:c0556ff7b8e3 37 DEFINE_ENUM(IOTHUB_CLIENT_FILE_UPLOAD_RESULT, IOTHUB_CLIENT_FILE_UPLOAD_RESULT_VALUES)
markrad 3:c0556ff7b8e3 38 typedef void(*IOTHUB_CLIENT_FILE_UPLOAD_CALLBACK)(IOTHUB_CLIENT_FILE_UPLOAD_RESULT result, void* userContextCallback);
markrad 3:c0556ff7b8e3 39
markrad 3:c0556ff7b8e3 40 /**
markrad 3:c0556ff7b8e3 41 * @brief Creates a IoT Hub client for communication with an existing
markrad 3:c0556ff7b8e3 42 * IoT Hub using the specified connection string parameter.
markrad 3:c0556ff7b8e3 43 *
markrad 3:c0556ff7b8e3 44 * @param connectionString Pointer to a character string
markrad 3:c0556ff7b8e3 45 * @param protocol Function pointer for protocol implementation
markrad 3:c0556ff7b8e3 46 *
markrad 3:c0556ff7b8e3 47 * Sample connection string:
markrad 3:c0556ff7b8e3 48 * <blockquote>
markrad 3:c0556ff7b8e3 49 * <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>
markrad 3:c0556ff7b8e3 50 * <pre>HostName=[IoT Hub name goes here].[IoT Hub suffix goes here, e.g., private.azure-devices-int.net];DeviceId=[Device ID goes here];SharedAccessSignature=SharedAccessSignature sr=[IoT Hub name goes here].[IoT Hub suffix goes here, e.g., private.azure-devices-int.net]/devices/[Device ID goes here]&sig=[SAS Token goes here]&se=[Expiry Time goes here];</pre>
markrad 3:c0556ff7b8e3 51 * </blockquote>
markrad 3:c0556ff7b8e3 52 *
markrad 3:c0556ff7b8e3 53 * @return A non-NULL @c IOTHUB_CLIENT_HANDLE value that is used when
markrad 3:c0556ff7b8e3 54 * invoking other functions for IoT Hub client and @c NULL on failure.
markrad 3:c0556ff7b8e3 55 */
markrad 3:c0556ff7b8e3 56 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_HANDLE, IoTHubClient_CreateFromConnectionString, const char*, connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER, protocol);
markrad 3:c0556ff7b8e3 57
markrad 3:c0556ff7b8e3 58 /**
markrad 3:c0556ff7b8e3 59 * @brief Creates a IoT Hub client for communication with an existing IoT
markrad 3:c0556ff7b8e3 60 * Hub using the specified parameters.
markrad 3:c0556ff7b8e3 61 *
markrad 3:c0556ff7b8e3 62 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
markrad 3:c0556ff7b8e3 63 *
markrad 3:c0556ff7b8e3 64 * The API does not allow sharing of a connection across multiple
markrad 3:c0556ff7b8e3 65 * devices. This is a blocking call.
markrad 3:c0556ff7b8e3 66 *
markrad 3:c0556ff7b8e3 67 * @return A non-NULL @c IOTHUB_CLIENT_HANDLE value that is used when
markrad 3:c0556ff7b8e3 68 * invoking other functions for IoT Hub client and @c NULL on failure.
markrad 3:c0556ff7b8e3 69 */
markrad 3:c0556ff7b8e3 70 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_HANDLE, IoTHubClient_Create, const IOTHUB_CLIENT_CONFIG*, config);
markrad 3:c0556ff7b8e3 71
markrad 3:c0556ff7b8e3 72 /**
markrad 3:c0556ff7b8e3 73 * @brief Creates a IoT Hub client for communication with an existing IoT
markrad 3:c0556ff7b8e3 74 * Hub using the specified parameters.
markrad 3:c0556ff7b8e3 75 *
markrad 3:c0556ff7b8e3 76 * @param transportHandle TRANSPORT_HANDLE which represents a connection.
markrad 3:c0556ff7b8e3 77 * @param config Pointer to an @c IOTHUB_CLIENT_CONFIG structure
markrad 3:c0556ff7b8e3 78 *
markrad 3:c0556ff7b8e3 79 * The API allows sharing of a connection across multiple
markrad 3:c0556ff7b8e3 80 * devices. This is a blocking call.
markrad 3:c0556ff7b8e3 81 *
markrad 3:c0556ff7b8e3 82 * @return A non-NULL @c IOTHUB_CLIENT_HANDLE value that is used when
markrad 3:c0556ff7b8e3 83 * invoking other functions for IoT Hub client and @c NULL on failure.
markrad 3:c0556ff7b8e3 84 */
markrad 3:c0556ff7b8e3 85 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_HANDLE, IoTHubClient_CreateWithTransport, TRANSPORT_HANDLE, transportHandle, const IOTHUB_CLIENT_CONFIG*, config);
markrad 3:c0556ff7b8e3 86
markrad 3:c0556ff7b8e3 87 /**
markrad 3:c0556ff7b8e3 88 * @brief Disposes of resources allocated by the IoT Hub client. This is a
markrad 3:c0556ff7b8e3 89 * blocking call.
markrad 3:c0556ff7b8e3 90 *
markrad 3:c0556ff7b8e3 91 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 92 */
markrad 3:c0556ff7b8e3 93 MOCKABLE_FUNCTION(, void, IoTHubClient_Destroy, IOTHUB_CLIENT_HANDLE, iotHubClientHandle);
markrad 3:c0556ff7b8e3 94
markrad 3:c0556ff7b8e3 95 /**
markrad 3:c0556ff7b8e3 96 * @brief Asynchronous call to send the message specified by @p eventMessageHandle.
markrad 3:c0556ff7b8e3 97 *
markrad 3:c0556ff7b8e3 98 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 99 * @param eventMessageHandle The handle to an IoT Hub message.
markrad 3:c0556ff7b8e3 100 * @param eventConfirmationCallback The callback specified by the device for receiving
markrad 3:c0556ff7b8e3 101 * confirmation of the delivery of the IoT Hub message.
markrad 3:c0556ff7b8e3 102 * This callback can be expected to invoke the
markrad 3:c0556ff7b8e3 103 * ::IoTHubClient_SendEventAsync function for the
markrad 3:c0556ff7b8e3 104 * same message in an attempt to retry sending a failing
markrad 3:c0556ff7b8e3 105 * message. The user can specify a @c NULL value here to
markrad 3:c0556ff7b8e3 106 * indicate that no callback is required.
markrad 3:c0556ff7b8e3 107 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 108 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 109 *
markrad 3:c0556ff7b8e3 110 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 111 * the ::IoTHubClient_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 112 *
markrad 3:c0556ff7b8e3 113 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 114 */
markrad 3:c0556ff7b8e3 115 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SendEventAsync, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_MESSAGE_HANDLE, eventMessageHandle, IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK, eventConfirmationCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 116
markrad 3:c0556ff7b8e3 117 /**
markrad 3:c0556ff7b8e3 118 * @brief This function returns the current sending status for IoTHubClient.
markrad 3:c0556ff7b8e3 119 *
markrad 3:c0556ff7b8e3 120 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 121 * @param iotHubClientStatus The sending state is populated at the address pointed
markrad 3:c0556ff7b8e3 122 * at by this parameter. The value will be set to
markrad 3:c0556ff7b8e3 123 * @c IOTHUBCLIENT_SENDSTATUS_IDLE if there is currently
markrad 3:c0556ff7b8e3 124 * no item to be sent and @c IOTHUBCLIENT_SENDSTATUS_BUSY
markrad 3:c0556ff7b8e3 125 * if there are.
markrad 3:c0556ff7b8e3 126 *
markrad 3:c0556ff7b8e3 127 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 128 */
markrad 3:c0556ff7b8e3 129 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_GetSendStatus, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_STATUS*, iotHubClientStatus);
markrad 3:c0556ff7b8e3 130
markrad 3:c0556ff7b8e3 131 /**
markrad 3:c0556ff7b8e3 132 * @brief Sets up the message callback to be invoked when IoT Hub issues a
markrad 3:c0556ff7b8e3 133 * message to the device. This is a blocking call.
markrad 3:c0556ff7b8e3 134 *
markrad 3:c0556ff7b8e3 135 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 136 * @param messageCallback The callback specified by the device for receiving
markrad 3:c0556ff7b8e3 137 * messages from IoT Hub.
markrad 3:c0556ff7b8e3 138 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 139 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 140 *
markrad 3:c0556ff7b8e3 141 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 142 * the ::IoTHubClient_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 143 *
markrad 3:c0556ff7b8e3 144 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 145 */
markrad 3:c0556ff7b8e3 146 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetMessageCallback, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC, messageCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 147
markrad 3:c0556ff7b8e3 148 /**
markrad 3:c0556ff7b8e3 149 * @brief Sets up the connection status callback to be invoked representing the status of
markrad 3:c0556ff7b8e3 150 * the connection to IOT Hub. This is a blocking call.
markrad 3:c0556ff7b8e3 151 *
markrad 3:c0556ff7b8e3 152 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 153 * @param connectionStatusCallback The callback specified by the device for receiving
markrad 3:c0556ff7b8e3 154 * updates about the status of the connection to IoT Hub.
markrad 3:c0556ff7b8e3 155 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 156 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 157 *
markrad 3:c0556ff7b8e3 158 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 159 * the ::IoTHubClient_LL_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 160 *
markrad 3:c0556ff7b8e3 161 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 162 */
markrad 3:c0556ff7b8e3 163 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetConnectionStatusCallback, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK, connectionStatusCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 164
markrad 3:c0556ff7b8e3 165 /**
markrad 3:c0556ff7b8e3 166 * @brief Sets up the connection status callback to be invoked representing the status of
markrad 3:c0556ff7b8e3 167 * the connection to IOT Hub. This is a blocking call.
markrad 3:c0556ff7b8e3 168 *
markrad 3:c0556ff7b8e3 169 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 170 * @param retryPolicy The policy to use to reconnect to IoT Hub when a
markrad 3:c0556ff7b8e3 171 * connection drops.
markrad 3:c0556ff7b8e3 172 * @param retryTimeoutLimitInSeconds Maximum amount of time(seconds) to attempt reconnection when a
markrad 3:c0556ff7b8e3 173 * connection drops to IOT Hub.
markrad 3:c0556ff7b8e3 174 *
markrad 3:c0556ff7b8e3 175 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 176 * the ::IoTHubClient_LL_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 177 *
markrad 3:c0556ff7b8e3 178 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 179 */
markrad 3:c0556ff7b8e3 180 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetRetryPolicy, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY, retryPolicy, size_t, retryTimeoutLimitInSeconds);
markrad 3:c0556ff7b8e3 181
markrad 3:c0556ff7b8e3 182 /**
markrad 3:c0556ff7b8e3 183 * @brief Sets up the connection status callback to be invoked representing the status of
markrad 3:c0556ff7b8e3 184 * the connection to IOT Hub. This is a blocking call.
markrad 3:c0556ff7b8e3 185 *
markrad 3:c0556ff7b8e3 186 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 187 * @param retryPolicy Out parameter containing the policy to use to reconnect to IoT Hub.
markrad 3:c0556ff7b8e3 188 * @param retryTimeoutLimitInSeconds Out parameter containing maximum amount of time in seconds to attempt reconnection
markrad 3:c0556ff7b8e3 189 to IOT Hub.
markrad 3:c0556ff7b8e3 190 *
markrad 3:c0556ff7b8e3 191 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 192 * the ::IoTHubClient_LL_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 193 *
markrad 3:c0556ff7b8e3 194 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 195 */
markrad 3:c0556ff7b8e3 196 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_GetRetryPolicy, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY*, retryPolicy, size_t*, retryTimeoutLimitInSeconds);
markrad 3:c0556ff7b8e3 197
markrad 3:c0556ff7b8e3 198 /**
markrad 3:c0556ff7b8e3 199 * @brief This function returns in the out parameter @p lastMessageReceiveTime
markrad 3:c0556ff7b8e3 200 * what was the value of the @c time function when the last message was
markrad 3:c0556ff7b8e3 201 * received at the client.
markrad 3:c0556ff7b8e3 202 *
markrad 3:c0556ff7b8e3 203 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 204 * @param lastMessageReceiveTime Out parameter containing the value of @c time function
markrad 3:c0556ff7b8e3 205 * when the last message was received.
markrad 3:c0556ff7b8e3 206 *
markrad 3:c0556ff7b8e3 207 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 208 */
markrad 3:c0556ff7b8e3 209 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_GetLastMessageReceiveTime, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, time_t*, lastMessageReceiveTime);
markrad 3:c0556ff7b8e3 210
markrad 3:c0556ff7b8e3 211 /**
markrad 3:c0556ff7b8e3 212 * @brief This API sets a runtime option identified by parameter @p optionName
markrad 3:c0556ff7b8e3 213 * to a value pointed to by @p value. @p optionName and the data type
markrad 3:c0556ff7b8e3 214 * @p value is pointing to are specific for every option.
markrad 3:c0556ff7b8e3 215 *
markrad 3:c0556ff7b8e3 216 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 217 * @param optionName Name of the option.
markrad 3:c0556ff7b8e3 218 * @param value The value.
markrad 3:c0556ff7b8e3 219 *
markrad 3:c0556ff7b8e3 220 * The options that can be set via this API are:
markrad 3:c0556ff7b8e3 221 * - @b timeout - the maximum time in milliseconds a communication is
markrad 3:c0556ff7b8e3 222 * allowed to use. @p value is a pointer to an @c unsigned @c int with
markrad 3:c0556ff7b8e3 223 * the timeout value in milliseconds. This is only supported for the HTTP
markrad 3:c0556ff7b8e3 224 * protocol as of now. When the HTTP protocol uses CURL, the meaning of
markrad 3:c0556ff7b8e3 225 * the parameter is <em>total request time</em>. When the HTTP protocol uses
markrad 3:c0556ff7b8e3 226 * winhttp, the meaning is the same as the @c dwSendTimeout and
markrad 3:c0556ff7b8e3 227 * @c dwReceiveTimeout parameters of the
markrad 3:c0556ff7b8e3 228 * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa384116(v=vs.85).aspx">
markrad 3:c0556ff7b8e3 229 * WinHttpSetTimeouts</a> API.
markrad 3:c0556ff7b8e3 230 * - @b CURLOPT_LOW_SPEED_LIMIT - only available for HTTP protocol and only
markrad 3:c0556ff7b8e3 231 * when CURL is used. It has the same meaning as CURL's option with the same
markrad 3:c0556ff7b8e3 232 * name. @p value is pointer to a long.
markrad 3:c0556ff7b8e3 233 * - @b CURLOPT_LOW_SPEED_TIME - only available for HTTP protocol and only
markrad 3:c0556ff7b8e3 234 * when CURL is used. It has the same meaning as CURL's option with the same
markrad 3:c0556ff7b8e3 235 * name. @p value is pointer to a long.
markrad 3:c0556ff7b8e3 236 * - @b CURLOPT_FORBID_REUSE - only available for HTTP protocol and only
markrad 3:c0556ff7b8e3 237 * when CURL is used. It has the same meaning as CURL's option with the same
markrad 3:c0556ff7b8e3 238 * name. @p value is pointer to a long.
markrad 3:c0556ff7b8e3 239 * - @b CURLOPT_FRESH_CONNECT - only available for HTTP protocol and only
markrad 3:c0556ff7b8e3 240 * when CURL is used. It has the same meaning as CURL's option with the same
markrad 3:c0556ff7b8e3 241 * name. @p value is pointer to a long.
markrad 3:c0556ff7b8e3 242 * - @b CURLOPT_VERBOSE - only available for HTTP protocol and only
markrad 3:c0556ff7b8e3 243 * when CURL is used. It has the same meaning as CURL's option with the same
markrad 3:c0556ff7b8e3 244 * name. @p value is pointer to a long.
markrad 3:c0556ff7b8e3 245 * - @b messageTimeout - the maximum time in milliseconds until a message
markrad 3:c0556ff7b8e3 246 * is timeouted. The time starts at IoTHubClient_SendEventAsync. By default,
markrad 3:c0556ff7b8e3 247 * messages do not expire. @p is a pointer to a uint64_t
markrad 3:c0556ff7b8e3 248 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 249 */
markrad 3:c0556ff7b8e3 250 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetOption, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, const char*, optionName, const void*, value);
markrad 3:c0556ff7b8e3 251
markrad 3:c0556ff7b8e3 252 /**
markrad 3:c0556ff7b8e3 253 * @brief This API specifies a call back to be used when the device receives a state update.
markrad 3:c0556ff7b8e3 254 *
markrad 3:c0556ff7b8e3 255 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 256 * @param deviceTwinCallback The callback specified by the device client to be used for updating
markrad 3:c0556ff7b8e3 257 * the desired state. The callback will be called in response to a
markrad 3:c0556ff7b8e3 258 * request send by the IoTHub services. The payload will be passed to the
markrad 3:c0556ff7b8e3 259 * callback, along with two version numbers:
markrad 3:c0556ff7b8e3 260 * - Desired:
markrad 3:c0556ff7b8e3 261 * - LastSeenReported:
markrad 3:c0556ff7b8e3 262 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 263 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 264 *
markrad 3:c0556ff7b8e3 265 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 266 * the ::IoTHubClient_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 267 *
markrad 3:c0556ff7b8e3 268 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 269 */
markrad 3:c0556ff7b8e3 270 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetDeviceTwinCallback, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK, deviceTwinCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 271
markrad 3:c0556ff7b8e3 272 /**
markrad 3:c0556ff7b8e3 273 * @brief This API sends a report of the device's properties and their current values.
markrad 3:c0556ff7b8e3 274 *
markrad 3:c0556ff7b8e3 275 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 276 * @param reportedState The current device property values to be 'reported' to the IoTHub.
markrad 3:c0556ff7b8e3 277 * @param reportedStateCallback The callback specified by the device client to be called with the
markrad 3:c0556ff7b8e3 278 * result of the transaction.
markrad 3:c0556ff7b8e3 279 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 280 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 281 *
markrad 3:c0556ff7b8e3 282 * @b NOTE: The application behavior is undefined if the user calls
markrad 3:c0556ff7b8e3 283 * the ::IoTHubClient_Destroy function from within any callback.
markrad 3:c0556ff7b8e3 284 *
markrad 3:c0556ff7b8e3 285 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 286 */
markrad 3:c0556ff7b8e3 287 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SendReportedState, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, const unsigned char*, reportedState, size_t, size, IOTHUB_CLIENT_REPORTED_STATE_CALLBACK, reportedStateCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 288
markrad 3:c0556ff7b8e3 289 /**
markrad 3:c0556ff7b8e3 290 * @brief This API sets callback for cloud to device method call.
markrad 3:c0556ff7b8e3 291 *
markrad 3:c0556ff7b8e3 292 * @param iotHubClientHandle The handle created by a call to the create function.
markrad 3:c0556ff7b8e3 293 * @param deviceMethodCallback The callback which will be called by IoTHub.
markrad 3:c0556ff7b8e3 294 * @param userContextCallback User specified context that will be provided to the
markrad 3:c0556ff7b8e3 295 * callback. This can be @c NULL.
markrad 3:c0556ff7b8e3 296 *
markrad 3:c0556ff7b8e3 297 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 298 */
markrad 3:c0556ff7b8e3 299 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_SetDeviceMethodCallback, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_DEVICE_METHOD_CALLBACK_ASYNC, deviceMethodCallback, void*, userContextCallback);
markrad 3:c0556ff7b8e3 300
markrad 3:c0556ff7b8e3 301 #ifndef DONT_USE_UPLOADTOBLOB
markrad 3:c0556ff7b8e3 302 /**
markrad 3:c0556ff7b8e3 303 * @brief IoTHubClient_UploadToBlobAsync uploads data from memory to a file in Azure Blob Storage.
markrad 3:c0556ff7b8e3 304 *
markrad 3:c0556ff7b8e3 305 * @param iotHubClientHandle The handle created by a call to the IoTHubClient_Create function.
markrad 3:c0556ff7b8e3 306 * @param destinationFileName The name of the file to be created in Azure Blob Storage.
markrad 3:c0556ff7b8e3 307 * @param source The source of data.
markrad 3:c0556ff7b8e3 308 * @param size The size of data.
markrad 3:c0556ff7b8e3 309 * @param iotHubClientFileUploadCallback A callback to be invoked when the file upload operation has finished.
markrad 3:c0556ff7b8e3 310 * @param context A user-provided context to be passed to the file upload callback.
markrad 3:c0556ff7b8e3 311 *
markrad 3:c0556ff7b8e3 312 * @return IOTHUB_CLIENT_OK upon success or an error code upon failure.
markrad 3:c0556ff7b8e3 313 */
markrad 3:c0556ff7b8e3 314 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_UploadToBlobAsync, IOTHUB_CLIENT_HANDLE, iotHubClientHandle, const char*, destinationFileName, const unsigned char*, source, size_t, size, IOTHUB_CLIENT_FILE_UPLOAD_CALLBACK, iotHubClientFileUploadCallback, void*, context);
markrad 3:c0556ff7b8e3 315 #endif
markrad 3:c0556ff7b8e3 316 #ifdef __cplusplus
markrad 3:c0556ff7b8e3 317 }
markrad 3:c0556ff7b8e3 318 #endif
markrad 3:c0556ff7b8e3 319
markrad 3:c0556ff7b8e3 320 #endif /* IOTHUB_CLIENT_H */