From 7f93a8d0b53bfe2cac875b0f0cdb458d8dbe7911 Mon Sep 17 00:00:00 2001 From: shreeyash Date: Thu, 8 Aug 2024 14:39:23 +0530 Subject: [PATCH] fix(nimble): Fixed blesmp getbondlist issue --- nimble/host/src/ble_sm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c index 0fccda908..6ec34f5c9 100644 --- a/nimble/host/src/ble_sm.c +++ b/nimble/host/src/ble_sm.c @@ -1023,6 +1023,14 @@ ble_sm_process_result(uint16_t conn_handle, struct ble_sm_result *res, /* Do not send this event on broken connection */ ble_gap_pairing_complete_event(conn_handle, res->sm_err); } + /* Persist keys if bonding has successfully completed. */ + if (res->app_status == 0 && + rm && + proc->flags & BLE_SM_PROC_F_BONDING) { + + ble_sm_persist_keys(proc); + } + if (res->enc_cb) { BLE_HS_DBG_ASSERT(proc == NULL || rm); ble_gap_enc_event(conn_handle, res->app_status, res->restore, res->bonded); @@ -1034,13 +1042,6 @@ ble_sm_process_result(uint16_t conn_handle, struct ble_sm_result *res, ble_gap_passkey_event(conn_handle, &res->passkey_params); } - /* Persist keys if bonding has successfully completed. */ - if (res->app_status == 0 && - rm && - proc->flags & BLE_SM_PROC_F_BONDING) { - - ble_sm_persist_keys(proc); - } if (rm) { ble_sm_proc_free(proc);