component/bt: fix stop adv error in dual core

This commit is contained in:
zwj 2018-06-15 16:25:35 +08:00 committed by zhiweijian
parent ddb05d0719
commit 6752163800
2 changed files with 37 additions and 7 deletions

View File

@ -3492,15 +3492,30 @@ tBTM_STATUS btm_ble_stop_adv(void)
tBTM_STATUS rt = BTM_SUCCESS;
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE)) {
p_cb->fast_adv_on = FALSE;
p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
p_cb->state = BTM_BLE_ADV_PENDING;
btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_ADV;
UINT8 temp_adv_mode = p_cb->adv_mode;
BOOLEAN temp_fast_adv_on = p_cb->fast_adv_on;
tBTM_BLE_GAP_STATE temp_state = p_cb->state;
tBTM_BLE_WL_STATE temp_wl_state = btm_cb.ble_ctr_cb.wl_state;
tBTM_BLE_STATE_MASK temp_mask = btm_ble_get_topology_mask ();
p_cb->fast_adv_on = FALSE;
p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
p_cb->state = BTM_BLE_ADV_PENDING;
btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_ADV;
/* clear all adv states */
btm_ble_clear_topology_mask (BTM_BLE_STATE_ALL_ADV_MASK);
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE)) {
/* clear all adv states */
btm_ble_clear_topology_mask (BTM_BLE_STATE_ALL_ADV_MASK);
} else {
// reset state
p_cb->fast_adv_on = temp_fast_adv_on;
p_cb->adv_mode = temp_adv_mode;
p_cb->state = temp_state;
btm_cb.ble_ctr_cb.wl_state = temp_wl_state;
btm_ble_set_topology_mask (temp_mask);
rt = BTM_NO_RESOURCES;
}
}
@ -3745,6 +3760,20 @@ BOOLEAN btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
return TRUE;
}
/*******************************************************************************
**
** Function btm_ble_get_topology_mask
**
** Description Get BLE topology bit mask
**
** Returns state mask.
**
*******************************************************************************/
tBTM_BLE_STATE_MASK btm_ble_get_topology_mask (void)
{
return btm_cb.ble_ctr_cb.cur_states;
}
/*******************************************************************************
**
** Function btm_ble_update_link_topology_mask

View File

@ -481,6 +481,7 @@ void btm_ble_adv_filter_cleanup(void);
BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
tBTM_BLE_STATE_MASK btm_ble_get_topology_mask(void);
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc);