diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 6196aeecf0..80b8a09f0d 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -100,10 +100,13 @@ typedef enum { WIFI_REASON_UNSPECIFIED = 1, /**< Unspecified reason */ WIFI_REASON_AUTH_EXPIRE = 2, /**< Authentication expired */ WIFI_REASON_AUTH_LEAVE = 3, /**< Deauthentication due to leaving */ - WIFI_REASON_ASSOC_EXPIRE = 4, /**< Association expired */ + WIFI_REASON_ASSOC_EXPIRE = 4, /**< Association expired. Deprecated, will be removed in next IDF major release */ + WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, WIFI_REASON_ASSOC_TOOMANY = 5, /**< Too many associated stations */ - WIFI_REASON_NOT_AUTHED = 6, /**< Not authenticated */ - WIFI_REASON_NOT_ASSOCED = 7, /**< Not associated */ + WIFI_REASON_NOT_AUTHED = 6, /**< Not authenticated. Deprecated, will be removed in next IDF major release */ + WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + WIFI_REASON_NOT_ASSOCED = 7, /**< Not associated. Deprecated, will be removed in next IDF major release */ + WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, WIFI_REASON_ASSOC_LEAVE = 8, /**< Deassociated due to leaving */ WIFI_REASON_ASSOC_NOT_AUTHED = 9, /**< Association but not authenticated */ WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, /**< Disassociated due to poor power capability */ @@ -144,7 +147,6 @@ typedef enum { WIFI_REASON_INVALID_FTE = 51, /**< Invalid FTE */ WIFI_REASON_TRANSMISSION_LINK_ESTABLISH_FAILED = 67, /**< Transmission link establishment failed */ WIFI_REASON_ALTERATIVE_CHANNEL_OCCUPIED = 68, /**< Alternative channel occupied */ - WIFI_REASON_BEACON_TIMEOUT = 200, /**< Beacon timeout */ WIFI_REASON_NO_AP_FOUND = 201, /**< No AP found */ WIFI_REASON_AUTH_FAIL = 202, /**< Authentication failed */ diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c index c526c5a70c..5df4977c83 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c @@ -287,8 +287,8 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code) { switch (reason_code) { case WIFI_REASON_AUTH_EXPIRE: - case WIFI_REASON_NOT_AUTHED: - case WIFI_REASON_NOT_ASSOCED: + case WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: + case WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: case WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT: case WIFI_REASON_INVALID_PMKID: case WIFI_REASON_AUTH_FAIL: diff --git a/docs/en/api-guides/wifi.rst b/docs/en/api-guides/wifi.rst index cbc7120d8b..f81ced3a1a 100644 --- a/docs/en/api-guides/wifi.rst +++ b/docs/en/api-guides/wifi.rst @@ -811,7 +811,7 @@ Association Phase +++++++++++++++++++++ - s3.1: The association request is sent and the association timer is enabled. - - s3.2: If the association response is not received before the association timer times out, `WIFI_EVENT_STA_DISCONNECTED`_ will arise and the reason code will be ``WIFI_REASON_ASSOC_EXPIRE``. Refer to `Wi-Fi Reason Code`_. + - s3.2: If the association response is not received before the association timer times out, `WIFI_EVENT_STA_DISCONNECTED`_ will arise and the reason code will be ``WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY``. Refer to `Wi-Fi Reason Code`_. - s3.3: The association response is received and the association timer is stopped. - s3.4: The AP rejects the association in the response and `WIFI_EVENT_STA_DISCONNECTED`_ arises, while the reason code is the one specified in the association response. Refer to `Wi-Fi Reason Code`_. @@ -876,19 +876,15 @@ Following reason codes are renamed to their shorter form to wrap the table in pa For the ESP station, this reason is reported when: - it is received from the AP. - * - ASSOC_EXPIRE + * - DISASSOC_DUE_TO_INACTIVITY - 4 - Disassociated due to inactivity. For the ESP station, this reason is reported when: + - assoc is timed out. - it is received from the AP. - For the ESP AP, this reason is reported when: - - - the AP has not received any packets from the station in the past five minutes. - - the AP is stopped by calling :cpp:func:`esp_wifi_stop()`. - - the station is de-authed by calling :cpp:func:`esp_wifi_deauth_sta()`. * - ASSOC_TOOMANY - 5 - Disassociated, because the AP is unable to handle all currently associated STAs at the same time. @@ -900,7 +896,7 @@ Following reason codes are renamed to their shorter form to wrap the table in pa For the ESP AP, this reason is reported when: - the stations associated with the AP reach the maximum number that the AP can support. - * - NOT_AUTHED + * - CLASS2_FRAME_FROM_NONAUTH_STA - 6 - Class-2 frame received from a non-authenticated STA. @@ -911,7 +907,7 @@ Following reason codes are renamed to their shorter form to wrap the table in pa For the ESP AP, this reason is reported when: - the AP receives a packet with data from a non-authenticated station. - * - NOT_ASSOCED + * - CLASS3_FRAME_FROM_NONASSOC_STA - 7 - Class-3 frame received from a non-associated STA. @@ -1138,7 +1134,7 @@ Following reason codes are renamed to their shorter form to wrap the table in pa - Espressif-specific Wi-Fi reason code: the authentication fails, but not because of a timeout. * - ASSOC_FAIL - 203 - - Espressif-specific Wi-Fi reason code: the association fails, but not because of ASSOC_EXPIRE or ASSOC_TOOMANY. + - Espressif-specific Wi-Fi reason code: the association fails, but not because of DISASSOC_DUE_TO_INACTIVITY or ASSOC_TOOMANY. * - HANDSHAKE_TIMEOUT - 204 - Espressif-specific Wi-Fi reason code: the handshake fails for the same reason as that in WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT. diff --git a/docs/zh_CN/api-guides/wifi.rst b/docs/zh_CN/api-guides/wifi.rst index 9d81a2293d..28146032a7 100644 --- a/docs/zh_CN/api-guides/wifi.rst +++ b/docs/zh_CN/api-guides/wifi.rst @@ -807,7 +807,7 @@ Wi-Fi 驱动程序内部扫描阶段 +++++++++++++++++++++ - s3.1:发送关联请求并使能关联计时器。 - - s3.2:如果在关联计时器超时之前未接收到关联响应,将产生 `WIFI_EVENT_STA_DISCONNECTED`_ 事件,且原因代码为 ``WIFI_REASON_ASSOC_EXPIRE``。请参阅 `Wi-Fi 原因代码`_。 + - s3.2:如果在关联计时器超时之前未接收到关联响应,将产生 `WIFI_EVENT_STA_DISCONNECTED`_ 事件,且原因代码为 ``WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY``。请参阅 `Wi-Fi 原因代码`_。 - s3.3:接收到关联响应,且关联计时器终止。 - s3.4:AP 在响应中拒绝关联且产生 `WIFI_EVENT_STA_DISCONNECTED`_ 事件,原因代码将在关联响应中指定。请参阅 `Wi-Fi 原因代码`_。 @@ -864,7 +864,7 @@ Wi-Fi 原因代码 对于 ESP station,出现以下情况时报告该代码: - 从 AP 接收到该代码。 - * - ASSOC_EXPIRE + * - DISASSOC_DUE_TO_INACTIVITY - 4 - 4 - 因为 AP 不活跃,association 取消。 @@ -890,7 +890,7 @@ Wi-Fi 原因代码 对于 ESP AP,出现以下情况时将报告该代码: - 与 AP 相关联的 station 数量已到达 AP 可支持的最大值。 - * - NOT_AUTHED + * - CLASS2_FRAME_FROM_NONAUTH_STA - 6 - 6 - 从一个未认证 station 接收到 class-2 frame。 @@ -902,7 +902,7 @@ Wi-Fi 原因代码 对于 ESP AP,出现以下情况时将报告该代码: - AP 从一个未认证 station 接收到数据包。 - * - NOT_ASSOCED + * - CLASS3_FRAME_FROM_NONASSOC_STA - 7 - 7 - 从一个未关联 station 接收到的 class-3 frame。 @@ -1167,7 +1167,7 @@ Wi-Fi 原因代码 * - ASSOC_FAIL - 203 - 保留 - - 乐鑫特有的 Wi-Fi 原因代码: association 失败,但并非由 ASSOC_EXPIRE 或 ASSOC_TOOMANY 引发。 + - 乐鑫特有的 Wi-Fi 原因代码: association 失败,但并非由 DISASSOC_DUE_TO_INACTIVITY 或 ASSOC_TOOMANY 引发。 * - HANDSHAKE_TIMEOUT - 204 - 保留