Access point
- group LWESP_AP
Access point.
Functions to manage access point (AP) on ESP device.
In order to be able to use AP feature, LWESP_CFG_MODE_ACCESS_POINT must be enabled.
Functions
-
lwespr_t lwesp_ap_getip(lwesp_ip_t *ip, lwesp_ip_t *gw, lwesp_ip_t *nm, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Get IP of access point.
- Parameters
ip – [out] Pointer to variable to write IP address
gw – [out] Pointer to variable to write gateway address
nm – [out] Pointer to variable to write netmask address
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_setip(const lwesp_ip_t *ip, const lwesp_ip_t *gw, const lwesp_ip_t *nm, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Set IP of access point.
Configuration changes will be saved in the NVS area of ESP device.
- Parameters
ip – [in] Pointer to IP address
gw – [in] Pointer to gateway address. Set to
NULL
to use default gatewaynm – [in] Pointer to netmask address. Set to
NULL
to use default netmaskevt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_getmac(lwesp_mac_t *mac, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Get MAC of access point.
- Parameters
mac – [out] Pointer to output variable to save MAC address
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_setmac(const lwesp_mac_t *mac, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Set MAC of access point.
Configuration changes will be saved in the NVS area of ESP device.
- Parameters
mac – [in] Pointer to variable with MAC address. Memory of at least 6 bytes is required
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_get_config(lwesp_ap_conf_t *ap_conf, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Get configuration of Soft Access Point.
Note
Before you can get configuration access point, ESP device must be in AP mode. Check lwesp_set_wifi_mode for more information
- Parameters
ap_conf – [out] soft access point configuration
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_set_config(const char *ssid, const char *pwd, uint8_t ch, lwesp_ecn_t ecn, uint8_t max_sta, uint8_t hid, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Configure access point.
Configuration changes will be saved in the NVS area of ESP device.
Note
Before you can configure access point, ESP device must be in AP mode. Check lwesp_set_wifi_mode for more information
- Parameters
ssid – [in] SSID name of access point
pwd – [in] Password for network. Either set it to
NULL
or less than64
charactersch – [in] Wifi RF channel
ecn – [in] Encryption type. Valid options are
OPEN
,WPA_PSK
,WPA2_PSK
andWPA_WPA2_PSK
max_sta – [in] Maximal number of stations access point can accept. Valid between 1 and 10 stations
hid – [in] Set to
1
to hide access point from public accessevt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_list_sta(lwesp_sta_t *sta, size_t stal, size_t *staf, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
List stations connected to access point.
- Parameters
sta – [in] Pointer to array of lwesp_sta_t structure to fill with stations
stal – [in] Number of array entries of sta parameter
staf – [out] Number of stations connected to access point
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_ap_disconn_sta(const lwesp_mac_t *mac, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Disconnects connected station from SoftAP access point.
- Parameters
mac – [in] Device MAC address to disconnect. Application may use lwesp_ap_list_sta to obtain list of connected stations to SoftAP. Set to
NULL
to disconnect all stations.evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
struct lwesp_ap_t
- #include <lwesp_types.h>
Access point data structure.
Public Members
-
lwesp_ecn_t ecn
Encryption mode
-
char ssid[LWESP_CFG_MAX_SSID_LENGTH]
Access point name
-
int16_t rssi
Received signal strength indicator
-
lwesp_mac_t mac
MAC physical address
-
uint8_t ch
WiFi channel used on access point
-
uint8_t scan_type
Scan type, 0 = active, 1 = passive
-
uint16_t scan_time_min
Minimum active scan time per channel in units of milliseconds
-
uint16_t scan_time_max
Maximum active scan time per channel in units of milliseconds
-
int16_t freq_offset
Frequency offset
-
int16_t freq_cal
Frequency calibration
-
lwesp_ap_cipher_t pairwise_cipher
Pairwise cipher mode
-
lwesp_ap_cipher_t group_cipher
Group cipher mode
-
uint8_t bgn
Information about 802.11[b|g|n] support
-
uint8_t wps
Status if WPS function is supported
-
lwesp_ecn_t ecn
-
struct lwesp_sta_info_ap_t
- #include <lwesp_types.h>
Access point information on which station is connected to.
Public Members
-
char ssid[LWESP_CFG_MAX_SSID_LENGTH]
Access point name
-
int16_t rssi
RSSI
-
lwesp_mac_t mac
MAC address
-
uint8_t ch
Channel information
-
char ssid[LWESP_CFG_MAX_SSID_LENGTH]
-
struct lwesp_ap_conf_t
- #include <lwesp_types.h>
Soft access point data structure.
Public Members
-
char ssid[LWESP_CFG_MAX_SSID_LENGTH]
Access point name
-
char pwd[LWESP_CFG_MAX_PWD_LENGTH]
Access point password/passphrase
-
uint8_t ch
WiFi channel used on access point
-
lwesp_ecn_t ecn
Encryption mode
-
uint8_t max_cons
Maximum number of stations allowed connected to this AP
broadcast the SSID, 0 — No, 1 — Yes
-
char ssid[LWESP_CFG_MAX_SSID_LENGTH]
-
lwespr_t lwesp_ap_getip(lwesp_ip_t *ip, lwesp_ip_t *gw, lwesp_ip_t *nm, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)