From 88335d174cc5707bcf6b053a75d693c7981ddbe3 Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Wed, 29 Jun 2022 18:00:27 +0530 Subject: [PATCH] esp_rmaker_core: Minor changes for compilation with idf v5.0/master --- .gitlab-ci.yml | 8 ++++++++ .../esp_rainmaker/src/core/esp_rmaker_local_ctrl.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d66a43..7c654fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,11 +81,19 @@ build_idf_v4.4: variables: EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3" +build_idf_v5.0: + extends: .build_template + image: espressif/idf:release-v5.0 + variables: + EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3" + EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio" + build_idf_master: extends: .build_template image: espressif/idf:latest variables: EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3" + EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio" build_docs: stage: build diff --git a/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c b/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c index 496dd78..dd2f44c 100644 --- a/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c +++ b/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c @@ -266,7 +266,12 @@ static esp_err_t __esp_rmaker_start_local_ctrl_service(const char *serv_name) }; /* If sec1, add security type details to the config */ - protocomm_security_pop_t *pop = NULL; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) +#define PROTOCOMM_SEC_DATA protocomm_security1_params_t +#else +#define PROTOCOMM_SEC_DATA protocomm_security_pop_t +#endif /* ESP_IDF_VERSION */ + PROTOCOMM_SEC_DATA *pop = NULL; #if ESP_RMAKER_LOCAL_CTRL_SECURITY_TYPE == 1 char *pop_str = esp_rmaker_local_ctrl_get_pop(); /* Note: pop_str shouldn't be freed. If it gets freed, the pointer which is internally copied in esp_local_ctrl_start() will become invalid which would cause corruption. */ @@ -274,7 +279,7 @@ static esp_err_t __esp_rmaker_start_local_ctrl_service(const char *serv_name) int sec_ver = esp_rmaker_local_ctrl_get_security_type(); if (sec_ver != 0 && pop_str) { - pop = (protocomm_security_pop_t *)calloc(1, sizeof(protocomm_security_pop_t)); + pop = (PROTOCOMM_SEC_DATA *)calloc(1, sizeof(PROTOCOMM_SEC_DATA)); if (!pop) { ESP_LOGE(TAG, "Failed to allocate pop"); free(pop_str); @@ -286,7 +291,11 @@ static esp_err_t __esp_rmaker_start_local_ctrl_service(const char *serv_name) config.proto_sec.version = sec_ver; config.proto_sec.custom_handle = NULL; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) + config.proto_sec.sec_params = pop; +#else config.proto_sec.pop = pop; +#endif /* ESP_IDF_VERSION */ #endif /* Start esp_local_ctrl service */