WiFi Handler component  1.0
WiFi Handler component for open authenticator.
Macros | Functions
wifi_handler_access_point.h File Reference
#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"
Include dependency graph for wifi_handler_access_point.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIFI_CHANNEL   1
 
#define WIFI_MAX_STA_CONN   1
 
#define WIFI_SCAN_LIST_SIZE   10
 
#define WIFI_STA_CONNECTED_BIT   BIT0
 
#define WIFI_ERR_NOT_CONNECTED
 

Functions

bool is_wifi_station_connected ()
 Tells if any wifi station is connected to wifi access point. More...
 
uint16_t wifi_access_point_list_size ()
 Returns size of the list containing scanned access points available. More...
 
wifi_ap_record_t * scan_wifi_access_point ()
 Scans wifi access points and returns the struct containing the access points found nearby. More...
 
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. More...
 
esp_err_t stop_wifi_access_point ()
 Turns off the access point and turns off wifi. More...
 

Macro Definition Documentation

◆ WIFI_CHANNEL

#define WIFI_CHANNEL   1

◆ WIFI_ERR_NOT_CONNECTED

#define WIFI_ERR_NOT_CONNECTED
Value:
-2

error code if access points is already running and start_wifi_access_point() is called

◆ 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

Function Documentation

◆ 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
ssidstring which contains the name of the ssid of the access point started by esp32
passstring 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