Merge branch 'bugfix/fix_adv_not_resatrt_due_to_dis_reason' into 'master'

fix(ble/bluedroid): Fixed adv do not restart due to disconnection reason 0x3e

Closes BLERP-635

See merge request espressif/esp-idf!29733
pull/13651/head
Zhi Wei Jian 2024-04-08 19:58:42 +08:00
commit b9ea883781
2 zmienionych plików z 17 dodań i 11 usunięć

Wyświetl plik

@ -332,7 +332,7 @@ tBTM_STATUS BTM_BleSetExtendedAdvRandaddr(UINT8 instance, BD_ADDR rand_addr)
__func__, btm_ble_hci_status_to_str(err), err);
status = BTM_ILLEGAL_VALUE;
} else {
// set random address success, update address infor
// set random address success, update address info
if(extend_adv_cb.inst[instance].configured && extend_adv_cb.inst[instance].connetable) {
BTM_BleSetStaticAddr(rand_addr);
BTM_UpdateAddrInfor(BLE_ADDR_RANDOM, rand_addr);
@ -416,7 +416,7 @@ end:
BTM_TRACE_ERROR("LE EA SetParams: cmd err=0x%x", err);
status = BTM_ILLEGAL_VALUE;
} else {
// set addr success, update address infor
// set addr success, update address info
BTM_UpdateAddrInfor(BLE_ADDR_RANDOM, rand_addr);
}
}
@ -592,12 +592,12 @@ tBTM_STATUS BTM_BleStartExtAdvRestart(uint8_t con_handle)
}
}
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid) || (adv_record[index].retry_count > GATTC_CONNECT_RETRY_COUNT)) {
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid)) {
return BTM_WRONG_MODE;
}
adv_record[index].retry_count ++;
BTM_TRACE_DEBUG("remote device did not reveive aux connect response, retatrt the extend adv to reconnect, adv handle %d con_handle %d\n", index, con_handle);
BTM_TRACE_DEBUG("remote device did not receive aux connect response, retatrt the extend adv to reconnect, adv handle %d con_handle %d\n", index, con_handle);
ext_adv.instance = adv_record[index].instance;
ext_adv.duration = adv_record[index].duration;
ext_adv.max_events = adv_record[index].max_events;

Wyświetl plik

@ -367,6 +367,11 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
if (reason != HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT) {
BTM_Recovery_Pre_State();
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
if(btm_ble_inter_get() && reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT) {
BTM_BleStartExtAdvRestart(handle);
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif ///BLE_INCLUDED == TRUE
status = FALSE;
} else {
@ -438,7 +443,7 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
#endif
{
#if (L2CAP_NUM_FIXED_CHNLS > 0)
/* If we are going to re-use the LCB without dropping it, release all fixed channels
/* If we are going to reuse the LCB without dropping it, release all fixed channels
here */
int xx;
for (xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx++) {
@ -463,9 +468,9 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
}
p_lcb->p_pending_ccb = NULL;
#if (BLE_INCLUDED == TRUE && GATTC_CONNECT_RETRY_EN == TRUE)
#if (BLE_INCLUDED == TRUE)
if(reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT && p_lcb->transport == BT_TRANSPORT_LE) {
#if (GATTC_CONNECT_RETRY_EN == TRUE)
if(p_lcb->link_role == HCI_ROLE_MASTER && p_lcb->retry_create_con < GATTC_CONNECT_RETRY_COUNT) {
L2CAP_TRACE_DEBUG("master retry connect, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
p_lcb->retry_create_con ++;
@ -475,9 +480,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
lcb_is_free = FALSE; /* still using this lcb */
}
}
#endif // (GATTC_CONNECT_RETRY_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
if(btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE && p_lcb->retry_create_con < GATTC_CONNECT_RETRY_COUNT) {
if(btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
p_lcb->retry_create_con ++;
L2CAP_TRACE_DEBUG("slave restart extend adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
BTM_BleStartExtAdvRestart(handle);
@ -485,7 +491,7 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
if(!btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE && p_lcb->retry_create_con < GATTC_CONNECT_RETRY_COUNT) {
if(!btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
p_lcb->retry_create_con ++;
L2CAP_TRACE_DEBUG("slave resatrt adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
btm_ble_start_adv();
@ -909,7 +915,7 @@ UINT8 l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles)
**
** Function l2c_link_role_changed
**
** Description This function is called whan a link's master/slave role change
** Description This function is called when a link's master/slave role change
** event is received. It simply updates the link control block.
**
** Returns void
@ -947,7 +953,7 @@ void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status)
**
** Function l2c_pin_code_request
**
** Description This function is called whan a pin-code request is received
** Description This function is called when a pin-code request is received
** on a connection. If there are no channels active yet on the
** link, it extends the link first connection timer. Make sure
** that inactivity timer is not extended if PIN code happens