mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_some_ble_bug_v4.2' into 'release/v4.2'
Fixed some BLE bugs (backport v4.2) See merge request espressif/esp-idf!23701
This commit is contained in:
commit
65331f6ce1
@ -5003,7 +5003,7 @@ void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_data->ble_disconnect.remote_bda);
|
||||
L2CA_BleDisconnect(p_data->ble_disconnect.remote_bda);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -393,7 +393,7 @@ void bta_dm_co_ble_set_init_key_req(UINT8 init_key)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
init_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
|
||||
bte_appl_cfg.ble_init_key &= init_key;
|
||||
bte_appl_cfg.ble_init_key = init_key;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
rsp_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
|
||||
bte_appl_cfg.ble_resp_key &= rsp_key;
|
||||
bte_appl_cfg.ble_resp_key = rsp_key;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
|
@ -2169,9 +2169,10 @@ UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
if (len > MIN_ADV_LENGTH && data_mask & BTM_BLE_AD_BIT_DEV_NAME) {
|
||||
if (strlen(btm_cb.cfg.bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
|
||||
*p++ = len - MIN_ADV_LENGTH + 1;
|
||||
cp_len = (UINT16)(len - MIN_ADV_LENGTH);
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_NAME_SHORT;
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, len - MIN_ADV_LENGTH);
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
|
||||
} else {
|
||||
cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
|
||||
*p++ = cp_len + 1;
|
||||
|
@ -1211,6 +1211,19 @@ extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_BleDisconnect
|
||||
**
|
||||
** Description This function use to disconnect LE connection.
|
||||
**
|
||||
** Parameters BD Address of remote
|
||||
**
|
||||
** Returns TRUE if disconnect successfully.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_BleDisconnect (BD_ADDR rem_bda);
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1951,6 +1951,36 @@ BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
BOOLEAN L2CA_BleDisconnect (BD_ADDR rem_bda)
|
||||
{
|
||||
tL2C_LCB *p_lcb;
|
||||
tGATT_TCB *p_tcb;
|
||||
|
||||
p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_LE);
|
||||
if (p_lcb == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (p_lcb->link_state != LST_CONNECTED) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
p_lcb->disc_reason = HCI_ERR_CONN_CAUSE_LOCAL_HOST;
|
||||
p_lcb->link_state = LST_DISCONNECTING;
|
||||
btsnd_hcic_disconnect (p_lcb->handle, HCI_ERR_PEER_USER);
|
||||
|
||||
p_tcb = gatt_find_tcb_by_addr(rem_bda, BT_TRANSPORT_LE);
|
||||
if (p_tcb == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_SetFixedChannelTout
|
||||
|
Loading…
Reference in New Issue
Block a user