summaryrefslogtreecommitdiffstats
path: root/btif/src
diff options
context:
space:
mode:
authorHarish Paryani <hparyani@broadcom.com>2012-03-07 16:36:03 -0800
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:12 -0700
commit17706aa42214addb95ee4aea5177a8784960dfc1 (patch)
tree24ba3487fc2e4fed27e76043608e0a94451ce2b5 /btif/src
parentc625f0b1c42a6451796cd6867e2769cd0db28d93 (diff)
downloadexternal_bluetooth_bluedroid-17706aa42214addb95ee4aea5177a8784960dfc1.zip
external_bluetooth_bluedroid-17706aa42214addb95ee4aea5177a8784960dfc1.tar.gz
external_bluetooth_bluedroid-17706aa42214addb95ee4aea5177a8784960dfc1.tar.bz2
Disconnect before Unpair
Change-Id: Ib28372748df21d36d371d308975758f60df7aa28
Diffstat (limited to 'btif/src')
-rwxr-xr-x[-rw-r--r--]btif/src/btif_dm.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 8fbc31d..9626457 100644..100755
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -679,7 +679,8 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param;
tBTA_SERVICE_MASK service_mask;
uint32_t i;
-
+ bt_bdaddr_t bd_addr;
+
BTIF_TRACE_EVENT1("btif_dm_upstreams_cback ev: %d", event);
switch (event)
@@ -758,6 +759,13 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
case BTA_DM_SP_KEY_NOTIF_EVT:
btif_dm_ssp_key_notif_evt(&p_data->key_notif);
break;
+
+ case BTA_DM_DEV_UNPAIRED_EVT:
+ bdcpy(bd_addr.address, p_data->link_down.bd_addr);
+ btif_storage_remove_bonded_device(&bd_addr);
+ CHECK_CALL_CBACK(bt_hal_cbacks, bond_state_changed_cb, BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_NONE);
+ break;
+
case BTA_DM_AUTHORIZE_EVT:
case BTA_DM_LINK_DOWN_EVT:
case BTA_DM_SIG_STRENGTH_EVT:
@@ -801,19 +809,6 @@ static void btif_dm_generic_evt(UINT16 event, char* p_param)
}
break;
- case BTIF_DM_CB_REMOVED_BONDING:
- {
- bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)p_param;
- bt_status_t status;
-
- status = btif_storage_remove_bonded_device(bd_addr);
- ASSERTC(status == BT_STATUS_SUCCESS, "failed to delete bonded device", status);
-
- CHECK_CALL_CBACK(bt_hal_cbacks, bond_state_changed_cb,
- BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_NONE);
- }
- break;
-
default:
{
BTIF_TRACE_WARNING2("%s : Unknown event 0x%x", __FUNCTION__, event);
@@ -1051,14 +1046,10 @@ bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr)
BTIF_TRACE_DEBUG1("Successfully removed bonding with device: %s",
bd2str((bt_bdaddr_t *)bd_addr, &bdstr));
- /* Device shall be removed from the storage in the btif context */
- btif_transfer_context(btif_dm_generic_evt, BTIF_DM_CB_REMOVED_BONDING,
- (char*)bd_addr, sizeof(bt_bdaddr_t), NULL);
}
else
{
- /* TODO: ACL is already up with this device, disconnect and then issue RemoveBond */
- BTIF_TRACE_WARNING0("ACL connection exists with device. Disconnect and issue remove bonding");
+ return BT_STATUS_FAIL;
}
return BT_STATUS_SUCCESS;
}