summaryrefslogtreecommitdiffstats
path: root/stack/btm
diff options
context:
space:
mode:
authorSubramanian Srinivasan <subrsrin@codeaurora.org>2015-09-17 15:04:00 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-06 11:27:11 -0700
commit8ac8e8e71dbe1d6c746a61265cd0c2f2533799b1 (patch)
treecf968ace7943015b8dd70bc15c8b05da3e2627a5 /stack/btm
parent432e7c876bceaa319009b22abe86f52f653a5e43 (diff)
downloadandroid_system_bt-8ac8e8e71dbe1d6c746a61265cd0c2f2533799b1.tar.gz
android_system_bt-8ac8e8e71dbe1d6c746a61265cd0c2f2533799b1.tar.bz2
android_system_bt-8ac8e8e71dbe1d6c746a61265cd0c2f2533799b1.zip
Stops all the BLE timers when BT is turned off
Stops all the BLE timers namely the multi advertisement RPA timers, the local RPA timer and the BLE GAP timers when Bluetooth is turned off. Change-Id: If89e83e4581aed2ef3b3bfedff53e30306078383
Diffstat (limited to 'stack/btm')
-rw-r--r--stack/btm/btm_ble_addr.c19
-rw-r--r--stack/btm/btm_ble_gap.c21
-rw-r--r--stack/btm/btm_ble_int.h2
-rw-r--r--stack/btm/btm_ble_multi_adv.c10
4 files changed, 52 insertions, 0 deletions
diff --git a/stack/btm/btm_ble_addr.c b/stack/btm/btm_ble_addr.c
index 86606d331..62e6e847f 100644
--- a/stack/btm/btm_ble_addr.c
+++ b/stack/btm/btm_ble_addr.c
@@ -630,6 +630,25 @@ void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr,
}
#endif
}
+/*******************************************************************************
+**
+** Function btm_ble_stop_local_rpa_timer
+**
+** Description This function stops LE central rpa timer.
+**
+** Returns void
+**
+*******************************************************************************/
+void btm_ble_stop_local_rpa_timer ()
+{
+ tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
+ BTM_TRACE_EVENT ("btm_ble_stop_local_rpa_timer");
+ if(p_cb)
+ {
+ BTM_TRACE_EVENT("stopping timer for local rpa");
+ btu_stop_timer_oneshot(&p_cb->raddr_timer_ent);
+ }
+}
#endif
diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c
index a75745fb2..19ec9e75a 100644
--- a/stack/btm/btm_ble_gap.c
+++ b/stack/btm/btm_ble_gap.c
@@ -3474,5 +3474,26 @@ BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask)
return rt;
}
+/*******************************************************************************
+**
+** Function btm_ble_stop_gap_timers
+**
+** Description This function stops all BLE gap timers.
+**
+** Returns void
+**
+*******************************************************************************/
+void btm_ble_stop_gap_timers(void)
+{
+ tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb;
+ TIMER_LIST_ENT *p_obs_timer = &p_ble_cb->obs_timer_ent;
+ TIMER_LIST_ENT *p_inq_timer = &p_ble_cb->inq_var.inq_timer_ent;
+ TIMER_LIST_ENT *p_fast_adv_timer = &p_ble_cb->inq_var.fast_adv_timer;
+
+ BTM_TRACE_DEBUG("btm_ble_stop_gap_timers");
+ btu_stop_timer(p_obs_timer);
+ btu_stop_timer(p_inq_timer);
+ btu_stop_timer(p_fast_adv_timer);
+}
#endif /* BLE_INCLUDED */
diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h
index f64454828..92412939b 100644
--- a/stack/btm/btm_ble_int.h
+++ b/stack/btm/btm_ble_int.h
@@ -469,6 +469,8 @@ extern void btm_ble_adv_filter_cleanup(void);
extern BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
extern BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
extern BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
+extern void btm_ble_stop_local_rpa_timer(void);
+extern void btm_ble_stop_gap_timers(void);
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
extern void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc);
diff --git a/stack/btm/btm_ble_multi_adv.c b/stack/btm/btm_ble_multi_adv.c
index a54ca6a26..79f59f553 100644
--- a/stack/btm/btm_ble_multi_adv.c
+++ b/stack/btm/btm_ble_multi_adv.c
@@ -878,10 +878,20 @@ void btm_ble_multi_adv_init()
*******************************************************************************/
void btm_ble_multi_adv_cleanup(void)
{
+ UINT8 inst_id;
#ifdef WIPOWER_SUPPORTED
is_wipower_adv = false;
wipower_inst_id = BTM_BLE_MULTI_ADV_DEFAULT_STD;
#endif
+ BTM_TRACE_EVENT("btm_ble_multi_adv_cleanup");
+ if((BTM_BleMaxMultiAdvInstanceCount() > 0) && (btm_multi_adv_cb.p_adv_inst != NULL))
+ {
+ BTM_TRACE_EVENT("Stopping multi adv rpa timers");
+ for(inst_id=0; inst_id < BTM_BleMaxMultiAdvInstanceCount(); inst_id++)
+ {
+ btu_stop_timer_oneshot(&btm_multi_adv_cb.p_adv_inst[inst_id].raddr_timer_ent);
+ }
+ }
if (btm_multi_adv_cb.p_adv_inst)
GKI_freebuf(btm_multi_adv_cb.p_adv_inst);