Initate pairing if encryption fails with reason no pin or key missing

This commit is contained in:
Rahul Tank
2024-02-20 12:22:49 +05:30
committed by Abhinav Kudnar
parent 70801626ab
commit 2849671493
+18
View File
@@ -937,6 +937,8 @@ ble_sm_process_result(uint16_t conn_handle, struct ble_sm_result *res,
struct ble_sm_proc *prev;
struct ble_sm_proc *proc;
int rm;
ble_hs_conn_flags_t conn_flags;
struct ble_hs_conn *conn;
rm = 0;
@@ -981,6 +983,22 @@ ble_sm_process_result(uint16_t conn_handle, struct ble_sm_result *res,
break;
}
if (res->app_status == 518 ) {
conn = ble_hs_conn_find(conn_handle);
conn_flags = conn->bhc_flags;
ble_sm_proc_free(proc);
if (conn_flags & BLE_HS_CONN_F_MASTER) {
ble_sm_pair_initiate(conn_handle);
}
else {
ble_sm_slave_initiate(conn_handle);
}
break;
}
if (res->enc_cb) {
BLE_HS_DBG_ASSERT(proc == NULL || rm);
ble_gap_enc_event(conn_handle, res->app_status, res->restore, res->bonded);