mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
add hci_remote_eSCO_supported. use HFP S4 settings if eSCO supported
This commit is contained in:
parent
417c123e5c
commit
98a2fd1ca4
20
src/hci.c
20
src/hci.c
@ -1403,9 +1403,12 @@ static void event_handler(uint8_t *packet, int size){
|
||||
if (features[6] & (1 << 3)){
|
||||
conn->bonding_flags |= BONDING_REMOTE_SUPPORTS_SSP;
|
||||
}
|
||||
if (features[3] & (1<<7)){
|
||||
conn->remote_supported_feature_eSCO = 1;
|
||||
}
|
||||
}
|
||||
conn->bonding_flags |= BONDING_RECEIVED_REMOTE_FEATURES;
|
||||
log_info("HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE, bonding flags %x", conn->bonding_flags);
|
||||
log_info("HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE, bonding flags %x, eSCO %u", conn->bonding_flags, conn->remote_supported_feature_eSCO);
|
||||
if (conn->bonding_flags & BONDING_DEDICATED){
|
||||
conn->bonding_flags |= BONDING_SEND_AUTHENTICATE_REQUEST;
|
||||
}
|
||||
@ -2325,7 +2328,13 @@ void hci_run(void){
|
||||
if (connection->address_type == BD_ADDR_TYPE_CLASSIC){
|
||||
hci_send_cmd(&hci_accept_connection_request, connection->address, 1);
|
||||
} else {
|
||||
hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0xFFFF, hci_stack->sco_voice_setting, 0xFF, 0x003F);
|
||||
if (connection->remote_supported_feature_eSCO){
|
||||
// S4 - max latency == transmission interval = 0x000c == 12 ms
|
||||
hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0x02, 0x003f);
|
||||
} else {
|
||||
// max latency, retransmission interval: N/A. any packet type
|
||||
hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0xff, 0x003f);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@ -2889,6 +2898,13 @@ void hci_emit_dedicated_bonding_result(bd_addr_t address, uint8_t status){
|
||||
hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
|
||||
// query if remote side supports eSCO
|
||||
int hci_remote_eSCO_supported(hci_con_handle_t con_handle){
|
||||
hci_connection_t * connection = hci_connection_for_handle(con_handle);
|
||||
if (!connection) return 0;
|
||||
return connection->remote_supported_feature_eSCO;
|
||||
}
|
||||
|
||||
// query if remote side supports SSP
|
||||
int hci_remote_ssp_supported(hci_con_handle_t con_handle){
|
||||
hci_connection_t * connection = hci_connection_for_handle(con_handle);
|
||||
|
@ -513,6 +513,9 @@ typedef struct {
|
||||
//
|
||||
link_key_type_t link_key_type;
|
||||
|
||||
// remote supported features
|
||||
uint8_t remote_supported_feature_eSCO;
|
||||
|
||||
// errands
|
||||
uint32_t authentication_flags;
|
||||
|
||||
@ -850,6 +853,8 @@ void hci_disconnect_security_block(hci_con_handle_t con_handle);
|
||||
// send complete CMD packet
|
||||
int hci_send_cmd_packet(uint8_t *packet, int size);
|
||||
|
||||
// query if remote side supports eSCO
|
||||
int hci_remote_eSCO_supported(hci_con_handle_t con_handle);
|
||||
|
||||
/* API_START */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user