WiFi Access Point
- group wifi_ap
Control and monitoring of WiFi access point interface.
- Todo:
How is wifi access point dhcp controlled?
See also
See also
Note
The WiFi access point interface provides a WiFi network access point. Control of WiFi AP including WiFi SSID and password and IP address.
Variables
-
AccessPointClass &WifiAccessPoint
Global instance of WiFi access point object.
Note
Use WifiAccessPoint.function to access WiFi access point functions
Note
Example:
if(WifiAccessPoint.config("ESP_AP", AUTH_OPEN)) WifiAccessPoint.enable(true);
-
class AccessPointClass
- #include <AccessPoint.h>
Access point class.
Public Functions
-
virtual void enable(bool enabled, bool save = false) = 0
Enable or disable WiFi AP.
- Parameters:
enabled – True to enable AP. False to disable.
save – True to save operational mode to flash, False to set current operational mode only
-
virtual bool isEnabled() const = 0
Get WiFi AP enable status.
- Return values:
bool – True if WiFi AP enabled.
-
virtual bool config(const String &ssid, String password, WifiAuthMode mode, bool hidden = false, int channel = 7, int beaconInterval = 200) = 0
Configure WiFi AP.
- Parameters:
ssid – WiFi AP SSID
password – WiFi AP password
mode – WiFi AP mode
hidden – True to hide WiFi AP (Default: Visible)
channel – WiFi AP channel (Default: 7)
beaconInterval – WiFi AP beacon interval in milliseconds (Default: 200ms)
- Return values:
bool – True on success
-
virtual IpAddress getIP() const = 0
Get WiFi AP IP address.
- Return values:
IpAddress – WiFi AP IP address
-
virtual bool setIP(IpAddress address) = 0
Set WiFi AP IP address.
- Parameters:
address – New IP address for WiFi AP
- Return values:
bool – True on success
-
virtual MacAddress getMacAddress() const = 0
Get WiFi AP MAC address.
- Return values:
MacAddress –
-
String getMAC(char sep = '\0') const
Get WiFi AP MAC address.
- Parameters:
sep – separator between bytes (e.g. ‘:’)
- Return values:
String – WiFi AP MAC address
-
virtual bool setMacAddress(const MacAddress &addr) const = 0
Set Access Point MAC address.
Must be called from
init()
before activating Access Point. Espressif place certain limitations on MAC addresses:Bit 0 of the first byte of the MAC address can not be 1. For example:
OK: “1a:XX:XX:XX:XX:XX” NOT OK: “15:XX:XX:XX:XX:XX”
- Parameters:
addr – The new MAC address
- Return values:
bool – true on success
-
virtual IpAddress getNetworkMask() const = 0
Get WiFi AP network mask.
- Return values:
IpAddress – WiFi AP network mask
-
virtual IpAddress getNetworkGateway() const = 0
Get WiFi AP default gateway.
- Return values:
IpAddress – WiFi AP default gateway
-
virtual IpAddress getNetworkBroadcast() const = 0
Get WiFi AP broadcast address.
- Return values:
IpAddress – WiFi AP broadcast address
-
inline bool isLocal(IpAddress address)
Determine if the given address is on the same subnet.
Note
Use to prevent external access to services
- Parameters:
address –
- Return values:
bool – true if address is local
-
virtual String getSSID() const = 0
Get WiFi access point SSID.
- Return values:
String – WiFi access point SSID
-
virtual String getPassword() const = 0
Get WiFi access point password.
- Return values:
String – WiFi access point password
-
virtual std::unique_ptr<StationList> getStations() const = 0
Gets a list of stations connected to the access point.
- Return values:
StationList –
-
virtual void enable(bool enabled, bool save = false) = 0