From 5717f8f2fb4e7d48e1d07a56aa0f1f5d19b5e84f Mon Sep 17 00:00:00 2001 From: zwj Date: Mon, 12 Apr 2021 21:19:03 +0800 Subject: [PATCH] update con state when getting connection cancle complete --- .../bt/host/bluedroid/stack/btm/btm_ble.c | 24 +++++++++++++++++++ .../bluedroid/stack/btm/include/btm_ble_int.h | 1 + .../bt/host/bluedroid/stack/btu/btu_hcif.c | 3 +++ 3 files changed, 28 insertions(+) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble.c b/components/bt/host/bluedroid/stack/btm/btm_ble.c index 3205df4d60..54ffcaa111 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble.c @@ -2076,6 +2076,30 @@ void btm_ble_create_ll_conn_complete (UINT8 status) btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status); } } + +/***************************************************************************** +** Function btm_ble_create_conn_cancel_complete +** +** Description LE connection cancel complete. +** +******************************************************************************/ +void btm_ble_create_conn_cancel_complete (UINT8 *p) +{ + UINT8 status; + + STREAM_TO_UINT8 (status, p); + + switch (status) { + case HCI_SUCCESS: + if (btm_ble_get_conn_st() == BLE_CONN_CANCEL) { + btm_ble_set_conn_st (BLE_CONN_IDLE); + } + break; + default: + break; + } +} + /***************************************************************************** ** Function btm_proc_smp_cback ** diff --git a/components/bt/host/bluedroid/stack/btm/include/btm_ble_int.h b/components/bt/host/bluedroid/stack/btm/include/btm_ble_int.h index e1af9a58df..017eb89223 100644 --- a/components/bt/host/bluedroid/stack/btm/include/btm_ble_int.h +++ b/components/bt/host/bluedroid/stack/btm/include/btm_ble_int.h @@ -413,6 +413,7 @@ tBTM_STATUS btm_ble_start_adv(void); tBTM_STATUS btm_ble_stop_adv(void); tBTM_STATUS btm_ble_start_scan(void); void btm_ble_create_ll_conn_complete (UINT8 status); +void btm_ble_create_conn_cancel_complete (UINT8 *p); /* LE security function from btm_sec.c */ #if SMP_INCLUDED == TRUE diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index 4212ba6cc9..82e786a164 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -1071,6 +1071,9 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l case HCI_BLE_TEST_END: btm_ble_test_command_complete(p); break; + case HCI_BLE_CREATE_CONN_CANCEL: + btm_ble_create_conn_cancel_complete(p); + break; #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) case HCI_BLE_ADD_DEV_RESOLVING_LIST: