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