summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_dm.c
diff options
context:
space:
mode:
authorRavi Nagarajan <nravi@broadcom.com>2012-05-29 17:11:03 +0530
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:22 -0700
commitcc10fec21ba2bdb9c908509b1667c8c34d0e8c02 (patch)
tree752a70c19571a58d044a7e8eb22d94d97107cfcb /btif/src/btif_dm.c
parent7b4048c6064ab21da67dc3450bdfd431f109e4fc (diff)
downloadexternal_bluetooth_bluedroid-cc10fec21ba2bdb9c908509b1667c8c34d0e8c02.zip
external_bluetooth_bluedroid-cc10fec21ba2bdb9c908509b1667c8c34d0e8c02.tar.gz
external_bluetooth_bluedroid-cc10fec21ba2bdb9c908509b1667c8c34d0e8c02.tar.bz2
When Bluetooth disable is initiated, terminate pending bonding setup, and reset control blocks on startup/init
Change-Id: Iddc37e60ddb712de4af39a25f3c2e5bc7b11410d
Diffstat (limited to 'btif/src/btif_dm.c')
-rwxr-xr-xbtif/src/btif_dm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 422927c..e2ab8c5 100755
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -1107,6 +1107,9 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
btif_in_execute_service_request(i, TRUE);
}
}
+ /* clear control blocks */
+ memset(&pairing_cb, 0, sizeof(btif_dm_pairing_cb_t));
+
/* This function will also trigger the adapter_properties_cb
** and bonded_devices_info_cb
*/
@@ -1501,9 +1504,9 @@ bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr)
else
{
BTA_DmPinReply( (UINT8 *)bd_addr->address, FALSE, 0, NULL);
- if (!BTM_IsAclConnectionUp((UINT8 *)bd_addr->address))
- BTA_DmBondCancel ((UINT8 *)bd_addr->address);
}
+ /* Cancel bonding, in case it is in ACL connection setup state */
+ BTA_DmBondCancel ((UINT8 *)bd_addr->address);
}
return BT_STATUS_SUCCESS;
@@ -1831,3 +1834,15 @@ BOOLEAN btif_dm_proc_rmt_oob(BD_ADDR bd_addr, BT_OCTET16 p_c, BT_OCTET16 p_r)
}
#endif /* BTIF_DM_OOB_TEST */
+void btif_dm_on_disable()
+{
+ /* cancel any pending pairing requests */
+ if (pairing_cb.state == BT_BOND_STATE_BONDING)
+ {
+ bt_bdaddr_t bd_addr;
+
+ BTIF_TRACE_DEBUG1("%s: Cancel pending pairing request", __FUNCTION__);
+ bdcpy(bd_addr.address, pairing_cb.bd_addr);
+ btif_dm_cancel_bond(&bd_addr);
+ }
+}