Microsoft Azure IoTHub client libraries
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more
This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks
iothub_client.c@88:248736be106e, 2018-06-11 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Mon Jun 11 15:39:23 2018 -0700
- Revision:
- 88:248736be106e
- Parent:
- 83:18ccaa6567d0
- Child:
- 89:a2ed767a532e
1.2.5
Who changed what in which revision?
User | Revision | Line number | New 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 | #include <stdlib.h> |
Azure.IoT.Build | 54:6dcad9019a64 | 5 | #include "azure_c_shared_utility/umock_c_prod.h" |
Azure.IoT Build | 38:a05929a75111 | 6 | #include "azure_c_shared_utility/gballoc.h" |
AzureIoTClient | 16:deba40344375 | 7 | |
AzureIoTClient | 88:248736be106e | 8 | #include "iothub_client_core.h" |
AzureIoTClient | 16:deba40344375 | 9 | #include "iothub_client.h" |
AzureIoTClient | 16:deba40344375 | 10 | |
Azure.IoT.Build | 54:6dcad9019a64 | 11 | IOTHUB_CLIENT_HANDLE IoTHubClient_CreateFromConnectionString(const char* connectionString, IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol) |
Azure.IoT.Build | 54:6dcad9019a64 | 12 | { |
AzureIoTClient | 88:248736be106e | 13 | return (IOTHUB_CLIENT_HANDLE)IoTHubClientCore_CreateFromConnectionString(connectionString, protocol); |
Azure.IoT.Build | 54:6dcad9019a64 | 14 | } |
Azure.IoT.Build | 54:6dcad9019a64 | 15 | |
Azure.IoT.Build | 54:6dcad9019a64 | 16 | IOTHUB_CLIENT_HANDLE IoTHubClient_Create(const IOTHUB_CLIENT_CONFIG* config) |
Azure.IoT.Build | 54:6dcad9019a64 | 17 | { |
AzureIoTClient | 88:248736be106e | 18 | return (IOTHUB_CLIENT_HANDLE)IoTHubClientCore_Create(config); |
AzureIoTClient | 16:deba40344375 | 19 | } |
AzureIoTClient | 16:deba40344375 | 20 | |
Azure.IoT Build | 37:18310e4d888d | 21 | IOTHUB_CLIENT_HANDLE IoTHubClient_CreateWithTransport(TRANSPORT_HANDLE transportHandle, const IOTHUB_CLIENT_CONFIG* config) |
Azure.IoT Build | 37:18310e4d888d | 22 | { |
AzureIoTClient | 88:248736be106e | 23 | return (IOTHUB_CLIENT_HANDLE)IoTHubClientCore_CreateWithTransport(transportHandle, config); |
AzureIoTClient | 78:74a8d3068204 | 24 | } |
AzureIoTClient | 78:74a8d3068204 | 25 | |
AzureIoTClient | 78:74a8d3068204 | 26 | IOTHUB_CLIENT_HANDLE IoTHubClient_CreateFromDeviceAuth(const char* iothub_uri, const char* device_id, IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol) |
AzureIoTClient | 78:74a8d3068204 | 27 | { |
AzureIoTClient | 88:248736be106e | 28 | return (IOTHUB_CLIENT_HANDLE)IoTHubClientCore_CreateFromDeviceAuth(iothub_uri, device_id, protocol); |
Azure.IoT Build | 37:18310e4d888d | 29 | } |
Azure.IoT Build | 37:18310e4d888d | 30 | |
AzureIoTClient | 18:1e9adb15c645 | 31 | void IoTHubClient_Destroy(IOTHUB_CLIENT_HANDLE iotHubClientHandle) |
AzureIoTClient | 16:deba40344375 | 32 | { |
AzureIoTClient | 88:248736be106e | 33 | IoTHubClientCore_Destroy((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle); |
AzureIoTClient | 16:deba40344375 | 34 | } |
AzureIoTClient | 16:deba40344375 | 35 | |
AzureIoTClient | 16:deba40344375 | 36 | IOTHUB_CLIENT_RESULT IoTHubClient_SendEventAsync(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_MESSAGE_HANDLE eventMessageHandle, IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK eventConfirmationCallback, void* userContextCallback) |
AzureIoTClient | 16:deba40344375 | 37 | { |
AzureIoTClient | 88:248736be106e | 38 | return IoTHubClientCore_SendEventAsync((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, eventMessageHandle, eventConfirmationCallback, userContextCallback); |
AzureIoTClient | 16:deba40344375 | 39 | } |
AzureIoTClient | 16:deba40344375 | 40 | |
AzureIoTClient | 16:deba40344375 | 41 | IOTHUB_CLIENT_RESULT IoTHubClient_GetSendStatus(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_STATUS *iotHubClientStatus) |
AzureIoTClient | 16:deba40344375 | 42 | { |
AzureIoTClient | 88:248736be106e | 43 | return IoTHubClientCore_GetSendStatus((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, iotHubClientStatus); |
AzureIoTClient | 16:deba40344375 | 44 | } |
AzureIoTClient | 16:deba40344375 | 45 | |
AzureIoTClient | 16:deba40344375 | 46 | IOTHUB_CLIENT_RESULT IoTHubClient_SetMessageCallback(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC messageCallback, void* userContextCallback) |
AzureIoTClient | 16:deba40344375 | 47 | { |
AzureIoTClient | 88:248736be106e | 48 | return IoTHubClientCore_SetMessageCallback((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, messageCallback, userContextCallback); |
AzureIoTClient | 16:deba40344375 | 49 | } |
AzureIoTClient | 16:deba40344375 | 50 | |
AzureIoTClient | 53:1e5a1ca1f274 | 51 | IOTHUB_CLIENT_RESULT IoTHubClient_SetConnectionStatusCallback(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_CONNECTION_STATUS_CALLBACK connectionStatusCallback, void * userContextCallback) |
AzureIoTClient | 52:1cc3c6d07cad | 52 | { |
AzureIoTClient | 88:248736be106e | 53 | return IoTHubClientCore_SetConnectionStatusCallback((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, connectionStatusCallback, userContextCallback); |
AzureIoTClient | 52:1cc3c6d07cad | 54 | } |
AzureIoTClient | 52:1cc3c6d07cad | 55 | |
AzureIoTClient | 53:1e5a1ca1f274 | 56 | IOTHUB_CLIENT_RESULT IoTHubClient_SetRetryPolicy(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY retryPolicy, size_t retryTimeoutLimitInSeconds) |
AzureIoTClient | 52:1cc3c6d07cad | 57 | { |
AzureIoTClient | 88:248736be106e | 58 | return IoTHubClientCore_SetRetryPolicy((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, retryPolicy, retryTimeoutLimitInSeconds); |
AzureIoTClient | 52:1cc3c6d07cad | 59 | } |
AzureIoTClient | 52:1cc3c6d07cad | 60 | |
Azure.IoT.Build | 54:6dcad9019a64 | 61 | IOTHUB_CLIENT_RESULT IoTHubClient_GetRetryPolicy(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_RETRY_POLICY* retryPolicy, size_t* retryTimeoutLimitInSeconds) |
AzureIoTClient | 52:1cc3c6d07cad | 62 | { |
AzureIoTClient | 88:248736be106e | 63 | return IoTHubClientCore_GetRetryPolicy((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, retryPolicy, retryTimeoutLimitInSeconds); |
AzureIoTClient | 52:1cc3c6d07cad | 64 | } |
AzureIoTClient | 52:1cc3c6d07cad | 65 | |
AzureIoTClient | 16:deba40344375 | 66 | IOTHUB_CLIENT_RESULT IoTHubClient_GetLastMessageReceiveTime(IOTHUB_CLIENT_HANDLE iotHubClientHandle, time_t* lastMessageReceiveTime) |
AzureIoTClient | 16:deba40344375 | 67 | { |
AzureIoTClient | 88:248736be106e | 68 | return IoTHubClientCore_GetLastMessageReceiveTime((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, lastMessageReceiveTime); |
AzureIoTClient | 16:deba40344375 | 69 | } |
AzureIoTClient | 16:deba40344375 | 70 | |
AzureIoTClient | 16:deba40344375 | 71 | IOTHUB_CLIENT_RESULT IoTHubClient_SetOption(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const char* optionName, const void* value) |
AzureIoTClient | 16:deba40344375 | 72 | { |
AzureIoTClient | 88:248736be106e | 73 | return IoTHubClientCore_SetOption((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, optionName, value); |
AzureIoTClient | 53:1e5a1ca1f274 | 74 | } |
AzureIoTClient | 53:1e5a1ca1f274 | 75 | |
AzureIoTClient | 53:1e5a1ca1f274 | 76 | IOTHUB_CLIENT_RESULT IoTHubClient_SetDeviceTwinCallback(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK deviceTwinCallback, void* userContextCallback) |
AzureIoTClient | 53:1e5a1ca1f274 | 77 | { |
AzureIoTClient | 88:248736be106e | 78 | return IoTHubClientCore_SetDeviceTwinCallback((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, deviceTwinCallback, userContextCallback); |
AzureIoTClient | 16:deba40344375 | 79 | } |
AzureIoTClient | 42:448eecc3676e | 80 | |
AzureIoTClient | 53:1e5a1ca1f274 | 81 | IOTHUB_CLIENT_RESULT IoTHubClient_SendReportedState(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const unsigned char* reportedState, size_t size, IOTHUB_CLIENT_REPORTED_STATE_CALLBACK reportedStateCallback, void* userContextCallback) |
AzureIoTClient | 53:1e5a1ca1f274 | 82 | { |
AzureIoTClient | 88:248736be106e | 83 | return IoTHubClientCore_SendReportedState((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, reportedState, size, reportedStateCallback, userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 84 | } |
AzureIoTClient | 53:1e5a1ca1f274 | 85 | |
AzureIoTClient | 53:1e5a1ca1f274 | 86 | IOTHUB_CLIENT_RESULT IoTHubClient_SetDeviceMethodCallback(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_DEVICE_METHOD_CALLBACK_ASYNC deviceMethodCallback, void* userContextCallback) |
AzureIoTClient | 53:1e5a1ca1f274 | 87 | { |
AzureIoTClient | 88:248736be106e | 88 | return IoTHubClientCore_SetDeviceMethodCallback((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, deviceMethodCallback, userContextCallback); |
AzureIoTClient | 53:1e5a1ca1f274 | 89 | } |
AzureIoTClient | 53:1e5a1ca1f274 | 90 | |
AzureIoTClient | 55:59b527ab3452 | 91 | IOTHUB_CLIENT_RESULT IoTHubClient_SetDeviceMethodCallback_Ex(IOTHUB_CLIENT_HANDLE iotHubClientHandle, IOTHUB_CLIENT_INBOUND_DEVICE_METHOD_CALLBACK inboundDeviceMethodCallback, void* userContextCallback) |
AzureIoTClient | 55:59b527ab3452 | 92 | { |
AzureIoTClient | 88:248736be106e | 93 | return IoTHubClientCore_SetDeviceMethodCallback_Ex((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, inboundDeviceMethodCallback, userContextCallback); |
AzureIoTClient | 55:59b527ab3452 | 94 | } |
AzureIoTClient | 55:59b527ab3452 | 95 | |
AzureIoTClient | 55:59b527ab3452 | 96 | IOTHUB_CLIENT_RESULT IoTHubClient_DeviceMethodResponse(IOTHUB_CLIENT_HANDLE iotHubClientHandle, METHOD_HANDLE methodId, const unsigned char* response, size_t respSize, int statusCode) |
AzureIoTClient | 55:59b527ab3452 | 97 | { |
AzureIoTClient | 88:248736be106e | 98 | return IoTHubClientCore_DeviceMethodResponse((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, methodId, response, respSize, statusCode); |
AzureIoTClient | 55:59b527ab3452 | 99 | } |
AzureIoTClient | 53:1e5a1ca1f274 | 100 | |
AzureIoTClient | 44:33dd78697616 | 101 | #ifndef DONT_USE_UPLOADTOBLOB |
AzureIoTClient | 42:448eecc3676e | 102 | |
AzureIoTClient | 42:448eecc3676e | 103 | 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) |
AzureIoTClient | 42:448eecc3676e | 104 | { |
AzureIoTClient | 88:248736be106e | 105 | return IoTHubClientCore_UploadToBlobAsync((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, destinationFileName, source, size, iotHubClientFileUploadCallback, context); |
AzureIoTClient | 42:448eecc3676e | 106 | } |
AzureIoTClient | 80:db5f5237bc95 | 107 | |
AzureIoTClient | 80:db5f5237bc95 | 108 | IOTHUB_CLIENT_RESULT IoTHubClient_UploadMultipleBlocksToBlobAsync(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const char* destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK getDataCallback, void* context) |
AzureIoTClient | 80:db5f5237bc95 | 109 | { |
AzureIoTClient | 88:248736be106e | 110 | return IoTHubClientCore_UploadMultipleBlocksToBlobAsync((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, destinationFileName, getDataCallback, NULL, context); |
AzureIoTClient | 82:f94e6bed4495 | 111 | } |
AzureIoTClient | 80:db5f5237bc95 | 112 | |
AzureIoTClient | 82:f94e6bed4495 | 113 | IOTHUB_CLIENT_RESULT IoTHubClient_UploadMultipleBlocksToBlobAsyncEx(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const char* destinationFileName, IOTHUB_CLIENT_FILE_UPLOAD_GET_DATA_CALLBACK_EX getDataCallbackEx, void* context) |
AzureIoTClient | 82:f94e6bed4495 | 114 | { |
AzureIoTClient | 88:248736be106e | 115 | return IoTHubClientCore_UploadMultipleBlocksToBlobAsync((IOTHUB_CLIENT_CORE_HANDLE)iotHubClientHandle, destinationFileName, NULL, getDataCallbackEx, context); |
AzureIoTClient | 80:db5f5237bc95 | 116 | } |
AzureIoTClient | 80:db5f5237bc95 | 117 | |
AzureIoTClient | 44:33dd78697616 | 118 | #endif /*DONT_USE_UPLOADTOBLOB*/ |