mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
fix(esp_wifi): Remove deprecated NAN API variables in examples
This commit is contained in:
committed by
Kapil Gupta
parent
f12debf4f5
commit
a82788180c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -826,7 +826,7 @@ esp_err_t esp_wifi_nan_stop(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
uint8_t esp_wifi_nan_publish_service(const wifi_nan_publish_cfg_t *publish_cfg, bool ndp_resp_needed)
|
||||
uint8_t esp_wifi_nan_publish_service(const wifi_nan_publish_cfg_t *publish_cfg)
|
||||
{
|
||||
uint8_t pub_id;
|
||||
|
||||
@@ -865,7 +865,7 @@ uint8_t esp_wifi_nan_publish_service(const wifi_nan_publish_cfg_t *publish_cfg,
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Started Publishing %s [Service ID - %u]", publish_cfg->service_name, pub_id);
|
||||
nan_record_own_svc(pub_id, ESP_NAN_PUBLISH, publish_cfg->service_name, ndp_resp_needed);
|
||||
nan_record_own_svc(pub_id, ESP_NAN_PUBLISH, publish_cfg->service_name, publish_cfg->ndp_resp_needed);
|
||||
NAN_DATA_UNLOCK();
|
||||
|
||||
return pub_id;
|
||||
@@ -969,9 +969,6 @@ esp_err_t esp_wifi_nan_send_message(wifi_nan_followup_params_t *fup_params)
|
||||
ESP_LOGD(TAG, "Sent below payload to Peer "MACSTR" with Service ID %d",
|
||||
MAC2STR(fup_params->peer_mac), fup_params->peer_inst_id);
|
||||
ESP_LOG_BUFFER_HEXDUMP(TAG, fup_params->ssi, fup_params->ssi_len, ESP_LOG_DEBUG);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Sent message '%s' to Peer "MACSTR" with Service ID %d", fup_params->svc_info,
|
||||
MAC2STR(fup_params->peer_mac), fup_params->peer_inst_id);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@@ -114,9 +114,6 @@ static void nan_receive_event_handler(void *arg, esp_event_base_t event_base,
|
||||
if (evt->ssi_len) {
|
||||
ESP_LOGI(TAG, "Received payload from Peer "MACSTR" [Peer Service id - %d] - ", MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
ESP_LOG_BUFFER_HEXDUMP(TAG, evt->ssi, evt->ssi_len, ESP_LOG_INFO);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Received message '%s' from Peer "MACSTR" [Peer Service id - %d]",
|
||||
evt->peer_svc_info, MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +287,6 @@ static int wifi_cmd_nan_publish(int argc, char **argv)
|
||||
{
|
||||
int nerrors = arg_parse(argc, argv, (void **) &pub_args);
|
||||
uint32_t pub_id;
|
||||
bool ndp_resp_needed = false;
|
||||
|
||||
if (nerrors != 0) {
|
||||
arg_print_errors(stderr, pub_args.end, argv[0]);
|
||||
@@ -324,7 +320,7 @@ static int wifi_cmd_nan_publish(int argc, char **argv)
|
||||
strlcpy(publish.matching_filter, pub_args.filter->sval[0], ESP_WIFI_MAX_SVC_NAME_LEN);
|
||||
}
|
||||
|
||||
if (!esp_wifi_nan_publish_service(&publish, ndp_resp_needed)) {
|
||||
if (!esp_wifi_nan_publish_service(&publish)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -50,9 +50,6 @@ static void nan_receive_event_handler(void *arg, esp_event_base_t event_base,
|
||||
if (evt->ssi_len) {
|
||||
ESP_LOGI(TAG, "Received payload from Peer "MACSTR" [Peer Service id - %d] - ", MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
ESP_LOG_BUFFER_HEXDUMP(TAG, evt->ssi, evt->ssi_len, ESP_LOG_INFO);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Received message '%s' from Peer "MACSTR" [Peer Service id - %d]",
|
||||
evt->peer_svc_info, MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
}
|
||||
xEventGroupSetBits(nan_event_group, NAN_RECEIVE);
|
||||
}
|
||||
@@ -83,12 +80,6 @@ void wifi_nan_publish(void)
|
||||
NULL,
|
||||
&instance_any_id));
|
||||
|
||||
/* ndp_require_consent
|
||||
* If set to false - All incoming NDP requests will be internally accepted if valid.
|
||||
* If set to true - All incoming NDP requests raise NDP_INDICATION event, upon which application can either accept or reject them.
|
||||
*/
|
||||
bool ndp_require_consent = true;
|
||||
|
||||
/* Start NAN Discovery */
|
||||
wifi_nan_config_t nan_cfg = WIFI_NAN_CONFIG_DEFAULT();
|
||||
|
||||
@@ -112,9 +103,12 @@ void wifi_nan_publish(void)
|
||||
#endif
|
||||
.matching_filter = EXAMPLE_NAN_MATCHING_FILTER,
|
||||
.single_replied_event = 1,
|
||||
/* 0 - All incoming NDP requests will be internally accepted,
|
||||
1 - All incoming NDP requests raise NDP_INDICATION event and require esp_wifi_nan_datapath_resp to accept or reject. */
|
||||
.ndp_resp_needed = 1,
|
||||
};
|
||||
|
||||
pub_id = esp_wifi_nan_publish_service(&publish_cfg, ndp_require_consent);
|
||||
pub_id = esp_wifi_nan_publish_service(&publish_cfg);
|
||||
if (pub_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
@@ -52,9 +52,6 @@ static void nan_receive_event_handler(void *arg, esp_event_base_t event_base,
|
||||
if (evt->ssi_len) {
|
||||
ESP_LOGI(TAG, "Received payload from Peer "MACSTR" [Peer Service id - %d] - ", MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
ESP_LOG_BUFFER_HEXDUMP(TAG, evt->ssi, evt->ssi_len, ESP_LOG_INFO);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Received message '%s' from Peer "MACSTR" [Peer Service id - %d]",
|
||||
evt->peer_svc_info, MAC2STR(evt->peer_if_mac), evt->peer_inst_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user