mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_wifi: Modify ESP_IF_WIFI_AP to WIFI_IF_AP
This commit is contained in:
parent
4c68212c8f
commit
041ad04fdd
@ -238,7 +238,7 @@ static void send_ds2ds_packet(void)
|
||||
|
||||
// send packet 20 times to make sure receiver will get this packet
|
||||
for (uint16_t i = 0; i < 20; i++) {
|
||||
esp_wifi_80211_tx(ESP_IF_WIFI_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true);
|
||||
esp_wifi_80211_tx(WIFI_IF_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true);
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
}
|
||||
stop_wifi();
|
||||
@ -300,7 +300,7 @@ static void test_wifi_connection_softap(void)
|
||||
|
||||
start_wifi_as_softap();
|
||||
|
||||
TEST_ESP_OK(esp_wifi_get_mac(ESP_IF_WIFI_AP, mac));
|
||||
TEST_ESP_OK(esp_wifi_get_mac(WIFI_IF_AP, mac));
|
||||
sprintf(mac_str, MACSTR, MAC2STR(mac));
|
||||
|
||||
unity_send_signal_param("SoftAP mac", mac_str);
|
||||
|
@ -329,7 +329,7 @@ static u8_t *add_offer_options(u8_t *optptr)
|
||||
//bzero(&if_ip, sizeof(struct ip_info));
|
||||
memset(&if_ip , 0x00, sizeof(tcpip_adapter_ip_info_t));
|
||||
|
||||
tcpip_adapter_get_ip_info(ESP_IF_WIFI_AP, &if_ip);
|
||||
tcpip_adapter_get_ip_info(WIFI_IF_AP, &if_ip);
|
||||
|
||||
if (!ip4_addr_isany_val(if_ip.gw)) {
|
||||
*optptr++ = DHCP_OPTION_ROUTER;
|
||||
|
@ -84,4 +84,4 @@ void dhcp_ip_addr_erase(void *netif)
|
||||
nvs_close(nvs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +122,9 @@ static void handle_ap_start(void *arg, esp_event_base_t base, int32_t event_id,
|
||||
tcpip_adapter_ip_info_t ap_ip;
|
||||
uint8_t ap_mac[6];
|
||||
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, (wifi_rxcb_t)tcpip_adapter_ap_input), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(WIFI_IF_AP, (wifi_rxcb_t)tcpip_adapter_ap_input), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_netstack_buf_cb",esp_wifi_internal_reg_netstack_buf_cb(esp_netif_netstack_buf_ref, esp_netif_netstack_buf_free), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_mac_get", esp_wifi_get_mac(ESP_IF_WIFI_AP, ap_mac), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_mac_get", esp_wifi_get_mac(WIFI_IF_AP, ap_mac), ESP_OK);
|
||||
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ap_ip);
|
||||
tcpip_adapter_ap_start(ap_mac, &ap_ip);
|
||||
@ -132,7 +132,7 @@ static void handle_ap_start(void *arg, esp_event_base_t base, int32_t event_id,
|
||||
|
||||
static void handle_ap_stop(void *arg, esp_event_base_t base, int32_t event_id, void *data)
|
||||
{
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, NULL), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL), ESP_OK);
|
||||
|
||||
tcpip_adapter_stop(TCPIP_ADAPTER_IF_AP);
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_dhcp_option_mode_t opt_op, tc
|
||||
|
||||
if (poll->enable) {
|
||||
memset(&info, 0x00, sizeof(tcpip_adapter_ip_info_t));
|
||||
tcpip_adapter_get_ip_info(ESP_IF_WIFI_AP, &info);
|
||||
tcpip_adapter_get_ip_info(WIFI_IF_AP, &info);
|
||||
softap_ip = htonl(info.ip.addr);
|
||||
start_ip = htonl(poll->start_ip.addr);
|
||||
end_ip = htonl(poll->end_ip.addr);
|
||||
@ -874,7 +874,7 @@ esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if)
|
||||
|
||||
if (p_netif != NULL && netif_is_up(p_netif)) {
|
||||
tcpip_adapter_ip_info_t default_ip;
|
||||
tcpip_adapter_get_ip_info(ESP_IF_WIFI_AP, &default_ip);
|
||||
tcpip_adapter_get_ip_info(WIFI_IF_AP, &default_ip);
|
||||
dhcps_start(p_netif, default_ip.ip);
|
||||
dhcps_status = TCPIP_ADAPTER_DHCP_STARTED;
|
||||
ESP_LOGD(TAG, "dhcp server start successfully");
|
||||
|
@ -60,7 +60,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass)
|
||||
ESP_LOGE(TAG, "Failed to set Wi-Fi mode : %d", err);
|
||||
return err;
|
||||
}
|
||||
err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config);
|
||||
err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set Wi-Fi config : %d", err);
|
||||
return err;
|
||||
|
@ -240,7 +240,7 @@ static bool wifi_cmd_ap_set(const char *ssid, const char *pass)
|
||||
}
|
||||
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ static void eth2wifi_flow_control_task(void *args)
|
||||
do {
|
||||
vTaskDelay(pdMS_TO_TICKS(timeout));
|
||||
timeout += 2;
|
||||
res = esp_wifi_internal_tx(ESP_IF_WIFI_AP, msg.packet, msg.length);
|
||||
res = esp_wifi_internal_tx(WIFI_IF_AP, msg.packet, msg.length);
|
||||
} while (res && timeout < FLOW_CONTROL_WIFI_SEND_TIMEOUT_MS);
|
||||
if (res != ESP_OK) {
|
||||
ESP_LOGE(TAG, "WiFi send packet failed: %d", res);
|
||||
@ -129,12 +129,12 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base,
|
||||
case WIFI_EVENT_AP_STACONNECTED:
|
||||
ESP_LOGI(TAG, "Wi-Fi AP got a station connected");
|
||||
s_sta_is_connected = true;
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, pkt_wifi2eth);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_AP, pkt_wifi2eth);
|
||||
break;
|
||||
case WIFI_EVENT_AP_STADISCONNECTED:
|
||||
ESP_LOGI(TAG, "Wi-Fi AP got a station disconnected");
|
||||
s_sta_is_connected = false;
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, NULL);
|
||||
esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -214,7 +214,7 @@ static void initialize_wifi(void)
|
||||
wifi_config.ap.authmode = WIFI_AUTH_OPEN;
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
static esp_err_t initialize_flow_control(void)
|
||||
|
@ -318,7 +318,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass)
|
||||
ESP_LOGE(TAG, "Failed to set WiFi mode : %d", err);
|
||||
return err;
|
||||
}
|
||||
err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config);
|
||||
err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set WiFi config : %d", err);
|
||||
return err;
|
||||
|
@ -304,7 +304,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass)
|
||||
ESP_LOGE(TAG, "Failed to set WiFi mode : %d", err);
|
||||
return err;
|
||||
}
|
||||
err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config);
|
||||
err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set WiFi config : %d", err);
|
||||
return err;
|
||||
|
@ -69,7 +69,7 @@ void wifi_init_softap()
|
||||
}
|
||||
|
||||
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_LOGI(TAG, "wifi_init_softap finished. SSID:%s password:%s channel:%d",
|
||||
|
@ -220,7 +220,7 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass)
|
||||
}
|
||||
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user