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

Committer:
AzureIoTClient
Date:
Tue Mar 20 10:29:00 2018 -0700
Revision:
85:de16c0a8a196
Parent:
81:8de701563187
1.2.1

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 #ifndef IOTHUB_CLIENT_PRIVATE_H
AzureIoTClient 16:deba40344375 5 #define IOTHUB_CLIENT_PRIVATE_H
AzureIoTClient 16:deba40344375 6
AzureIoTClient 16:deba40344375 7 #include <signal.h>
AzureIoTClient 16:deba40344375 8
Azure.IoT.Build 54:6dcad9019a64 9 #include "azure_c_shared_utility/constbuffer.h"
AzureIoTClient 53:1e5a1ca1f274 10 #include "azure_c_shared_utility/crt_abstractions.h"
Azure.IoT Build 38:a05929a75111 11 #include "azure_c_shared_utility/doublylinkedlist.h"
Azure.IoT.Build 54:6dcad9019a64 12 #include "azure_c_shared_utility/macro_utils.h"
Azure.IoT.Build 54:6dcad9019a64 13 #include "azure_c_shared_utility/tickcounter.h"
AzureIoTClient 53:1e5a1ca1f274 14 #include "azure_c_shared_utility/umock_c_prod.h"
AzureIoTClient 16:deba40344375 15
AzureIoTClient 16:deba40344375 16 #include "iothub_message.h"
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 #define EVENT_ENDPOINT "/messages/events"
AzureIoTClient 16:deba40344375 25 #define MESSAGE_ENDPOINT "/messages/devicebound"
AzureIoTClient 16:deba40344375 26 #define MESSAGE_ENDPOINT_HTTP "/messages/devicebound"
AzureIoTClient 16:deba40344375 27 #define MESSAGE_ENDPOINT_HTTP_ETAG "/messages/devicebound/"
AzureIoTClient 32:6e9d81a62085 28 #define CLIENT_DEVICE_TYPE_PREFIX "iothubclient"
AzureIoTClient 32:6e9d81a62085 29 #define CLIENT_DEVICE_BACKSLASH "/"
AzureIoTClient 16:deba40344375 30 #define CBS_REPLY_TO "cbs"
AzureIoTClient 16:deba40344375 31 #define CBS_ENDPOINT "/$" CBS_REPLY_TO
AzureIoTClient 53:1e5a1ca1f274 32 #define API_VERSION "?api-version=2016-11-14"
AzureIoTClient 16:deba40344375 33 #define REJECT_QUERY_PARAMETER "&reject"
AzureIoTClient 16:deba40344375 34
AzureIoTClient 61:8b85a4e797cf 35 typedef bool(*IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC_EX)(MESSAGE_CALLBACK_INFO* messageData, void* userContextCallback);
AzureIoTClient 61:8b85a4e797cf 36
AzureIoTClient 52:1cc3c6d07cad 37 MOCKABLE_FUNCTION(, void, IoTHubClient_LL_SendComplete, IOTHUB_CLIENT_LL_HANDLE, handle, PDLIST_ENTRY, completed, IOTHUB_CLIENT_CONFIRMATION_RESULT, result);
AzureIoTClient 53:1e5a1ca1f274 38 MOCKABLE_FUNCTION(, void, IoTHubClient_LL_ReportedStateComplete, IOTHUB_CLIENT_LL_HANDLE, handle, uint32_t, item_id, int, status_code);
AzureIoTClient 61:8b85a4e797cf 39 MOCKABLE_FUNCTION(, bool, IoTHubClient_LL_MessageCallback, IOTHUB_CLIENT_LL_HANDLE, handle, MESSAGE_CALLBACK_INFO*, message_data);
AzureIoTClient 53:1e5a1ca1f274 40 MOCKABLE_FUNCTION(, void, IoTHubClient_LL_RetrievePropertyComplete, IOTHUB_CLIENT_LL_HANDLE, handle, DEVICE_TWIN_UPDATE_STATE, update_state, const unsigned char*, payLoad, size_t, size);
AzureIoTClient 55:59b527ab3452 41 MOCKABLE_FUNCTION(, int, IoTHubClient_LL_DeviceMethodComplete, IOTHUB_CLIENT_LL_HANDLE, handle, const char*, method_name, const unsigned char*, payLoad, size_t, size, METHOD_HANDLE, response_id);
AzureIoTClient 61:8b85a4e797cf 42 MOCKABLE_FUNCTION(, void, IoTHubClient_LL_ConnectionStatusCallBack, IOTHUB_CLIENT_LL_HANDLE, handle, IOTHUB_CLIENT_CONNECTION_STATUS, status, IOTHUB_CLIENT_CONNECTION_STATUS_REASON, reason);
AzureIoTClient 62:5a4cdacf5090 43 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SetMessageCallback_Ex, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC_EX, messageCallback, void*, userContextCallback);
AzureIoTClient 61:8b85a4e797cf 44 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_SendMessageDisposition, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, MESSAGE_CALLBACK_INFO*, messageData, IOTHUBMESSAGE_DISPOSITION_RESULT, disposition);
AzureIoTClient 66:a419827cb051 45 MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClient_LL_GetOption, IOTHUB_CLIENT_LL_HANDLE, iotHubClientHandle, const char*, optionName, void**, value);
AzureIoTClient 61:8b85a4e797cf 46
AzureIoTClient 16:deba40344375 47 typedef struct IOTHUB_MESSAGE_LIST_TAG
AzureIoTClient 16:deba40344375 48 {
AzureIoTClient 16:deba40344375 49 IOTHUB_MESSAGE_HANDLE messageHandle;
AzureIoTClient 16:deba40344375 50 IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK callback;
AzureIoTClient 16:deba40344375 51 void* context;
AzureIoTClient 16:deba40344375 52 DLIST_ENTRY entry;
Azure.IoT.Build 54:6dcad9019a64 53 tickcounter_ms_t ms_timesOutAfter; /* a value of "0" means "no timeout", if the IOTHUBCLIENT_LL's handle tickcounter > msTimesOutAfer then the message shall timeout*/
AzureIoTClient 16:deba40344375 54 }IOTHUB_MESSAGE_LIST;
AzureIoTClient 16:deba40344375 55
AzureIoTClient 53:1e5a1ca1f274 56 typedef struct IOTHUB_DEVICE_TWIN_TAG
AzureIoTClient 53:1e5a1ca1f274 57 {
AzureIoTClient 53:1e5a1ca1f274 58 uint32_t item_id;
Azure.IoT.Build 54:6dcad9019a64 59 tickcounter_ms_t ms_timesOutAfter; /* a value of "0" means "no timeout", if the IOTHUBCLIENT_LL's handle tickcounter > msTimesOutAfer then the message shall timeout*/
AzureIoTClient 53:1e5a1ca1f274 60 IOTHUB_CLIENT_REPORTED_STATE_CALLBACK reported_state_callback;
AzureIoTClient 53:1e5a1ca1f274 61 CONSTBUFFER_HANDLE report_data_handle;
AzureIoTClient 53:1e5a1ca1f274 62 void* context;
AzureIoTClient 53:1e5a1ca1f274 63 DLIST_ENTRY entry;
AzureIoTClient 81:8de701563187 64 IOTHUB_CLIENT_LL_HANDLE client_handle;
AzureIoTClient 81:8de701563187 65 IOTHUB_DEVICE_HANDLE device_handle;
AzureIoTClient 53:1e5a1ca1f274 66 } IOTHUB_DEVICE_TWIN;
AzureIoTClient 61:8b85a4e797cf 67
AzureIoTClient 53:1e5a1ca1f274 68 union IOTHUB_IDENTITY_INFO_TAG
AzureIoTClient 53:1e5a1ca1f274 69 {
AzureIoTClient 53:1e5a1ca1f274 70 IOTHUB_DEVICE_TWIN* device_twin;
AzureIoTClient 53:1e5a1ca1f274 71 IOTHUB_MESSAGE_LIST* iothub_message;
AzureIoTClient 53:1e5a1ca1f274 72 };
AzureIoTClient 53:1e5a1ca1f274 73
AzureIoTClient 16:deba40344375 74 #ifdef __cplusplus
AzureIoTClient 16:deba40344375 75 }
AzureIoTClient 16:deba40344375 76 #endif
AzureIoTClient 16:deba40344375 77
AzureIoTClient 16:deba40344375 78 #endif /* IOTHUB_CLIENT_PRIVATE_H */