summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bta/dm/bta_dm_act.c13
-rw-r--r--include/bt_target.h4
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