feat(wifi): add wifi channel change event

Closes https://github.com/espressif/esp-idf/issues/12538
This commit is contained in:
zhangyanjiao 2023-11-15 11:44:43 +08:00
parent b914f25b53
commit 40d7cd8b68
4 changed files with 17 additions and 3 deletions

View File

@ -457,6 +457,9 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif # endif
# ifdef ESP_ERR_ESPNOW_IF # ifdef ESP_ERR_ESPNOW_IF
ERR_TBL_IT(ESP_ERR_ESPNOW_IF), /* 12396 0x306c Interface error */ ERR_TBL_IT(ESP_ERR_ESPNOW_IF), /* 12396 0x306c Interface error */
# endif
# ifdef ESP_ERR_ESPNOW_CHAN
ERR_TBL_IT(ESP_ERR_ESPNOW_CHAN), /* 12397 0x306d Channel error */
# endif # endif
// components/wpa_supplicant/esp_supplicant/include/esp_dpp.h // components/wpa_supplicant/esp_supplicant/include/esp_dpp.h
# ifdef ESP_ERR_DPP_FAILURE # ifdef ESP_ERR_DPP_FAILURE

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -41,6 +41,7 @@ extern "C" {
#define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 6) /*!< Internal error */ #define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 6) /*!< Internal error */
#define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 7) /*!< ESPNOW peer has existed */ #define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 7) /*!< ESPNOW peer has existed */
#define ESP_ERR_ESPNOW_IF (ESP_ERR_ESPNOW_BASE + 8) /*!< Interface error */ #define ESP_ERR_ESPNOW_IF (ESP_ERR_ESPNOW_BASE + 8) /*!< Interface error */
#define ESP_ERR_ESPNOW_CHAN (ESP_ERR_ESPNOW_BASE + 9) /*!< Channel error */
#define ESP_NOW_ETH_ALEN 6 /*!< Length of ESPNOW peer MAC address */ #define ESP_NOW_ETH_ALEN 6 /*!< Length of ESPNOW peer MAC address */
#define ESP_NOW_KEY_LEN 16 /*!< Length of ESPNOW peer local master key */ #define ESP_NOW_KEY_LEN 16 /*!< Length of ESPNOW peer local master key */
@ -205,7 +206,8 @@ esp_err_t esp_now_unregister_send_cb(void);
* - ESP_ERR_ESPNOW_INTERNAL : internal error * - ESP_ERR_ESPNOW_INTERNAL : internal error
* - ESP_ERR_ESPNOW_NO_MEM : out of memory, when this happens, you can delay a while before sending the next data * - ESP_ERR_ESPNOW_NO_MEM : out of memory, when this happens, you can delay a while before sending the next data
* - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found * - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
* - ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer * - ESP_ERR_ESPNOW_IF : current Wi-Fi interface doesn't match that of peer
* - ESP_ERR_ESPNOW_CHAN: current Wi-Fi channel doesn't match that of peer
*/ */
esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len); esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len);

View File

@ -903,6 +903,7 @@ typedef enum {
WIFI_EVENT_NDP_INDICATION, /**< Received NDP Request from a NAN Peer */ WIFI_EVENT_NDP_INDICATION, /**< Received NDP Request from a NAN Peer */
WIFI_EVENT_NDP_CONFIRM, /**< NDP Confirm Indication */ WIFI_EVENT_NDP_CONFIRM, /**< NDP Confirm Indication */
WIFI_EVENT_NDP_TERMINATED, /**< NAN Datapath terminated indication */ WIFI_EVENT_NDP_TERMINATED, /**< NAN Datapath terminated indication */
WIFI_EVENT_HOME_CHANNEL_CHANGE, /**< WiFi home channel changedoesn't occur when scanning */
WIFI_EVENT_MAX, /**< Invalid WiFi event ID */ WIFI_EVENT_MAX, /**< Invalid WiFi event ID */
} wifi_event_t; } wifi_event_t;
@ -995,6 +996,14 @@ typedef struct {
int32_t rssi; /**< RSSI value of bss */ int32_t rssi; /**< RSSI value of bss */
} wifi_event_bss_rssi_low_t; } wifi_event_bss_rssi_low_t;
/** Argument structure for WIFI_EVENT_HOME_CHANNEL_CHANGE event */
typedef struct {
uint8_t old_chan; /**< old home channel of the device */
wifi_second_chan_t old_snd; /**< old second channel of the device */
uint8_t new_chan; /**< new home channel of the device */
wifi_second_chan_t new_snd; /**< new second channel of the device */
} wifi_event_home_channel_change_t;
/** /**
* @brief FTM operation status types * @brief FTM operation status types
* *

@ -1 +1 @@
Subproject commit ac919987dae823fe86cc9b325f8455bf60d9345a Subproject commit eb14a403c863d7f2161b92efb45bbb82d0008b02