diff options
author | Kausik Sinnaswamy <kausik@broadcom.com> | 2012-04-10 13:45:26 +0530 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-14 11:19:15 -0700 |
commit | a5c380dbe1419e077bf6a3a8a30359ce74958350 (patch) | |
tree | 338b4965a9156d109c10fef4fb19340243bc24d8 /btif/src | |
parent | 48253de5c3dffcc3884f9c2b349354f9a8acf174 (diff) | |
download | external_bluetooth_bluedroid-a5c380dbe1419e077bf6a3a8a30359ce74958350.zip external_bluetooth_bluedroid-a5c380dbe1419e077bf6a3a8a30359ce74958350.tar.gz external_bluetooth_bluedroid-a5c380dbe1419e077bf6a3a8a30359ce74958350.tar.bz2 |
Added support to ensure that BT_DISCOVERY_STARTED and
BT_DISCOVERY_STOPPED signals are sent only after receiving the
status/complete event from HCI for the start_inquiry/cancel_inquiry APIs
Change-Id: I14da272b3e0596c2062ce617e9dccb788cc80425
Diffstat (limited to 'btif/src')
-rwxr-xr-x | btif/src/btif_dm.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c index 351f189..2bb3a0e 100755 --- a/btif/src/btif_dm.c +++ b/btif/src/btif_dm.c @@ -693,9 +693,7 @@ static void btif_dm_search_devices_evt (UINT16 event, char *p_param) { } break; - case BTA_DM_DISC_CMPL_EVT: - case BTA_DM_SEARCH_CANCEL_CMPL_EVT: { HAL_CBACK(bt_hal_cbacks, discovery_state_changed_cb, BT_DISCOVERY_STOPPED); } @@ -926,10 +924,26 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param) bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_NONE); break; + case BTA_DM_BUSY_LEVEL_EVT: + { + UINT8 busy_level; + busy_level = p_data->busy_level.level; + if (busy_level & BTM_BL_INQUIRY_PAGING_MASK) + { + if (busy_level == BTM_BL_INQUIRY_STARTED) + { + HAL_CBACK(bt_hal_cbacks, discovery_state_changed_cb, + BT_DISCOVERY_STARTED); + } else if (busy_level == BTM_BL_INQUIRY_CANCELLED) + { + HAL_CBACK(bt_hal_cbacks, discovery_state_changed_cb, + BT_DISCOVERY_STOPPED); + } + } + }break; case BTA_DM_AUTHORIZE_EVT: case BTA_DM_LINK_DOWN_EVT: case BTA_DM_SIG_STRENGTH_EVT: - case BTA_DM_BUSY_LEVEL_EVT: case BTA_DM_BOND_CANCEL_CMPL_EVT: case BTA_DM_SP_RMT_OOB_EVT: case BTA_DM_SP_KEYPRESS_EVT: @@ -1130,9 +1144,6 @@ bt_status_t btif_dm_start_discovery(void) /* find nearby devices */ BTA_DmSearch(&inq_params, services, bte_search_devices_evt); - /* Invoke the discovery_started callback */ - btif_transfer_context(btif_dm_generic_evt, BTIF_DM_CB_DISCOVERY_STARTED, NULL, 0, NULL); - return BT_STATUS_SUCCESS; } |