mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 15:44:32 +00:00
avdtp: support de-init
This commit is contained in:
parent
7569dc6180
commit
57fb24ff23
@ -55,6 +55,8 @@
|
||||
|
||||
btstack_linked_list_t stream_endpoints;
|
||||
|
||||
static bool l2cap_registered;
|
||||
|
||||
static btstack_packet_handler_t avdtp_source_callback;
|
||||
static btstack_packet_handler_t avdtp_sink_callback;
|
||||
static btstack_context_callback_registration_t avdtp_handle_sdp_client_query_request;
|
||||
@ -66,8 +68,8 @@ static uint16_t stream_endpoints_id_counter = 0;
|
||||
static btstack_linked_list_t connections;
|
||||
static uint16_t transaction_id_counter = 0;
|
||||
|
||||
static int record_id = -1;
|
||||
static uint8_t attribute_value[45];
|
||||
static int record_id;
|
||||
static uint8_t attribute_value[45];
|
||||
static const unsigned int attribute_value_buffer_size = sizeof(attribute_value);
|
||||
|
||||
static void (*avdtp_sink_handle_media_data)(uint8_t local_seid, uint8_t *packet, uint16_t size);
|
||||
@ -261,6 +263,7 @@ static void avdtp_handle_start_sdp_client_query(void * context){
|
||||
continue;
|
||||
}
|
||||
sdp_query_context_avdtp_cid = connection->avdtp_cid;
|
||||
record_id = -1;
|
||||
sdp_client_query_uuid16(&avdtp_handle_sdp_client_query_result, (uint8_t *) connection->remote_addr, BLUETOOTH_PROTOCOL_AVDTP);
|
||||
return;
|
||||
}
|
||||
@ -1473,9 +1476,20 @@ uint8_t is_avdtp_remote_seid_registered(avdtp_stream_endpoint_t * stream_endpoin
|
||||
}
|
||||
|
||||
void avdtp_init(void){
|
||||
static bool l2cap_registered = false;
|
||||
if (!l2cap_registered){
|
||||
l2cap_registered = true;
|
||||
l2cap_register_service(&avdtp_packet_handler, BLUETOOTH_PSM_AVDTP, 0xffff, gap_get_security_level());
|
||||
}
|
||||
}
|
||||
|
||||
void avdtp_deinit(void){
|
||||
l2cap_registered = false;
|
||||
stream_endpoints = NULL;
|
||||
connections = NULL;
|
||||
avdtp_sink_handle_media_data = NULL;
|
||||
|
||||
sdp_query_context_avdtp_cid = 0;
|
||||
stream_endpoints_id_counter = 0;
|
||||
transaction_id_counter = 0;
|
||||
avdtp_cid_counter = 0;
|
||||
}
|
||||
|
@ -555,6 +555,8 @@ typedef struct avdtp_stream_endpoint {
|
||||
} avdtp_stream_endpoint_t;
|
||||
|
||||
void avdtp_init(void);
|
||||
void avdtp_deinit(void);
|
||||
|
||||
avdtp_connection_t * avdtp_get_connection_for_avdtp_cid(uint16_t avdtp_cid);
|
||||
avdtp_connection_t * avdtp_get_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid);
|
||||
btstack_linked_list_t * avdtp_get_connections(void);
|
||||
|
@ -103,6 +103,10 @@ void avdtp_sink_init(void) {
|
||||
avdtp_init();
|
||||
}
|
||||
|
||||
void avdtp_sink_deinit(void){
|
||||
avdtp_deinit();
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * avdtp_sink_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type){
|
||||
return avdtp_create_stream_endpoint(sep_type, media_type);
|
||||
}
|
||||
|
@ -177,6 +177,11 @@ uint8_t avdtp_sink_suspend(uint16_t avdtp_cid, uint8_t local_seid);
|
||||
*/
|
||||
uint8_t avdtp_sink_delay_report(uint16_t avdtp_cid, uint8_t local_seid, uint16_t delay_100us);
|
||||
|
||||
/**
|
||||
* @brief De-Init AVDTP Sink.
|
||||
*/
|
||||
void avdtp_sink_deinit(void);
|
||||
|
||||
// AVDTP_SI_DELAYREPORT
|
||||
|
||||
/* API_END */
|
||||
|
@ -164,6 +164,9 @@ void avdtp_source_init(void) {
|
||||
avdtp_init();
|
||||
}
|
||||
|
||||
void avdtp_source_deinit(void){
|
||||
avdtp_deinit();
|
||||
}
|
||||
|
||||
static void avdtp_source_setup_media_header(uint8_t * media_packet, uint8_t marker, uint16_t sequence_number){
|
||||
uint8_t rtp_version = 2;
|
||||
|
@ -287,6 +287,11 @@ void avdtp_source_stream_endpoint_request_can_send_now(uint16_t avddp_cid, uint8
|
||||
*/
|
||||
int avdtp_max_media_payload_size(uint16_t avdtp_cid, uint8_t local_seid);
|
||||
|
||||
/**
|
||||
* @brief De-Init AVDTP Source.
|
||||
*/
|
||||
void avdtp_source_deinit(void);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user