From cb0db73c150f44d6e83c293910f9e64f9a0128a3 Mon Sep 17 00:00:00 2001 From: Ewerton Scaboro da Silva Date: Thu, 17 Mar 2022 15:05:33 -0700 Subject: [PATCH] Revert the user agent property name from dct to DeviceClientType Azure IoT Hub parses the user agent information using the property name DeviceClientType, so the client must send it with that name otherwise the user agent string is not properly stored on Azure. A change in the property name to "dct" can only be done after the hub is also updated to support that name/alias. --- examples/Azure_IoT_Central_ESP32/AzureIoT.h | 2 +- examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.h | 2 +- .../Azure_IoT_Central_ESP32_AzureIoTKit.ino | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Azure_IoT_Central_ESP32/AzureIoT.h b/examples/Azure_IoT_Central_ESP32/AzureIoT.h index 4cf52218..84795bd9 100644 --- a/examples/Azure_IoT_Central_ESP32/AzureIoT.h +++ b/examples/Azure_IoT_Central_ESP32/AzureIoT.h @@ -499,7 +499,7 @@ typedef struct azure_iot_config_t_struct * Where: * = + '\0' * = + '/' + lengthof() + '/' + '?' + + - * "&dct=" + urlenc() + "&model-id=" + urlenc() + '\0' + * "&DeviceClientType=" + urlenc() + "&model-id=" + urlenc() + '\0' * = "api-version=" * ) = "SharedAccessSignature sr=" + + "%2Fdevices%2F" + + * "&sig=" + urlenc() + "&se=" + + '\0' diff --git a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.h b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.h index 4cf52218..84795bd9 100644 --- a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.h +++ b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.h @@ -499,7 +499,7 @@ typedef struct azure_iot_config_t_struct * Where: * = + '\0' * = + '/' + lengthof() + '/' + '?' + + - * "&dct=" + urlenc() + "&model-id=" + urlenc() + '\0' + * "&DeviceClientType=" + urlenc() + "&model-id=" + urlenc() + '\0' * = "api-version=" * ) = "SharedAccessSignature sr=" + + "%2Fdevices%2F" + + * "&sig=" + urlenc() + "&se=" + + '\0' diff --git a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino index b77bc615..ea1a7b54 100644 --- a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino +++ b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino @@ -85,7 +85,7 @@ static const char* wifi_ssid = IOT_CONFIG_WIFI_SSID; static const char* wifi_password = IOT_CONFIG_WIFI_PASSWORD; // TODO: remove this after updating library with Azure SDK for C version 1.3.0-beta.2 or later. -#define AZURE_SDK_CLIENT_USER_AGENT_WORKAROUND "dct=" AZURE_SDK_CLIENT_USER_AGENT +#define AZURE_SDK_CLIENT_USER_AGENT_WORKAROUND "DeviceClientType=" AZURE_SDK_CLIENT_USER_AGENT /* --- Function Declarations --- */ static void sync_device_clock_with_ntp_server();