Merge branch 'bugfix/btdm_allow_start_adv_again_v3.1' into 'release/v3.1'

component/bt: allow to send stop adv again and fix tx prog crash(backport v3.1)

See merge request espressif/esp-idf!6914
This commit is contained in:
Jiang Jiang Jian 2020-02-24 20:18:09 +08:00
commit 32386575c9
2 changed files with 4 additions and 13 deletions

View file

@ -538,7 +538,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
} }
return BTM_BUSY; return BTM_BUSY;
} }
if (start && p_cb->adv_mode == BTM_BLE_ADV_DISABLE) { if (start) {
/* update adv params */ /* update adv params */
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min : if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
BTM_BLE_GAP_ADV_INT), BTM_BLE_GAP_ADV_INT),
@ -558,22 +558,13 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
} }
status = btm_ble_start_adv (); status = btm_ble_start_adv ();
} else if (!start && p_cb->adv_mode == BTM_BLE_ADV_ENABLE) { } else {
//save the stop adv callback to the BTM env. //save the stop adv callback to the BTM env.
p_cb->p_stop_adv_cb = p_stop_adv_cback; p_cb->p_stop_adv_cb = p_stop_adv_cback;
status = btm_ble_stop_adv(); status = btm_ble_stop_adv();
#if BLE_PRIVACY_SPT == TRUE #if BLE_PRIVACY_SPT == TRUE
btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE); btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
#endif #endif
} else {
/*
1. start adv when adv has already started (not used)
2. stop adv shen adv has already stoped
*/
status = BTM_SUCCESS;
if (p_stop_adv_cback) {
(*p_stop_adv_cback)(status);
}
} }
return status; return status;
} }
@ -3650,7 +3641,7 @@ tBTM_STATUS btm_ble_stop_adv(void)
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
tBTM_STATUS rt = BTM_SUCCESS; tBTM_STATUS rt = BTM_SUCCESS;
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) { if (p_cb) {
UINT8 temp_adv_mode = p_cb->adv_mode; UINT8 temp_adv_mode = p_cb->adv_mode;
BOOLEAN temp_fast_adv_on = p_cb->fast_adv_on; BOOLEAN temp_fast_adv_on = p_cb->fast_adv_on;
tBTM_BLE_GAP_STATE temp_state = p_cb->state; tBTM_BLE_GAP_STATE temp_state = p_cb->state;

@ -1 +1 @@
Subproject commit 3e6557c91f8abd0ccfd986d576ddd896a20b3fa4 Subproject commit f845e941b8e3de38696ceeaead87d3f8f8e23552