mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
fix(esp_wifi): remove esp_interface.h and update usages
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ESP_INTERFACE_H__
|
||||
#define __ESP_INTERFACE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ESP_IF_WIFI_STA = 0, /**< Station interface */
|
||||
ESP_IF_WIFI_AP, /**< Soft-AP interface */
|
||||
ESP_IF_WIFI_NAN, /**< NAN interface */
|
||||
ESP_IF_ETH, /**< Ethernet interface */
|
||||
ESP_IF_MAX
|
||||
} esp_interface_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __ESP_INTERFACE_TYPES_H__ */
|
@@ -139,7 +139,7 @@ static void register_mgmt_frames(struct wpa_supplicant *wpa_s)
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
/* register auth/assoc frames if FT is enabled */
|
||||
if (esp_wifi_is_ft_enabled_internal(ESP_IF_WIFI_STA))
|
||||
if (esp_wifi_is_ft_enabled_internal(WIFI_IF_STA))
|
||||
wpa_s->type |= (1 << WLAN_FC_STYPE_AUTH) |
|
||||
(1 << WLAN_FC_STYPE_ASSOC_RESP) |
|
||||
(1 << WLAN_FC_STYPE_REASSOC_RESP);
|
||||
|
@@ -174,7 +174,7 @@ static inline int wpa_auth_set_key(struct wpa_authenticator *wpa_auth,
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
ret = esp_wifi_set_igtk_internal(ESP_IF_WIFI_AP, igtk);
|
||||
ret = esp_wifi_set_igtk_internal(WIFI_IF_AP, igtk);
|
||||
os_free(igtk);
|
||||
return ret;
|
||||
|
||||
|
@@ -331,7 +331,7 @@ Modem-sleep Mode Configuration
|
||||
},
|
||||
};
|
||||
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_set_config(WIFI_IF_STA, &wifi_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
|
||||
- Recommended Configuration
|
||||
|
@@ -331,7 +331,7 @@ Modem-sleep 模式配置
|
||||
},
|
||||
};
|
||||
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_set_config(WIFI_IF_STA, &wifi_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
|
||||
- 推荐配置
|
||||
|
@@ -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
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ static esp_err_t wired_recv_callback(void *buffer, uint16_t len, void *ctx)
|
||||
{
|
||||
if (s_wifi_is_connected) {
|
||||
mac_spoof(FROM_WIRED, buffer, len, s_sta_mac);
|
||||
if (esp_wifi_internal_tx(ESP_IF_WIFI_STA, buffer, len) != ESP_OK) {
|
||||
if (esp_wifi_internal_tx(WIFI_IF_STA, buffer, len) != ESP_OK) {
|
||||
ESP_LOGD(TAG, "Failed to send packet to WiFi!");
|
||||
}
|
||||
}
|
||||
@@ -68,14 +68,14 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
ESP_LOGI(TAG, "Wi-Fi STA disconnected");
|
||||
s_wifi_is_connected = false;
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, NULL);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_STA, NULL);
|
||||
esp_wifi_connect();
|
||||
|
||||
xEventGroupClearBits(s_event_flags, CONNECTED_BIT);
|
||||
xEventGroupSetBits(s_event_flags, DISCONNECTED_BIT);
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED) {
|
||||
ESP_LOGI(TAG, "Wi-Fi STA connected");
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, wifi_recv_callback);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_STA, wifi_recv_callback);
|
||||
s_wifi_is_connected = true;
|
||||
xEventGroupClearBits(s_event_flags, DISCONNECTED_BIT);
|
||||
xEventGroupSetBits(s_event_flags, CONNECTED_BIT);
|
||||
|
@@ -31,7 +31,7 @@ static esp_err_t usb_recv_callback(void *buffer, uint16_t len, void *ctx)
|
||||
{
|
||||
bool *is_wifi_connected = ctx;
|
||||
if (*is_wifi_connected) {
|
||||
esp_wifi_internal_tx(ESP_IF_WIFI_STA, buffer, len);
|
||||
esp_wifi_internal_tx(WIFI_IF_STA, buffer, len);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -57,11 +57,11 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base,
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
ESP_LOGI(TAG, "WiFi STA disconnected");
|
||||
*is_connected = false;
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, NULL);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_STA, NULL);
|
||||
esp_wifi_connect();
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED) {
|
||||
ESP_LOGI(TAG, "WiFi STA connected");
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, pkt_wifi2usb);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_STA, pkt_wifi2usb);
|
||||
*is_connected = true;
|
||||
}
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ static void wifi_init_softap(void)
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
|
||||
esp_netif_ip_info_t ip_info;
|
||||
|
@@ -13,10 +13,10 @@
|
||||
/* ESPNOW can work in both station and softap mode. It is configured in menuconfig. */
|
||||
#if CONFIG_ESPNOW_WIFI_MODE_STATION
|
||||
#define ESPNOW_WIFI_MODE WIFI_MODE_STA
|
||||
#define ESPNOW_WIFI_IF ESP_IF_WIFI_STA
|
||||
#define ESPNOW_WIFI_IF WIFI_IF_STA
|
||||
#else
|
||||
#define ESPNOW_WIFI_MODE WIFI_MODE_AP
|
||||
#define ESPNOW_WIFI_IF ESP_IF_WIFI_AP
|
||||
#define ESPNOW_WIFI_IF WIFI_IF_AP
|
||||
#endif
|
||||
|
||||
#define ESPNOW_QUEUE_SIZE 6
|
||||
|
@@ -302,7 +302,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass)
|
||||
if (pass) {
|
||||
strlcpy((char *) wifi_config.sta.password, pass, sizeof(wifi_config.sta.password));
|
||||
}
|
||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
||||
s_reconnect = true;
|
||||
s_retry_num = 0;
|
||||
@@ -436,27 +436,27 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
|
||||
if (bw == 40) {
|
||||
proto.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
|
||||
proto.ghz_5g = 0;
|
||||
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
|
||||
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
|
||||
bws.ghz_2g = WIFI_BW_HT40;
|
||||
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
|
||||
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
|
||||
} else {
|
||||
bws.ghz_2g = WIFI_BW_HT20;
|
||||
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
|
||||
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
|
||||
}
|
||||
} else {
|
||||
#if CONFIG_SOC_WIFI_SUPPORT_5G
|
||||
if (bw == 40) {
|
||||
proto.ghz_2g = 0;
|
||||
proto.ghz_5g = WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11A;
|
||||
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
|
||||
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
|
||||
bws.ghz_5g=WIFI_BW_HT40;
|
||||
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
|
||||
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
|
||||
} else {
|
||||
proto.ghz_2g = 0;
|
||||
proto.ghz_5g = WIFI_PROTOCOL_11AC | WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11AX;
|
||||
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
|
||||
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
|
||||
bws.ghz_5g = WIFI_BW_HT20;
|
||||
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
|
||||
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -464,7 +464,7 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
|
||||
g_ap_config.ap.authmode = WIFI_AUTH_OPEN;
|
||||
}
|
||||
g_ap_config.ap.channel = channel;
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &g_ap_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &g_ap_config));
|
||||
ESP_LOGI(TAG_AP, "Starting SoftAP with FTM Responder support, SSID - %s, Password - %s, Primary Channel - %d, Bandwidth - %dMHz",
|
||||
ap_args.ssid->sval[0], ap_args.password->sval[0], channel, bw);
|
||||
|
||||
@@ -667,7 +667,7 @@ ftm_responder:
|
||||
return 0;
|
||||
}
|
||||
g_ap_config.ap.ftm_responder = true;
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &g_ap_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &g_ap_config));
|
||||
ESP_LOGI(TAG_AP, "Re-starting SoftAP with FTM Responder enabled");
|
||||
|
||||
return 0;
|
||||
@@ -679,7 +679,7 @@ ftm_responder:
|
||||
return 0;
|
||||
}
|
||||
g_ap_config.ap.ftm_responder = false;
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &g_ap_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &g_ap_config));
|
||||
ESP_LOGI(TAG_AP, "Re-starting SoftAP with FTM Responder disabled");
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
||||
wifi_event_dpp_config_received_t *config = event_data;
|
||||
memcpy(&s_dpp_wifi_config, &config->wifi_cfg, sizeof(s_dpp_wifi_config));
|
||||
s_retry_num = 0;
|
||||
esp_wifi_set_config(ESP_IF_WIFI_STA, &s_dpp_wifi_config);
|
||||
esp_wifi_set_config(WIFI_IF_STA, &s_dpp_wifi_config);
|
||||
esp_wifi_connect();
|
||||
break;
|
||||
case WIFI_EVENT_DPP_FAILED:
|
||||
|
Reference in New Issue
Block a user