From 021e17a641e61e3f139717cd755bf6f9b9b9eb12 Mon Sep 17 00:00:00 2001 From: Nitin Arora Date: Wed, 29 Jan 2014 19:18:39 -0800 Subject: [PATCH] Clear background conn list entries during BT power off This clears whitelist entries and resets bgconn device lists Change-Id: I551791d63fa826071c113abd383540838f6c59b2 --- bta/dm/bta_dm_act.c | 3 +++ stack/btm/btm_ble_bgconn.c | 1 + stack/btm/btm_ble_gap.c | 21 +++++++++++++++++++++ stack/include/btm_ble_api.h | 14 ++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c index e65ec2080..8012dfe42 100644 --- a/bta/dm/bta_dm_act.c +++ b/bta/dm/bta_dm_act.c @@ -435,6 +435,9 @@ void bta_dm_disable (tBTA_DM_MSG *p_data) bta_dm_disable_search_and_disc(); bta_dm_cb.disabling = TRUE; +#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE + BTM_BleClearBgConnDev(); +#endif if(BTM_GetNumAclLinks()==0) { diff --git a/stack/btm/btm_ble_bgconn.c b/stack/btm/btm_ble_bgconn.c index 628a5d0fe..5d9981e0c 100644 --- a/stack/btm/btm_ble_bgconn.c +++ b/stack/btm/btm_ble_bgconn.c @@ -224,6 +224,7 @@ void btm_ble_clear_white_list (void) { BTM_TRACE_EVENT ("btm_ble_clear_white_list"); btsnd_hcic_ble_clear_white_list(); + memset(&btm_cb.ble_ctr_cb.bg_dev_list, 0, (sizeof(tBTM_LE_BG_CONN_DEV)*BTM_BLE_MAX_BG_CONN_DEV_NUM)); } /******************************************************************************* diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c index 496f57eef..0a158bfd6 100644 --- a/stack/btm/btm_ble_gap.c +++ b/stack/btm/btm_ble_gap.c @@ -39,6 +39,7 @@ #include "vendor_ble.h" #endif #include "gattdefs.h" +#include "gatt_int.h" #include "btm_ble_int.h" @@ -703,6 +704,26 @@ BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type, /******************************************************************************* ** +** Function BTM_BleClearBgConnDev +** +** Description This function is called to clear the whitelist, +** end any pending whitelist connections, +* and reset the local bg device list. +** +** Parameters void +** +** Returns void +** +*******************************************************************************/ +void BTM_BleClearBgConnDev(void) +{ + btm_ble_start_auto_conn(FALSE); + btm_ble_clear_white_list(); + gatt_reset_bgdev_list(); +} + +/******************************************************************************* +** ** Function BTM_BleUpdateBgConnDev ** ** Description This function is called to add or remove a device into/from diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h index 5f99c33e7..1554b41b1 100644 --- a/stack/include/btm_ble_api.h +++ b/stack/include/btm_ble_api.h @@ -771,6 +771,20 @@ BTM_API extern BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type, *******************************************************************************/ BTM_API extern BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda); +/******************************************************************************* +** +** Function BTM_BleClearBgConnDev +** +** Description This function is called to clear the whitelist, +** end any pending whitelist connections, +* and reset the local bg device list. +** +** Parameters void +** +** Returns void +** +*******************************************************************************/ +BTM_API extern void BTM_BleClearBgConnDev(void); /******************************************************** ** -- 2.11.0