WiFi Access Point¶
-
group
wifi_ap
Control and monitoring of WiFi access point interface.
- Note
The WiFi access point interface provides a WiFi network access point. Control of WiFi AP including WiFi SSID and password and IP address.
- See
- See
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 Value
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 SSIDpassword
: WiFi AP passwordmode
: WiFi AP modehidden
: True to hide WiFi AP (Default: Visible)channel
: WiFi AP channel (Default: 7)beaconInterval
: WiFi AP beacon interval in milliseconds (Default: 200ms)
- Return Value
bool
: True on success
-
virtual IpAddress
getIP
() const = 0¶ Get WiFi AP IP address.
- Return Value
IpAddress
: WiFi AP IP address
-
virtual bool
setIP
(IpAddress address) = 0¶ Set WiFi AP IP addres.
- Parameters
address
: New IP address for WiFi AP
- Return Value
bool
: True on success
-
virtual MacAddress
getMacAddress
() const = 0¶ Get WiFi AP MAC address.
- Return Value
MacAddress
:
-
String
getMAC
(char sep = '0') const¶ Get WiFi AP MAC address.
- Parameters
sep
: separator between bytes (e.g. ‘:’)
- Return Value
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:- Parameters
addr
: The new MAC address
- Return Value
bool
: true on success
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”
-
virtual IpAddress
getNetworkMask
() const = 0¶ Get WiFi AP network mask.
- Return Value
IpAddress
: WiFi AP network mask
-
virtual IpAddress
getNetworkGateway
() const = 0¶ Get WiFi AP default gateway.
- Return Value
IpAddress
: WiFi AP default gateway
-
virtual IpAddress
getNetworkBroadcast
() const = 0¶ Get WiFi AP broadcast address.
- Return Value
IpAddress
: WiFi AP broadcast address
-
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 Value
bool
: true if address is local
-
virtual void