From 4529c4c20a17fdb17ff6820aa01c8c38ff8a481f Mon Sep 17 00:00:00 2001 From: Liu Han Date: Wed, 20 Jan 2021 14:08:32 +0800 Subject: [PATCH 1/7] Update azure-iot-sdk-c to LTS_07_2020_Ref02 --- .gitlab-ci.yml | 3 ++- azure-iot-sdk-c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6cb0774..8394b05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,10 +60,11 @@ build_esp8266_demo: - chmod 600 ~/.ssh/id_rsa - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - git --version - - git clone --recursive --depth 1 $GITLAB_SSH_SERVER/sdk/ESP8266_RTOS_SDK.git + - git clone -b v3.3 --recursive --depth 1 $GITLAB_SSH_SERVER/sdk/ESP8266_RTOS_SDK.git - cd ESP8266_RTOS_SDK - source tools/ci/configure_ci_environment.sh - cd .. + - git submodule update --init --recursive - export IDF_PATH=$CI_PROJECT_DIR/ESP8266_RTOS_SDK - cd examples/iothub_client_sample_mqtt - make defconfig diff --git a/azure-iot-sdk-c b/azure-iot-sdk-c index 989f1dc..0528d52 160000 --- a/azure-iot-sdk-c +++ b/azure-iot-sdk-c @@ -1 +1 @@ -Subproject commit 989f1dc66c7de53cb14d29eb051003eec0de798e +Subproject commit 0528d52fc15767f4b3ba535ff35453d4e6b78f07 From e2861a76b0c692198a566edc813731df0bf54f9d Mon Sep 17 00:00:00 2001 From: Jonas Spanoghe Date: Fri, 19 Feb 2021 17:47:19 +0100 Subject: [PATCH 2/7] Include `esp_event.h` instead of `esp_event_loop.h` in agenttime_esp.c --- port/src/agenttime_esp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/port/src/agenttime_esp.c b/port/src/agenttime_esp.c index 5a58310..5a33408 100644 --- a/port/src/agenttime_esp.c +++ b/port/src/agenttime_esp.c @@ -8,7 +8,7 @@ #include "freertos/event_groups.h" #include "esp_system.h" #include "esp_wifi.h" -#include "esp_event_loop.h" +#include "esp_event.h" #include "esp_log.h" #include "esp_attr.h" @@ -65,7 +65,7 @@ time_t get_time(time_t* currentTime) } double get_difftime(time_t stopTime, time_t startTime) -{ +{ return (double)stopTime - (double)startTime; } From baa3b82add745b8156ff54c0127b304459827928 Mon Sep 17 00:00:00 2001 From: Jonas Spanoghe Date: Fri, 19 Feb 2021 17:47:38 +0100 Subject: [PATCH 3/7] Use new event system in `azure_main.c` of examples --- .../main/azure_main.c | 29 ++++++++++--------- .../main/azure_main.c | 29 ++++++++++--------- .../main/azure_main.c | 29 ++++++++++--------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/examples/iothub_client_sample_mqtt/main/azure_main.c b/examples/iothub_client_sample_mqtt/main/azure_main.c index 1097d30..a683442 100644 --- a/examples/iothub_client_sample_mqtt/main/azure_main.c +++ b/examples/iothub_client_sample_mqtt/main/azure_main.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" -#include "esp_event_loop.h" +#include "esp_event.h" #include "esp_log.h" #include "nvs_flash.h" @@ -35,32 +35,29 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "azure"; -static esp_err_t event_handler(void *ctx, system_event_t *event) +static void event_handler(void* arg, esp_event_base_t event_base, + int32_t event_id, void* event_data) { - switch(event->event_id) { - case SYSTEM_EVENT_STA_START: + if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); - break; - case SYSTEM_EVENT_STA_GOT_IP: + } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); - break; - case SYSTEM_EVENT_STA_DISCONNECTED: + } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { /* This is a workaround as ESP platform WiFi libs don't currently auto-reassociate. */ esp_wifi_connect(); xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); - break; - default: - break; } - return ESP_OK; } static void initialise_wifi(void) { - tcpip_adapter_init(); + ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); - ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_loop_create_default() ); + esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); + assert(sta_netif); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); @@ -71,6 +68,10 @@ static void initialise_wifi(void) }, }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); + + ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_start() ); diff --git a/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c b/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c index bfbe9d3..87e434e 100644 --- a/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c +++ b/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" -#include "esp_event_loop.h" +#include "esp_event.h" #include "esp_log.h" #include "nvs_flash.h" @@ -37,32 +37,29 @@ static const char *TAG = "azure"; extern int iothhub_devicetwin_init(void); -static esp_err_t event_handler(void *ctx, system_event_t *event) +static void event_handler(void* arg, esp_event_base_t event_base, + int32_t event_id, void* event_data) { - switch(event->event_id) { - case SYSTEM_EVENT_STA_START: + if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); - break; - case SYSTEM_EVENT_STA_GOT_IP: + } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); - break; - case SYSTEM_EVENT_STA_DISCONNECTED: + } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { /* This is a workaround as ESP platform WiFi libs don't currently auto-reassociate. */ esp_wifi_connect(); xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); - break; - default: - break; } - return ESP_OK; } static void initialise_wifi(void) { - tcpip_adapter_init(); + ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); - ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_loop_create_default() ); + esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); + assert(sta_netif); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); @@ -73,6 +70,10 @@ static void initialise_wifi(void) }, }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); + + ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_start() ); diff --git a/examples/prov_dev_client_ll_sample/main/azure_main.c b/examples/prov_dev_client_ll_sample/main/azure_main.c index 158d8f0..ad80e9d 100644 --- a/examples/prov_dev_client_ll_sample/main/azure_main.c +++ b/examples/prov_dev_client_ll_sample/main/azure_main.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" -#include "esp_event_loop.h" +#include "esp_event.h" #include "esp_log.h" #include "nvs_flash.h" @@ -35,32 +35,29 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "azure"; -static esp_err_t event_handler(void *ctx, system_event_t *event) +static void event_handler(void* arg, esp_event_base_t event_base, + int32_t event_id, void* event_data) { - switch(event->event_id) { - case SYSTEM_EVENT_STA_START: + if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); - break; - case SYSTEM_EVENT_STA_GOT_IP: + } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); - break; - case SYSTEM_EVENT_STA_DISCONNECTED: + } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { /* This is a workaround as ESP platform WiFi libs don't currently auto-reassociate. */ esp_wifi_connect(); xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); - break; - default: - break; } - return ESP_OK; } static void initialise_wifi(void) { - tcpip_adapter_init(); + ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); - ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_loop_create_default() ); + esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); + assert(sta_netif); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); @@ -71,6 +68,10 @@ static void initialise_wifi(void) }, }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); + + ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); + ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_start() ); From 7c605096ec9443298e512cbf1171465bdc43b47d Mon Sep 17 00:00:00 2001 From: Liu Han Date: Wed, 24 Feb 2021 11:41:47 +0800 Subject: [PATCH 4/7] examples: Update from legacy to new event system Merges https://github.com/espressif/esp-azure/pull/112 --- .../main/azure_main.c | 36 +++++++++++++++++++ .../main/azure_main.c | 36 +++++++++++++++++++ .../main/azure_main.c | 36 +++++++++++++++++++ port/src/agenttime_esp.c | 10 +----- 4 files changed, 109 insertions(+), 9 deletions(-) diff --git a/examples/iothub_client_sample_mqtt/main/azure_main.c b/examples/iothub_client_sample_mqtt/main/azure_main.c index a683442..1e2290f 100644 --- a/examples/iothub_client_sample_mqtt/main/azure_main.c +++ b/examples/iothub_client_sample_mqtt/main/azure_main.c @@ -14,7 +14,11 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#include "esp_event_loop.h" +#else #include "esp_event.h" +#endif #include "esp_log.h" #include "nvs_flash.h" @@ -35,6 +39,28 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "azure"; +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +static esp_err_t event_handler(void *ctx, system_event_t *event) +{ + switch(event->event_id) { + case SYSTEM_EVENT_STA_START: + esp_wifi_connect(); + break; + case SYSTEM_EVENT_STA_GOT_IP: + xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + /* This is a workaround as ESP platform WiFi libs don't currently + auto-reassociate. */ + esp_wifi_connect(); + xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); + break; + default: + break; + } + return ESP_OK; +} +#else static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { @@ -49,14 +75,21 @@ static void event_handler(void* arg, esp_event_base_t event_base, xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); } } +#endif static void initialise_wifi(void) { +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) + tcpip_adapter_init(); + wifi_event_group = xEventGroupCreate(); + ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); +#else ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK( esp_event_loop_create_default() ); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif); +#endif wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); @@ -69,8 +102,11 @@ static void initialise_wifi(void) }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#else ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); +#endif ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); diff --git a/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c b/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c index 87e434e..b192827 100644 --- a/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c +++ b/examples/iothub_devicetwin_samples_and_methods/main/azure_main.c @@ -14,7 +14,11 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#include "esp_event_loop.h" +#else #include "esp_event.h" +#endif #include "esp_log.h" #include "nvs_flash.h" @@ -37,6 +41,28 @@ static const char *TAG = "azure"; extern int iothhub_devicetwin_init(void); +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +static esp_err_t event_handler(void *ctx, system_event_t *event) +{ + switch(event->event_id) { + case SYSTEM_EVENT_STA_START: + esp_wifi_connect(); + break; + case SYSTEM_EVENT_STA_GOT_IP: + xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + /* This is a workaround as ESP platform WiFi libs don't currently + auto-reassociate. */ + esp_wifi_connect(); + xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); + break; + default: + break; + } + return ESP_OK; +} +#else static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { @@ -51,14 +77,21 @@ static void event_handler(void* arg, esp_event_base_t event_base, xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); } } +#endif static void initialise_wifi(void) { +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) + tcpip_adapter_init(); + wifi_event_group = xEventGroupCreate(); + ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); +#else ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK( esp_event_loop_create_default() ); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif); +#endif wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); @@ -71,8 +104,11 @@ static void initialise_wifi(void) }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#else ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); +#endif ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); diff --git a/examples/prov_dev_client_ll_sample/main/azure_main.c b/examples/prov_dev_client_ll_sample/main/azure_main.c index ad80e9d..f700115 100644 --- a/examples/prov_dev_client_ll_sample/main/azure_main.c +++ b/examples/prov_dev_client_ll_sample/main/azure_main.c @@ -14,7 +14,11 @@ #include "esp_system.h" #include "esp_system.h" #include "esp_wifi.h" +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#include "esp_event_loop.h" +#else #include "esp_event.h" +#endif #include "esp_log.h" #include "nvs_flash.h" @@ -35,6 +39,28 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "azure"; +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +static esp_err_t event_handler(void *ctx, system_event_t *event) +{ + switch(event->event_id) { + case SYSTEM_EVENT_STA_START: + esp_wifi_connect(); + break; + case SYSTEM_EVENT_STA_GOT_IP: + xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + /* This is a workaround as ESP platform WiFi libs don't currently + auto-reassociate. */ + esp_wifi_connect(); + xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); + break; + default: + break; + } + return ESP_OK; +} +#else static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { @@ -49,14 +75,21 @@ static void event_handler(void* arg, esp_event_base_t event_base, xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); } } +#endif static void initialise_wifi(void) { +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) + tcpip_adapter_init(); + wifi_event_group = xEventGroupCreate(); + ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); +#else ESP_ERROR_CHECK( esp_netif_init() ); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK( esp_event_loop_create_default() ); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif); +#endif wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); @@ -69,8 +102,11 @@ static void initialise_wifi(void) }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); +#ifdef CONFIG_IDF_TARGET_ESP8266 || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 0, 0)) +#else ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL) ); +#endif ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); diff --git a/port/src/agenttime_esp.c b/port/src/agenttime_esp.c index 5a33408..a9ae6ae 100644 --- a/port/src/agenttime_esp.c +++ b/port/src/agenttime_esp.c @@ -5,19 +5,11 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "freertos/event_groups.h" -#include "esp_system.h" -#include "esp_wifi.h" -#include "esp_event.h" -#include "esp_log.h" -#include "esp_attr.h" +#include "lwip/apps/sntp.h" -#include "lwip/err.h" #include "azure_c_shared_utility/agenttime.h" #include "azure_c_shared_utility/xlogging.h" -#include "lwip/apps/sntp.h" - void initialize_sntp(void) { printf("Initializing SNTP\n"); From aa05a8eae0ad35f671d4672244684e00df2b7677 Mon Sep 17 00:00:00 2001 From: Wellington Duraes Date: Tue, 14 Dec 2021 12:03:11 -0800 Subject: [PATCH 5/7] Update top readme for newer libraries Adding a comment at the top of the main readme referring to the newer libraries officially released by Microsoft, which should replace this sample (based on the previous version of the C SDK). --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 2d77471..43db37a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ - [Monitoring Results](#monitoring) - [Troubleshooting](#troubleshooting) +## 2021 Update + + + +Since this library has been published, Microsoft has created newer versions of the Azure SDK for usage with the Espressif ESP32. This new library is better suited for microcontrollers, great for composition with your own network stack and officially supported by Microsoft. + +The first one, [Azure IoT middleware for FreeRTOS](https://github.com/Azure/azure-iot-middleware-freertos), is based on ESP-IDF and FreeRTOS and it has [samples](https://github.com/Azure-Samples/iot-middleware-freertos-samples) for IoT Hub and IoT Central using the device provisioning service (DPS). + +The second one is based on [Azure IoT for C library for Arduino](https://github.com/Azure/azure-sdk-for-c-arduino) and also has samples for IoT Hub. + +If you can, **avoid using this library for any new projects**. + ## Introduction From b1b1055cf78de601f6d78d0bba7a65f361f46109 Mon Sep 17 00:00:00 2001 From: yuanjm Date: Wed, 16 Feb 2022 10:52:18 +0800 Subject: [PATCH 6/7] azure: Update azure-iot-sdk-c version to LTS_01_2022_Ref01 --- azure-iot-sdk-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-iot-sdk-c b/azure-iot-sdk-c index 0528d52..5805fb6 160000 --- a/azure-iot-sdk-c +++ b/azure-iot-sdk-c @@ -1 +1 @@ -Subproject commit 0528d52fc15767f4b3ba535ff35453d4e6b78f07 +Subproject commit 5805fb669ffe2adff021d68c62725d0bd783ac49 From c37b5eedd4935b4d6937497d865f0b6eb0bd4adc Mon Sep 17 00:00:00 2001 From: yuanjm Date: Wed, 16 Feb 2022 14:35:14 +0800 Subject: [PATCH 7/7] azure: Fix build issue for new azure_iot_sdk_c --- component.mk | 2 +- port/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/component.mk b/component.mk index 0fde7ce..6a7f8cb 100644 --- a/component.mk +++ b/component.mk @@ -160,7 +160,7 @@ ifndef CONFIG_TARGET_PLATFORM_ESP8266 COMPONENT_SRCDIRS += azure-iot-sdk-c/certs endif -CFLAGS += -Wno-unused-function -Wno-missing-braces -Wno-missing-field-initializers -DHSM_TYPE_X509 -DHSM_TYPE_SAS_TOKEN +CFLAGS += -Wno-unused-function -Wno-missing-braces -Wno-missing-field-initializers -DHSM_TYPE_X509 -DHSM_TYPE_SAS_TOKEN -Wno-unknown-pragmas ifdef CONFIG_DEVICE_COMMON_NAME CFLAGS += -DUSE_PROV_MODULE diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt index 5b82bbd..b9caf56 100644 --- a/port/CMakeLists.txt +++ b/port/CMakeLists.txt @@ -131,6 +131,7 @@ component_compile_options ( -Wno-unused-function -Wno-missing-braces -Wno-missing-field-initializers + -Wno-unknown-pragmas ) component_compile_definitions (