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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[out] ip
: Pointer to variable to write IP address[out] gw
: Pointer to variable to write gateway address[out] nm
: Pointer to variable to write netmask address[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[in] ip
: Pointer to IP address[in] gw
: Pointer to gateway address. Set toNULL
to use default gateway[in] nm
: Pointer to netmask address. Set toNULL
to use default netmask[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[out] mac
: Pointer to output variable to save MAC address[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[in] mac
: Pointer to variable with MAC address. Memory of at least 6 bytes is required[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[out] ap_conf
: soft access point configuration[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[in] ssid
: SSID name of access point[in] pwd
: Password for network. Either set it toNULL
or less than64
characters[in] ch
: Wifi RF channel[in] ecn
: Encryption type. Valid options areOPEN
,WPA_PSK
,WPA2_PSK
andWPA_WPA2_PSK
[in] max_sta
: Maximal number of stations access point can accept. Valid between 1 and 10 stations[in] hid
: Set to1
to hide access point from public access[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[in] sta
: Pointer to array of lwesp_sta_t structure to fill with stations[in] stal
: Number of array entries of sta parameter[out] staf
: Number of stations connected to access point[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
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.
- Return
lwespOK on success, member of lwespr_t enumeration otherwise
- Parameters
[in] mac
: Device MAC address to disconnect. Application may use lwesp_ap_list_sta to obtain list of connected stations to SoftAP.[in] evt_fn
: Callback function called when command has finished. Set toNULL
when not used[in] evt_arg
: Custom argument for event callback function[in] blocking
: Status whether command should be blocking or not
-
struct
lwesp_ap_t
¶ - #include <lwesp_typedefs.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
bgn
¶ Information about 802.11[b|g|n] support
-
lwesp_ecn_t
-
struct
lwesp_sta_info_ap_t
¶ - #include <lwesp_typedefs.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
-
struct
lwesp_ap_conf_t
¶ - #include <lwesp_typedefs.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
-
lwespr_t