Skip to content

Commit 783b80f

Browse files
nachiketkukadeakshat
andcommitted
fix(esp_wifi): NAN improvements and bugfixes
- Add NDP Peer inactivity detection and termination support - Add NDP Action frames internal retries - Fix NAN API return status to match with Tx status - Fix false wait events during NAN datapath setup - Replace NAN default event handlers with callbacks to avoid race conditions between wifi and user tasks - Fix parsing Availability of third party devices Closes #17529 Co-authored-by: akshat <[email protected]>
1 parent e8f75f9 commit 783b80f

File tree

3 files changed

+325
-223
lines changed

3 files changed

+325
-223
lines changed

components/esp_wifi/include/esp_private/wifi.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ typedef struct {
3939
void *storage; /**< storage for FreeRTOS queue */
4040
} wifi_static_queue_t;
4141

42+
struct nan_callbacks {
43+
void (* service_match)(uint8_t sub_id, uint8_t pub_id, uint8_t pub_mac[6], uint16_t capab,
44+
uint8_t ssi_ver, uint8_t *ssi, uint16_t ssi_len);
45+
void (* replied)(uint8_t pub_id, uint8_t sub_id, uint8_t pub_mac[6], uint8_t *ssi, uint16_t ssi_len);
46+
void (* receive)(uint8_t svc_id, uint8_t peer_svc_id, uint8_t peer_mac[6], uint8_t *ssi, uint16_t ssi_len);
47+
void (* ndp_indication)(uint8_t pub_id, uint8_t ndp_id, uint8_t peer_nmi[6], uint8_t peer_ndi[6],
48+
uint8_t *ssi, uint16_t ssi_len);
49+
void (* ndp_confirm)(uint8_t status, uint8_t ndp_id, uint8_t peer_nmi[6], uint8_t peer_ndi[6],
50+
uint8_t own_ndi[6], uint8_t *ssi, uint16_t ssi_len);
51+
void (* ndp_terminated)(uint8_t reason, uint8_t ndp_id, uint8_t init_ndi[6]);
52+
void (* action_txdone)(uint32_t context, bool tx_status);
53+
};
54+
4255
/**
4356
* @brief WiFi log level
4457
*
@@ -708,13 +721,14 @@ esp_err_t esp_nan_internal_subscribe_service(const wifi_nan_subscribe_cfg_t *sub
708721
*
709722
* @attention This API should be called after WIFI_EVENT_NAN_SVC_MATCH event is received.
710723
*
711-
* @param fup_params Configuration parameters for sending a Follow-up to the Peer.
724+
* @param[in] fup_params Configuration parameters for sending a Follow-up to the Peer.
725+
* @param[out] context Context returned for Follow-up frame to be matched in Tx done.
712726
*
713727
* @return
714728
* - ESP_OK: succeed
715729
* - others: failed
716730
*/
717-
esp_err_t esp_nan_internal_send_followup(const wifi_nan_followup_params_t *fup_params);
731+
esp_err_t esp_nan_internal_send_followup(const wifi_nan_followup_params_t *fup_params, uint32_t *context);
718732

719733
/**
720734
* @brief Send Datapath Request to the Publisher with matching service
@@ -755,6 +769,19 @@ esp_err_t esp_nan_internal_datapath_resp(wifi_nan_datapath_resp_t *resp);
755769
*/
756770
esp_err_t esp_nan_internal_datapath_end(wifi_nan_datapath_end_req_t *req);
757771

772+
/**
773+
* @brief End NAN Datapath that is active
774+
*
775+
* @attention This API should be called after receiving WIFI_EVENT_NDP_CONFIRM event.
776+
*
777+
* @param req NAN Datapath end request parameters.
778+
*
779+
* @return
780+
* - ESP_OK: succeed
781+
* - others: failed
782+
*/
783+
esp_err_t esp_nan_internal_register_callbacks(struct nan_callbacks *cb);
784+
758785
/**
759786
* @brief Connect WiFi station to the AP.
760787
*

0 commit comments

Comments
 (0)