mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-29 18:27:20 +02:00
Merge branch 'bugfix/fix_some_ble_bugs_v4.3' into 'release/v4.3'
Fixed some BLE bugs (backport v4.3) See merge request espressif/esp-idf!24286
This commit is contained in:
Submodule components/bt/controller/lib_esp32 updated: 26b2361bf7...7c757d49c4
Submodule components/bt/controller/lib_esp32c3_family updated: b3a4d45b03...a6828c0d52
@ -5057,7 +5057,7 @@ void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
L2CA_BleDisconnect(p_data->ble_disconnect.remote_bda);
|
||||
L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_data->ble_disconnect.remote_bda);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1211,19 +1211,6 @@ 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) */
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1949,36 +1949,6 @@ 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
|
||||
|
@ -35,11 +35,35 @@
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
const tHCI_ExtConnParams ext_conn_params = {
|
||||
#define EXT_CONN_INT_DEF_1M MAX(((MAX_ACL_CONNECTIONS + 1) * 4), 12)
|
||||
#define EXT_CONN_INT_DEF_2M MAX(((MAX_ACL_CONNECTIONS + 1) * 2), 12)
|
||||
#define EXT_CONN_INT_DEF_CODED (320) // 306-> 362Kbps
|
||||
|
||||
const static tHCI_ExtConnParams ext_conn_params_1m_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = 320, // 306-> 362Kbps
|
||||
.conn_interval_max = 320,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_1M,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_1M,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
.max_ce_len = 0,
|
||||
};
|
||||
const static tHCI_ExtConnParams ext_conn_params_2m_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_2M,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_2M,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
.max_ce_len = 0,
|
||||
};
|
||||
const static tHCI_ExtConnParams ext_conn_params_coded_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_CODED,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_CODED,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
@ -929,9 +953,9 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
if (p_dev_rec->ext_conn_params.phy_mask == BLE_PHY_NO_PREF) {
|
||||
L2CAP_TRACE_WARNING("No extend connection parameters set, use default parameters");
|
||||
aux_conn.init_phy_mask = BLE_PHY_PREF_MASK;
|
||||
memcpy(&aux_conn.params[0], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[1], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[2], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[0], &ext_conn_params_1m_phy, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[1], &ext_conn_params_2m_phy, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[2], &ext_conn_params_coded_phy, sizeof(tHCI_ExtConnParams));
|
||||
} else {
|
||||
aux_conn.init_phy_mask = p_dev_rec->ext_conn_params.phy_mask;
|
||||
memcpy(&aux_conn.params[0], &p_dev_rec->ext_conn_params.phy_1m_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
|
@ -834,12 +834,14 @@ static esp_err_t esp_ble_hidd_dev_battery_set(void *devp, uint8_t level)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
ret = esp_ble_gatts_send_indicate(dev->bat_svc.gatt_if, dev->conn_id, dev->bat_level_handle, 1, &dev->bat_level, dev->bat_ccc.indicate_enable);
|
||||
if (ret) {
|
||||
ESP_LOGE(TAG, "esp_ble_gatts_send_indicate failed: %d", ret);
|
||||
return ESP_FAIL;
|
||||
if (dev->bat_ccc.notify_enable) {
|
||||
ret = esp_ble_gatts_send_indicate(dev->bat_svc.gatt_if, dev->conn_id, dev->bat_level_handle, 1, &dev->bat_level, false);
|
||||
if (ret) {
|
||||
ESP_LOGE(TAG, "esp_ble_gatts_send_notify failed: %d", ret);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
}
|
||||
WAIT_CB(dev);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user