#include <string.h>
#include <stdbool.h>
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_pm.h"
#include "nvs_flash.h"
#include "lwip/err.h"
#include "lwip/sys.h"
Go to the source code of this file.
◆ WIFI_CHANNEL
◆ WIFI_ERR_NOT_CONNECTED
#define WIFI_ERR_NOT_CONNECTED |
◆ WIFI_MAX_STA_CONN
#define WIFI_MAX_STA_CONN 1 |
◆ WIFI_SCAN_LIST_SIZE
#define WIFI_SCAN_LIST_SIZE 10 |
◆ WIFI_STA_CONNECTED_BIT
#define WIFI_STA_CONNECTED_BIT BIT0 |
used in event group, this bit represents connected bit
◆ is_wifi_station_connected()
bool is_wifi_station_connected |
( |
| ) |
|
Tells if any wifi station is connected to wifi access point.
- Returns
- true - If station is connected
-
false - If no station is connected
◆ scan_wifi_access_point()
wifi_ap_record_t* scan_wifi_access_point |
( |
| ) |
|
Scans wifi access points and returns the struct containing the access points found nearby.
- Returns
- wifi_ap_record_t* - Returns NULL if failed, or else returns array containing wifi access point list
◆ start_wifi_access_point()
esp_err_t start_wifi_access_point |
( |
char * |
ssid, |
|
|
char * |
pass |
|
) |
| |
Starts wifi access point so that other devices can connect to esp32 AP. Only one device can be connected to this, can be changed by changing the macro WIFI_MAX_STA_CONN
.
- Parameters
-
ssid | string which contains the name of the ssid of the access point started by esp32 |
pass | string which contains the password of the ssid of the access point started by esp32 |
- Returns
- esp_err_t ESP_OK if access points starts correctly and device connects to access point successfully, WIFI_ERR_ALREADY_RUNNING if access point is already working, WIFI_ERR_NOT_CONNECTED if no device connected to the access point.
◆ stop_wifi_access_point()
esp_err_t stop_wifi_access_point |
( |
| ) |
|
Turns off the access point and turns off wifi.
- Returns
- esp_err_t ESP_OK
◆ wifi_access_point_list_size()
uint16_t wifi_access_point_list_size |
( |
| ) |
|
Returns size of the list containing scanned access points available.
- Returns
- uint16_t - size of list