WiFi Events Interface

Event callback interface for WiFi events. More...

Collaboration diagram for WiFi Events Interface:

Classes

class  WifiEventsClass
 WiFi events class. More...
 

Macros

#define WIFI_DISCONNECT_REASON_CODES_MAP(XX)
 Common set of reason codes to IEEE 802.11-2007. More...
 

Typedefs

using StationConnectDelegate = Delegate< void(const String &ssid, MacAddress bssid, uint8_t channel)>
 Delegate type for 'station connected' event. More...
 
using StationDisconnectDelegate = Delegate< void(const String &ssid, MacAddress bssid, WifiDisconnectReason reason)>
 Delegate type for 'station disconnected' event. More...
 
using StationAuthModeChangeDelegate = Delegate< void(WifiAuthMode oldMode, WifiAuthMode newMode)>
 Delegate type for 'station authorisation mode changed' event. More...
 
using StationGotIPDelegate = Delegate< void(IpAddress ip, IpAddress netmask, IpAddress gateway)>
 Delegate type for 'station got IP address' event. More...
 
using AccessPointConnectDelegate = Delegate< void(MacAddress mac, uint16_t aid)>
 Delegate type for 'Access Point Connect' event. More...
 
using AccessPointDisconnectDelegate = Delegate< void(MacAddress mac, uint16_t aid)>
 Delegate type for 'Access Point Disconnect' event. More...
 
using AccessPointProbeReqRecvedDelegate = Delegate< void(int rssi, MacAddress mac)>
 Delegate type for 'Access Point Probe Request Received' event. More...
 

Enumerations

enum  WifiDisconnectReason
 Reason codes for WiFi station disconnection. More...
 

Variables

WifiEventsClassWifiEvents
 Global reference to architecture-specific implementation. More...
 

Detailed Description

Event callback interface for WiFi events.

See also
WiFi Station Interface
WiFi Access Point

Macro Definition Documentation

◆ WIFI_DISCONNECT_REASON_CODES_MAP

#define WIFI_DISCONNECT_REASON_CODES_MAP (   XX)
Value:
XX(UNSPECIFIED, 1, "Unspecified") \
XX(AUTH_EXPIRE, 2, "AUTH expired") \
XX(AUTH_LEAVE, 3, "Sending STA is leaving, or has left") \
XX(ASSOC_EXPIRE, 4, "Disassociated: inactivity") \
XX(ASSOC_TOOMANY, 5, "Disassociated: too many clients)") \
XX(NOT_AUTHED, 6, "Class 2 frame received from non-authenticated STA") \
XX(NOT_ASSOCED, 7, "Class 3 frame received from non-authenticated STA") \
XX(ASSOC_LEAVE, 8, "Disassociated: STA is leaving, or has left") \
XX(ASSOC_NOT_AUTHED, 9, "Disassociated: STA not authenticated") \
XX(DISASSOC_PWRCAP_BAD, 10, "Disassociated: power capability unacceptable") \
XX(DISASSOC_SUPCHAN_BAD, 11, "Disassociated: supported channels unacceptable") \
XX(IE_INVALID, 13, "Invalid IE") \
XX(MIC_FAILURE, 14, "Message Integrity failure") \
XX(4WAY_HANDSHAKE_TIMEOUT, 15, "4-way Handshake timeout") \
XX(GROUP_KEY_UPDATE_TIMEOUT, 16, "Group Key Handshake timeout") \
XX(IE_IN_4WAY_DIFFERS, 17, "4-way Handshake Information Differs") \
XX(GROUP_CIPHER_INVALID, 18, "Invalid group cypher") \
XX(PAIRWISE_CIPHER_INVALID, 19, "Invalid pairwise cypher") \
XX(AKMP_INVALID, 20, "Invalid AKMP") \
XX(UNSUPP_RSN_IE_VERSION, 21, "Unsupported RSN IE Version") \
XX(INVALID_RSN_IE_CAP, 22, "Invalid RSN IE capabilities") \
XX(802_1X_AUTH_FAILED, 23, "IEEE 802.1X authentication failed") \
XX(CIPHER_SUITE_REJECTED, 24, "Cipher suite rejected (security policy)") \
XX(BEACON_TIMEOUT, 200, "Beacon Timeout") \
XX(NO_AP_FOUND, 201, "No AP found") \
XX(AUTH_FAIL, 202, "Authentication failure") \
XX(ASSOC_FAIL, 203, "Association failure") \
XX(HANDSHAKE_TIMEOUT, 204, "Handshake timeout") \
XX(CONNECTION_FAIL, 205, "Connection failure")
#define XX(tag, code, desc)
Definition: WifiEvents.h:80

Common set of reason codes to IEEE 802.11-2007.

Note
Codes at 200+ are non-standard, defined by Espressif.

Some acronymns used here - see the full standard for more precise definitions.

  • SSID: Service Set Identifier (the visible name given to an Access Point)
  • BSSID: Basic Service Set Identifier (a MAC address physically identifying the AP)
  • IE: Information Element (standard piece of information carried within WiFi packets)
  • STA: Station (any device which supports WiFi, including APs though the term commonly refers to a client)
  • AP: Access Point (device to which other stations may be associated)
  • RSN: Robust Security Network
  • AUTH: Authentication (how a station proves its identity to another)

Typedef Documentation

◆ AccessPointConnectDelegate

using AccessPointConnectDelegate = Delegate<void(MacAddress mac, uint16_t aid)>

Delegate type for 'Access Point Connect' event.

Parameters
macMAC address of the station
aidAssociation ID representing the connected station
Note
This event occurs every time a station is connected to our Access Point.

◆ AccessPointDisconnectDelegate

using AccessPointDisconnectDelegate = Delegate<void(MacAddress mac, uint16_t aid)>

Delegate type for 'Access Point Disconnect' event.

Parameters
macMAC address of the station
aidAssociation ID assigned to the station
Note
This event occurs every time a station is disconnected from our Access Point.

◆ AccessPointProbeReqRecvedDelegate

Delegate type for 'Access Point Probe Request Received' event.

Parameters
rssiSignal strength
mac
Note
Probe Requests are a low-level management frame which are used to determine information about our Access Point, such as which authentication modes are supported.

◆ StationAuthModeChangeDelegate

Delegate type for 'station authorisation mode changed' event.

Parameters
oldMode
newMode
Note
This event arises when the AP to which the station is connected changes its authentication mode, e.g., from 'no auth' to WPA. Generally, the application event callback does not need to handle this.

◆ StationConnectDelegate

using StationConnectDelegate = Delegate<void(const String& ssid, MacAddress bssid, uint8_t channel)>

Delegate type for 'station connected' event.

Parameters
ssid
bssid
channel
Note
This event occurs when the station successfully connects to the target AP. Upon receiving this event, the DHCP client begins the process of getting an IP address.

◆ StationDisconnectDelegate

using StationDisconnectDelegate = Delegate<void(const String& ssid, MacAddress bssid, WifiDisconnectReason reason)>

Delegate type for 'station disconnected' event.

Parameters
ssidSSID from which we've disconnected
bssid
reasonWhy the connection was dropped
Note
This event can be generated in the following scenarios:
  • When the station is already connected to the AP, and a manual disconnect or re-configuration is taking place. e.g. WifiStation.disconnect()
  • When WifiStation.connect() is called, but the Wi-Fi driver fails to set up a connection with the AP due to certain reasons, e.g. the scan fails to find the target AP, authentication times out, etc. If there are more than one AP with the same SSID, the disconnected event is raised after the station fails to connect all of the found APs.
  • When the Wi-Fi connection is disrupted because of specific reasons, e.g., the station continuously loses N beacons, the AP kicks off the station, the AP's authentication mode is changed, etc.

◆ StationGotIPDelegate

using StationGotIPDelegate = Delegate<void(IpAddress ip, IpAddress netmask, IpAddress gateway)>

Delegate type for 'station got IP address' event.

Parameters
ip
netmask
gateway
Note
This event arises when the DHCP client successfully gets the IPV4 address from the DHCP server, or when the IPV4 address is changed. The IPV4 may be changed because of the following reasons:
  • The DHCP client fails to renew/rebind the IPV4 address, and the station's IPV4 is reset to 0.
  • The DHCP client rebinds to a different address.
  • The static-configured IPV4 address is changed.

Enumeration Type Documentation

◆ WifiDisconnectReason

Reason codes for WiFi station disconnection.

See also
WIFI_DISCONNECT_REASON_CODES_MAP

Variable Documentation

◆ WifiEvents

WifiEventsClass& WifiEvents
extern

Global reference to architecture-specific implementation.