2.10.2. esp_wifi_station
— Espressif WiFi Station¶
This module is a wrapper for the Espressif WiFi station interface.
Source code: src/drivers/esp_wifi/station.h, src/drivers/esp_wifi/station.c
Test code: tst/drivers/esp_wifi/station/main.c
Enums
-
enum
esp_wifi_station_status_t
¶ WiFi station connection status.
Values:
-
esp_wifi_station_status_idle_t
= 0¶
-
esp_wifi_station_status_connecting_t
¶
-
esp_wifi_station_status_wrong_password_t
¶
-
esp_wifi_station_status_no_ap_found_t
¶
-
esp_wifi_station_status_connect_fail_t
¶
-
esp_wifi_station_status_got_ip_t
¶
-
Functions
-
int
esp_wifi_station_init
(const char *ssid_p, const char *password_p, struct inet_if_ip_info_t *info_p)¶ Initialize the WiFi station.
- Return
- zero(0) or negative error code.
- Parameters
ssid_p
-WiFi SSID to connect to.
password_p
-WiFi password.
info_p
-Static ip configration or NULL to use DHCP.
-
int
esp_wifi_station_connect
(void)¶ Connect the WiFi station to the Access Point (AP).
- Return
- zero(0) or negative error code.
-
int
esp_wifi_station_disconnect
(void)¶ Disconnect the WiFi station from the AP.
- Return
- zero(0) or negative error code.
-
int
esp_wifi_station_set_ip_info
(const struct inet_if_ip_info_t *info_p)¶ Set the ip address, netmask and gateway of the WiFi station.
- Return
- zero(0) or negative error code.
-
int
esp_wifi_station_get_ip_info
(struct inet_if_ip_info_t *info_p)¶ Get the station ip address, netmask and gateway.
- Return
- zero(0) or negative error code.
-
int
esp_wifi_station_set_reconnect_policy
(int policy)¶ Set whether the station will reconnect to the AP after disconnection. It will do so by default.
- Return
- zero(0) or negative error code.
- Parameters
policy
-If it’s true, it will enable reconnection; if it’s false, it will disable reconnection.
-
int
esp_wifi_station_get_reconnect_policy
(void)¶ Check whether the station will reconnect to the AP after disconnection.
- Return
- true(1) or false(0).
-
enum esp_wifi_station_status_t esp_wifi_station_get_connect_status(void)
Get the connection status of the WiFi station.
- Return
- The connection status.
-
int
esp_wifi_station_dhcp_client_start
(void)¶ Enable the station DHCP client.
- Return
- zero(0) or negative error code.
-
int
esp_wifi_station_dhcp_client_stop
(void)¶ Disable the station DHCP client.
- Return
- zero(0) or negative error code.
-
enum esp_wifi_dhcp_status_t esp_wifi_station_dhcp_client_status(void)
Get the station DHCP client status.
- Return
- Station DHCP client status.