avdtp: extract avdtp_start_sep_query

This commit is contained in:
Matthias Ringwald 2025-04-03 14:41:35 +02:00
parent 1d1b86fb6b
commit d02f7a60a5

View File

@ -691,6 +691,15 @@ 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;
} else {
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
}
avdtp_request_can_send_now_initiator(connection);
}
static void avdtp_handle_sdp_query_failed(avdtp_connection_t * connection, uint8_t status){
switch (connection->state){
case AVDTP_SIGNALING_W4_SDP_QUERY_FOR_REMOTE_SINK_COMPLETE:
@ -700,8 +709,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
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
avdtp_request_can_send_now_initiator(connection);
avdtp_start_sep_query(connection, false);
return;
default:
@ -718,12 +726,7 @@ static void avdtp_handle_sdp_query_succeeded(avdtp_connection_t * connection){
switch (connection->state){
case AVDTP_SIGNALING_CONNECTION_OPENED:
if (connection->avdtp_version < 0x0103){
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CAPABILITIES;
} else {
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES;
}
avdtp_request_can_send_now_initiator(connection);
avdtp_start_sep_query(connection, connection->avdtp_version >= 0x0103);
break;
default:
connection->state = AVDTP_SIGNALING_CONNECTION_W4_L2CAP_CONNECTED;