Page 1 of 1
[Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Oct 18, 2016 1:12 am
by kolban
One of the WiFi events that we can receive is SYSTEM_EVENT_STA_DISCONNECT which indicates that the ESP32 has been disconnected from an access point when acting as a station. In the corresponding data type (system_event_sta_disconnected_t) there is a field called "reason" that is an 8 bit flag that indicates the reason for the disconnection. What I am looking for is a description of the potential codes that can be returned. Do we have those?
Re: Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Oct 18, 2016 2:23 am
by ESP_igrr
There is an anonymous enum in esp_wifi_types.h with members called WIFI_REASON_xxx. These are disconnect reasons. Will update event structure to use this enum.
'
Re: Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Oct 18, 2016 3:26 am
by kolban
Perfect, exactly what I was looking for. For others who may search, here are the code as they are today from the header file:
Code: Select all
WIFI_REASON_UNSPECIFIED = 1,
WIFI_REASON_AUTH_EXPIRE = 2,
WIFI_REASON_AUTH_LEAVE = 3,
WIFI_REASON_ASSOC_EXPIRE = 4,
WIFI_REASON_ASSOC_TOOMANY = 5,
WIFI_REASON_NOT_AUTHED = 6,
WIFI_REASON_NOT_ASSOCED = 7,
WIFI_REASON_ASSOC_LEAVE = 8,
WIFI_REASON_ASSOC_NOT_AUTHED = 9,
WIFI_REASON_DISASSOC_PWRCAP_BAD = 10,
WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11,
WIFI_REASON_IE_INVALID = 13,
WIFI_REASON_MIC_FAILURE = 14,
WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
WIFI_REASON_IE_IN_4WAY_DIFFERS = 17,
WIFI_REASON_GROUP_CIPHER_INVALID = 18,
WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19,
WIFI_REASON_AKMP_INVALID = 20,
WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21,
WIFI_REASON_INVALID_RSN_IE_CAP = 22,
WIFI_REASON_802_1X_AUTH_FAILED = 23,
WIFI_REASON_CIPHER_SUITE_REJECTED = 24,
WIFI_REASON_BEACON_TIMEOUT = 200,
WIFI_REASON_NO_AP_FOUND = 201,
WIFI_REASON_AUTH_FAIL = 202,
WIFI_REASON_ASSOC_FAIL = 203,
WIFI_REASON_HANDSHAKE_TIMEOUT = 204,
Re: [Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Mon Jul 17, 2017 10:34 pm
by mgleason_3
@ESP_igrr
>>Will update event structure to use this enum
Did you get a chance to do this? It looks like it's still an unnamed enum that can't be accessed.
Re: [Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Mon Nov 05, 2018 2:10 pm
by gunar.kroeger
@ESP_igrr
>>Will update event structure to use this enum
Did you get a chance to do this? It looks like it's still an unnamed enum that can't be accessed.
Re: [Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Nov 06, 2018 1:39 am
by ESP_igrr
It is no longer an anonymous enum; it is typedef'ed wifi_err_reason_t.
Re: [Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Nov 06, 2018 1:32 pm
by gunar.kroeger
From "esp_event_legacy.h":
Code: Select all
typedef struct {
uint8_t ssid[32]; /**< SSID of disconnected AP */
uint8_t ssid_len; /**< SSID length of disconnected AP */
uint8_t bssid[6]; /**< BSSID of disconnected AP */
uint8_t reason; /**< reason of disconnection */
} system_event_sta_disconnected_t;
Is this struct redefined elsewhere?
Re: [Solved] Meaning of reason codes in system_event_sta_disconnected_t?
Posted: Tue Nov 06, 2018 2:26 pm
by ESP_igrr
I think the uint8_t has been kept in the event struct for compatibility reasons, however the reason codes themselves are now part of the typedefed enum. So you can directly assign/compare them (in C) or cast (in C++).