esp_wifi: upload more wifi pkt info in rx callback for espnow & csi

pull/10970/head
Jessy Chen 2022-05-26 03:04:33 -04:00 zatwierdzone przez jack
rodzic 096aa4b84d
commit 6818b3012d
4 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -80,13 +80,23 @@ typedef struct esp_now_peer_num {
int encrypt_num; /**< Number of encrypted ESPNOW peers, maximum value is ESP_NOW_MAX_ENCRYPT_PEER_NUM */
} esp_now_peer_num_t;
/**
* @brief ESPNOW packet information
*/
typedef struct esp_now_recv_info {
uint8_t * src_addr; /**< Source address of ESPNOW packet */
uint8_t * des_addr; /**< Destination address of ESPNOW packet */
wifi_pkt_rx_ctrl_t * rx_ctrl; /**< Rx control info of ESPNOW packet */
} esp_now_recv_info_t;
/**
* @brief Callback function of receiving ESPNOW data
* @param mac_addr peer MAC address
* @param esp_now_info received ESPNOW packet information
* @param data received data
* @param data_len length of received data
* @attention esp_now_info is a local variableit can only be used in the callback.
*/
typedef void (*esp_now_recv_cb_t)(const uint8_t *mac_addr, const uint8_t *data, int data_len);
typedef void (*esp_now_recv_cb_t)(const esp_now_recv_info_t * esp_now_info, const uint8_t *data, int data_len);
/**
* @brief Callback function of sending ESPNOW data

Wyświetl plik

@ -489,6 +489,7 @@ typedef struct {
typedef struct {
wifi_pkt_rx_ctrl_t rx_ctrl;/**< received packet radio metadata header of the CSI data */
uint8_t mac[6]; /**< source MAC address of the CSI data */
uint8_t dmac[6]; /**< destination MAC address of the CSI data */
bool first_word_invalid; /**< first four bytes of the CSI data is invalid or not */
int8_t *buf; /**< buffer of CSI data */
uint16_t len; /**< length of CSI data */

@ -1 +1 @@
Subproject commit 2fae5b132437907691d51ac4b3c31227b7b7ab33
Subproject commit 86c783a90479aa6f7b602775ba7fe9c3d97438ee

Wyświetl plik

@ -78,10 +78,11 @@ static void example_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_status_
}
}
static void example_espnow_recv_cb(const uint8_t *mac_addr, const uint8_t *data, int len)
static void example_espnow_recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *data, int len)
{
example_espnow_event_t evt;
example_espnow_event_recv_cb_t *recv_cb = &evt.info.recv_cb;
uint8_t * mac_addr = recv_info->src_addr;
if (mac_addr == NULL || data == NULL || len <= 0) {
ESP_LOGE(TAG, "Receive cb arg error");