From 7c18dde8d7d8edd05087330347a84c5e43bd29e3 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Mon, 28 Apr 2025 13:03:21 +0530 Subject: [PATCH] fix(nimble): Added option to stack to handle repeat pairing internally --- nimble/host/src/ble_gap.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 1bbca410b..3f5db28a4 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -8512,14 +8512,23 @@ int ble_gap_repeat_pairing_event(const struct ble_gap_repeat_pairing *rp) { #if NIMBLE_BLE_SM && NIMBLE_BLE_CONNECT - struct ble_gap_event event; - int rc; + int rc; +#if MYNEWT_VAL(BLE_HANDLE_REPEAT_PAIRING_DELETION) + /* Delete pairing internally instead of expecting host to do so */ + struct ble_gap_conn_desc desc; + rc = ble_gap_conn_find(rp->conn_handle, &desc); + assert(rc == 0); + ble_store_util_delete_peer(&desc.peer_id_addr); + return BLE_GAP_REPEAT_PAIRING_RETRY; +#else + struct ble_gap_event event; memset(&event, 0, sizeof event); event.type = BLE_GAP_EVENT_REPEAT_PAIRING; event.repeat_pairing = *rp; rc = ble_gap_call_conn_event_cb(&event, rp->conn_handle); return rc; +#endif #else return 0; #endif