mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/btdm_send_data_len_req_after_read_feats' into 'release/v2.1'
Component/bt: send data length request by host after read feature complete for v2.1 See merge request !1815
This commit is contained in:
commit
3baa4e39b3
@ -66,6 +66,7 @@ static uint8_t ble_resolving_list_max_size;
|
||||
static uint8_t ble_supported_states[BLE_SUPPORTED_STATES_SIZE];
|
||||
static bt_device_features_t features_ble;
|
||||
static uint16_t ble_suggested_default_data_length;
|
||||
static uint16_t ble_suggested_default_data_txtime;
|
||||
|
||||
static bool readable;
|
||||
static bool ble_supported;
|
||||
@ -228,7 +229,8 @@ static void start_up(void)
|
||||
response = AWAIT_COMMAND(packet_factory->make_ble_read_suggested_default_data_length());
|
||||
packet_parser->parse_ble_read_suggested_default_data_length_response(
|
||||
response,
|
||||
&ble_suggested_default_data_length);
|
||||
&ble_suggested_default_data_length,
|
||||
&ble_suggested_default_data_txtime);
|
||||
}
|
||||
|
||||
// Set the ble event mask next
|
||||
@ -404,6 +406,13 @@ static uint16_t get_ble_suggested_default_data_length(void)
|
||||
return ble_suggested_default_data_length;
|
||||
}
|
||||
|
||||
static uint16_t get_ble_suggested_default_data_txtime(void)
|
||||
{
|
||||
assert(readable);
|
||||
assert(ble_supported);
|
||||
return ble_suggested_default_data_txtime;
|
||||
}
|
||||
|
||||
static uint16_t get_acl_buffer_count_classic(void)
|
||||
{
|
||||
assert(readable);
|
||||
@ -472,6 +481,7 @@ static const controller_t interface = {
|
||||
get_acl_packet_size_classic,
|
||||
get_acl_packet_size_ble,
|
||||
get_ble_suggested_default_data_length,
|
||||
get_ble_suggested_default_data_txtime,
|
||||
|
||||
get_acl_buffer_count_classic,
|
||||
get_acl_buffer_count_ble,
|
||||
|
@ -69,6 +69,7 @@ typedef struct controller_t {
|
||||
uint16_t (*get_acl_packet_size_ble)(void);
|
||||
|
||||
uint16_t (*get_ble_default_data_packet_length)(void);
|
||||
uint16_t (*get_ble_default_data_packet_txtime)(void);
|
||||
|
||||
// Get the number of acl packets the controller can buffer.
|
||||
uint16_t (*get_acl_buffer_count_classic)(void);
|
||||
|
@ -183,11 +183,13 @@ static void parse_ble_read_resolving_list_size_response(
|
||||
|
||||
static void parse_ble_read_suggested_default_data_length_response(
|
||||
BT_HDR *response,
|
||||
uint16_t *ble_default_packet_length_ptr)
|
||||
uint16_t *ble_default_packet_length_ptr,
|
||||
uint16_t *ble_default_packet_txtime_ptr)
|
||||
{
|
||||
|
||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_DEFAULT_DATA_LENGTH, 2 /* bytes after */);
|
||||
STREAM_TO_UINT8(*ble_default_packet_length_ptr, stream);
|
||||
STREAM_TO_UINT16(*ble_default_packet_length_ptr, stream);
|
||||
STREAM_TO_UINT16(*ble_default_packet_txtime_ptr, stream);
|
||||
|
||||
buffer_allocator->free(response);
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ typedef struct {
|
||||
|
||||
void (*parse_ble_read_suggested_default_data_length_response)(
|
||||
BT_HDR *response,
|
||||
uint16_t *ble_default_packet_length_ptr
|
||||
uint16_t *ble_default_packet_length_ptr,
|
||||
uint16_t *ble_default_packet_txtime_ptr
|
||||
);
|
||||
} hci_packet_parser_t;
|
||||
|
||||
|
@ -907,6 +907,11 @@ void btm_read_remote_version_complete (UINT8 *p)
|
||||
}
|
||||
#if BLE_INCLUDED == TRUE
|
||||
if (p_acl_cb->transport == BT_TRANSPORT_LE) {
|
||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
||||
}
|
||||
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
||||
}
|
||||
#endif
|
||||
|
@ -812,7 +812,7 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
|
||||
}
|
||||
|
||||
if (!HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl->peer_le_features)) {
|
||||
BTM_TRACE_DEBUG("%s failed, peer does not support request", __FUNCTION__);
|
||||
BTM_TRACE_ERROR("%s failed, peer does not support request", __FUNCTION__);
|
||||
return BTM_PEER_LE_DATA_LEN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -3350,6 +3350,11 @@ void btm_ble_read_remote_features_complete(UINT8 *p)
|
||||
|
||||
else{
|
||||
if (p_acl_cb->transport == BT_TRANSPORT_LE) {
|
||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
||||
}
|
||||
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
||||
}
|
||||
}
|
||||
|
@ -989,8 +989,10 @@ void gatt_process_mtu_rsp(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT16 len, UINT
|
||||
p_tcb->payload_size = mtu;
|
||||
}
|
||||
}
|
||||
|
||||
l2cble_set_fixed_channel_tx_data_length(p_tcb->peer_bda, L2CAP_ATT_CID, p_tcb->payload_size);
|
||||
/* host will set packet data length to 251 automatically if remote device support set packet data length,
|
||||
so l2cble_set_fixed_channel_tx_data_length() is not necessary.
|
||||
l2cble_set_fixed_channel_tx_data_length(p_tcb->peer_bda, L2CAP_ATT_CID, p_tcb->payload_size);
|
||||
*/
|
||||
gatt_end_operation(p_clcb, status, NULL);
|
||||
}
|
||||
/*******************************************************************************
|
||||
|
@ -929,9 +929,10 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
|
||||
p_tcb->payload_size = mtu;
|
||||
}
|
||||
|
||||
GATT_TRACE_ERROR("MTU request PDU with MTU size %d\n", p_tcb->payload_size);
|
||||
|
||||
l2cble_set_fixed_channel_tx_data_length(p_tcb->peer_bda, L2CAP_ATT_CID, p_tcb->payload_size);
|
||||
/* host will set packet data length to 251 automatically if remote device support set packet data length,
|
||||
so l2cble_set_fixed_channel_tx_data_length() is not necessary.
|
||||
l2cble_set_fixed_channel_tx_data_length(p_tcb->peer_bda, L2CAP_ATT_CID, p_tcb->payload_size);
|
||||
*/
|
||||
|
||||
if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_MTU, (tGATT_SR_MSG *) &p_tcb->payload_size)) != NULL) {
|
||||
attp_send_sr_msg (p_tcb, p_buf);
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4c0d1e8941ebc2d43962d92509c17b664db2c7da
|
||||
Subproject commit 459d8f8e1921c9e82d8f0a9b1ecf44fc3699139d
|
Loading…
Reference in New Issue
Block a user