From cdd49a6cfd2fedf775dd06e511c050e95508f5b8 Mon Sep 17 00:00:00 2001 From: Kausik Sinnaswamy Date: Fri, 21 Sep 2012 17:58:59 +0530 Subject: Added a configurable BT disable timer This timer(BTA_DISABLE_DELAY) if set to a value greater than zero shall delay the chip/transport shutdown. The BTA_DISABLE_DELAY can be fine-tuned per platform. bug 7212447 Change-Id: Ib0346af42f6b596e9fbb281203058872bceffbd9 --- bta/dm/bta_dm_act.c | 13 +++++++++++-- include/bt_target.h | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c index 91577bf..8260847 100644 --- a/bta/dm/bta_dm_act.c +++ b/bta/dm/bta_dm_act.c @@ -454,9 +454,18 @@ void bta_dm_disable (tBTA_DM_MSG *p_data) if(BTM_GetNumAclLinks()==0) { - /* Earlier there used to be a 1-second timer to fire this callback. - * Doesn't look like it is needed. */ +#if (defined(BTA_DISABLE_DELAY) && BTA_DISABLE_DELAY > 0) + /* If BTA_DISABLE_DELAY is defined and greater than zero, then delay the shutdown by + * BTA_DISABLE_DELAY milliseconds + */ + APPL_TRACE_WARNING2("%s BTA_DISABLE_DELAY set to %d ms", + __FUNCTION__, BTA_DISABLE_DELAY); + bta_sys_stop_timer(&bta_dm_cb.disable_timer); + bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK*)&bta_dm_disable_conn_down_timer_cback; + bta_sys_start_timer(&bta_dm_cb.disable_timer, 0, BTA_DISABLE_DELAY); +#else bta_dm_disable_conn_down_timer_cback(NULL); +#endif } else { diff --git a/include/bt_target.h b/include/bt_target.h index 68c8417..05c4a35 100644 --- a/include/bt_target.h +++ b/include/bt_target.h @@ -271,6 +271,10 @@ #define BTA_GATT_INCLUDED FALSE #endif +#ifndef BTA_DISABLE_DELAY +#define BTA_DISABLE_DELAY 200 /* in milliseconds */ +#endif + #ifndef RPC_TRACE_ONLY #define RPC_TRACE_ONLY FALSE #endif -- cgit v1.1