From c35f3c700f8f5b981bf8495752441d0e7e1c74f8 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 7 Dec 2016 12:10:26 +0100 Subject: [PATCH] fix test --- test/avdtp/avdtp.h | 3 --- test/avdtp/avdtp_sink.c | 14 +++++++++----- test/avdtp/avdtp_test.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/avdtp/avdtp.h b/test/avdtp/avdtp.h index 68508c250..ac2c63e15 100644 --- a/test/avdtp/avdtp.h +++ b/test/avdtp/avdtp.h @@ -331,9 +331,6 @@ typedef enum { AVDTP_SIGNALING_CONNECTION_IDLE, AVDTP_SIGNALING_CONNECTION_W4_L2CAP_CONNECTED, AVDTP_SIGNALING_CONNECTION_OPENED, - // AVDTP_SIGNALING_CONNECTION_ACCEPTOR_W2_ANSWER_DISCOVER_SEPS, - //AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_DISCOVER_SEPS, - //AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SEPS_DISCOVERED, AVDTP_SIGNALING_CONNECTION_W4_L2CAP_DISCONNECTED } avdtp_connection_state_t; diff --git a/test/avdtp/avdtp_sink.c b/test/avdtp/avdtp_sink.c index b9b8b5428..b5578aadb 100644 --- a/test/avdtp/avdtp_sink.c +++ b/test/avdtp/avdtp_sink.c @@ -154,8 +154,6 @@ static avdtp_stream_endpoint_t * get_avdtp_stream_endpoint_for_seid(uint16_t sei return NULL; } - - static avdtp_connection_t * avdtp_sink_create_connection(bd_addr_t remote_addr){ avdtp_connection_t * connection = btstack_memory_avdtp_connection_get(); memset(connection, 0, sizeof(avdtp_connection_t)); @@ -476,6 +474,7 @@ static int handle_l2cap_data_packet_for_connection(avdtp_connection_t * connecti avdtp_sink_request_can_send_now_self(connection, connection->l2cap_signaling_cid); return 1; case AVDTP_SI_GET_CAPABILITIES: + case AVDTP_SI_GET_ALL_CAPABILITIES: case AVDTP_SI_SET_CONFIGURATION: case AVDTP_SI_OPEN: case AVDTP_SI_START: @@ -666,10 +665,16 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe if (connection){ log_info(" -> L2CAP_EVENT_CHANNEL_CLOSED signaling cid 0x%0x", local_cid); stream_endpoint = get_avdtp_stream_endpoint_for_connection(connection); + btstack_linked_list_remove(&avdtp_connections, (btstack_linked_item_t*) connection); if (!stream_endpoint) break; stream_endpoint->connection = NULL; - connection->state = AVDTP_SIGNALING_CONNECTION_IDLE; - btstack_linked_list_remove(&avdtp_connections, (btstack_linked_item_t*) connection); + stream_endpoint->state = AVDTP_STREAM_ENDPOINT_IDLE; + stream_endpoint->acceptor_config_state = AVDTP_ACCEPTOR_STREAM_CONFIG_IDLE; + stream_endpoint->initiator_config_state = AVDTP_INITIATOR_STREAM_CONFIG_IDLE; + stream_endpoint->remote_sep_index = 0; + stream_endpoint->disconnect = 0; + stream_endpoint->remote_seps_num = 0; + memset(stream_endpoint->remote_seps, 0, sizeof(stream_endpoint->remote_seps)); break; } @@ -694,7 +699,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe stream_endpoint->l2cap_reporting_cid = 0; break; } - break; case HCI_EVENT_DISCONNECTION_COMPLETE: diff --git a/test/avdtp/avdtp_test.c b/test/avdtp/avdtp_test.c index f9c02130a..9d7599539 100644 --- a/test/avdtp/avdtp_test.c +++ b/test/avdtp/avdtp_test.c @@ -309,7 +309,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe break; case HCI_EVENT_DISCONNECTION_COMPLETE: - // connection closed -> quit tes app + // connection closed -> quit test app printf("\n --- avdtp_test: HCI_EVENT_DISCONNECTION_COMPLETE ---\n"); close_media_processing(); // exit(0);