avdtp: SEP discovery for incoming AVDTP connection after outgoing connection was triggered

This commit is contained in:
Matthias Ringwald 2025-04-03 14:44:23 +02:00
parent d02f7a60a5
commit bdc8377d3a
2 changed files with 12 additions and 7 deletions

View File

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- BNEP: emit channel opened with ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION if connection cannot be set up
- HFP AG: avoid recursion with synchronous HCI transport
- HFP HF: send Apple Accessory information after service level connection
- AVDTP: SEP discovery for incoming AVDTP connection after outgoing connection was triggered
### Changed
- HCI: hci_request_cis_can_send_now_events for CIG in Central role will emit can send now events for all streams in group

View File

@ -691,13 +691,17 @@ static void avdtp_finalize_connection(avdtp_connection_t * connection){
btstack_memory_avdtp_connection_free(connection);
}
static void avdtp_start_sep_query(avdtp_connection_t * connection, bool have_get_all_capabilities) {
if (have_get_all_capabilities){
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES;
static void avdtp_start_sep_query_if_idle(avdtp_connection_t * connection, bool have_get_all_capabilities) {
if (connection->acceptor_connection_state == AVDTP_SIGNALING_CONNECTION_ACCEPTOR_IDLE) {
if (have_get_all_capabilities){
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES;
} else {
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
}
avdtp_request_can_send_now_initiator(connection);
} else {
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
log_info("avdtp_start_sep_query_if_idle: sep query already active");
}
avdtp_request_can_send_now_initiator(connection);
}
static void avdtp_handle_sdp_query_failed(avdtp_connection_t * connection, uint8_t status){
@ -709,7 +713,7 @@ static void avdtp_handle_sdp_query_failed(avdtp_connection_t * connection, uint8
case AVDTP_SIGNALING_CONNECTION_OPENED:
// SDP query failed: try query that must be supported
avdtp_start_sep_query(connection, false);
avdtp_start_sep_query_if_idle(connection, false);
return;
default:
@ -726,7 +730,7 @@ static void avdtp_handle_sdp_query_succeeded(avdtp_connection_t * connection){
switch (connection->state){
case AVDTP_SIGNALING_CONNECTION_OPENED:
avdtp_start_sep_query(connection, connection->avdtp_version >= 0x0103);
avdtp_start_sep_query_if_idle(connection, connection->avdtp_version >= 0x0103);
break;
default:
connection->state = AVDTP_SIGNALING_CONNECTION_W4_L2CAP_CONNECTED;