mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-10 15:40:11 +00:00
remove sep tracking from demo apps
This commit is contained in:
parent
85efc5ac63
commit
9e42cfcc12
@ -451,21 +451,25 @@ void avdtp_disconnect(uint16_t con_handle, avdtp_context_t * context){
|
||||
avdtp_request_can_send_now_self(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
||||
void avdtp_open_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context){
|
||||
void avdtp_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_media_connect: no connection for handle 0x%02x found\n", con_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (avdtp_find_remote_sep(connection, acp_seid) == 0xFF){
|
||||
printf("avdtp_media_connect: no remote sep for seid %d found\n", acp_seid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) {
|
||||
printf("avdtp_media_connect: wrong connection state %d\n", connection->state);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(acp_seid, context);
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(int_seid, context);
|
||||
if (!stream_endpoint) {
|
||||
printf("avdtp_media_connect: no stream_endpoint with acp seid %d found\n", acp_seid);
|
||||
printf("avdtp_media_connect: no stream_endpoint with seid %d found\n", int_seid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -480,21 +484,25 @@ void avdtp_open_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t *
|
||||
avdtp_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
||||
void avdtp_start_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context){
|
||||
void avdtp_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_media_connect: no connection for handle 0x%02x found\n", con_handle);
|
||||
printf("avdtp_start_stream: no connection for handle 0x%02x found\n", con_handle);
|
||||
return;
|
||||
}
|
||||
if (avdtp_find_remote_sep(connection, acp_seid) == 0xFF){
|
||||
printf("avdtp_start_stream: no remote sep for seid %d found\n", acp_seid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) {
|
||||
printf("avdtp_media_connect: wrong connection state %d\n", connection->state);
|
||||
printf("avdtp_start_stream: wrong connection state %d\n", connection->state);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(acp_seid, context);
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(int_seid, context);
|
||||
if (!stream_endpoint) {
|
||||
printf("avdtp_media_connect: no stream_endpoint with acp_seid %d found\n", acp_seid);
|
||||
printf("avdtp_start_stream: no stream_endpoint with seid %d found\n", int_seid);
|
||||
return;
|
||||
}
|
||||
if (stream_endpoint->remote_sep_index == 0xFF) return;
|
||||
@ -506,20 +514,25 @@ void avdtp_start_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t *
|
||||
avdtp_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
||||
void avdtp_stop_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context){
|
||||
void avdtp_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_stop_stream: no connection for handle 0x%02x found\n", con_handle);
|
||||
return;
|
||||
}
|
||||
if (avdtp_find_remote_sep(connection, acp_seid) == 0xFF){
|
||||
printf("avdtp_stop_stream: no remote sep for seid %d found\n", acp_seid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) {
|
||||
printf("avdtp_stop_stream: wrong connection state %d\n", connection->state);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(acp_seid, context);
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(int_seid, context);
|
||||
if (!stream_endpoint) {
|
||||
printf("avdtp_stop_stream: no stream_endpoint with acp seid %d found\n", acp_seid);
|
||||
printf("avdtp_stop_stream: no stream_endpoint with seid %d found\n", int_seid);
|
||||
return;
|
||||
}
|
||||
if (stream_endpoint->remote_sep_index == 0xFF) return;
|
||||
@ -538,21 +551,25 @@ void avdtp_stop_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t *
|
||||
}
|
||||
}
|
||||
|
||||
void avdtp_abort_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context){
|
||||
void avdtp_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_abort_stream: no connection for handle 0x%02x found\n", con_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (avdtp_find_remote_sep(connection, acp_seid) == 0xFF){
|
||||
printf("avdtp_abort_stream: no remote sep for seid %d found\n", acp_seid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) {
|
||||
printf("avdtp_abort_stream: wrong connection state %d\n", connection->state);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(acp_seid, context);
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(int_seid, context);
|
||||
if (!stream_endpoint) {
|
||||
printf("avdtp_abort_stream: no stream_endpoint for seid %d found\n", acp_seid);
|
||||
printf("avdtp_abort_stream: no stream_endpoint with seid %d found\n", int_seid);
|
||||
return;
|
||||
}
|
||||
if (stream_endpoint->remote_sep_index == 0xFF) return;
|
||||
@ -672,6 +689,7 @@ void avdtp_reconfigure(uint16_t con_handle, uint8_t acp_seid, uint16_t configure
|
||||
if (connection->state < AVDTP_SIGNALING_CONNECTION_OPENED) return;
|
||||
if (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE) return;
|
||||
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(acp_seid, context);
|
||||
|
||||
if (!stream_endpoint) return;
|
||||
if (stream_endpoint->remote_sep_index == 0xFF) return;
|
||||
connection->initiator_transaction_label++;
|
||||
@ -700,3 +718,21 @@ void avdtp_suspend(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * cont
|
||||
stream_endpoint->initiator_config_state = AVDTP_INITIATOR_W2_SUSPEND_STREAM_WITH_SEID;
|
||||
avdtp_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
||||
uint8_t avdtp_remote_seps_num(uint16_t con_handle, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_suspend: no connection for handle 0x%02x found\n", con_handle);
|
||||
return 0;
|
||||
}
|
||||
return connection->remote_seps_num;
|
||||
}
|
||||
|
||||
avdtp_sep_t * avdtp_remote_sep(uint16_t con_handle, uint8_t index, avdtp_context_t * context){
|
||||
avdtp_connection_t * connection = avdtp_connection_for_con_handle(con_handle, context);
|
||||
if (!connection){
|
||||
printf("avdtp_suspend: no connection for handle 0x%02x found\n", con_handle);
|
||||
return NULL;
|
||||
}
|
||||
return &connection->remote_seps[index];
|
||||
}
|
@ -476,10 +476,11 @@ avdtp_connection_t * avdtp_create_connection(bd_addr_t remote_addr, avdtp_contex
|
||||
avdtp_stream_endpoint_t * avdtp_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type, avdtp_context_t * context);
|
||||
|
||||
void avdtp_disconnect(uint16_t con_handle, avdtp_context_t * context);
|
||||
void avdtp_open_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_start_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_stop_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_abort_stream(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, avdtp_context_t * context);
|
||||
|
||||
void avdtp_discover_stream_endpoints(uint16_t con_handle, avdtp_context_t * context);
|
||||
void avdtp_get_capabilities(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
void avdtp_get_all_capabilities(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
@ -487,6 +488,8 @@ void avdtp_get_configuration(uint16_t con_handle, uint8_t acp_seid, avdtp_contex
|
||||
void avdtp_set_configuration(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration, avdtp_context_t * context);
|
||||
void avdtp_reconfigure(uint16_t con_handle, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration, avdtp_context_t * context);
|
||||
void avdtp_suspend(uint16_t con_handle, uint8_t acp_seid, avdtp_context_t * context);
|
||||
uint8_t avdtp_remote_seps_num(uint16_t con_handle, avdtp_context_t * context);
|
||||
avdtp_sep_t * avdtp_remote_sep(uint16_t con_handle, uint8_t index, avdtp_context_t * context);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
sep.media_type = (avdtp_media_type_t)(packet[i+1] >> 4);
|
||||
sep.type = (avdtp_sep_type_t)((packet[i+1] >> 3) & 0x01);
|
||||
|
||||
if (avdtp_find_remote_sep(stream_endpoint->connection, sep.seid) == 0xFF){
|
||||
if (avdtp_find_remote_sep(connection, sep.seid) == 0xFF){
|
||||
connection->remote_seps[connection->remote_seps_num++] = sep;
|
||||
}
|
||||
avdtp_signaling_emit_sep(context->avdtp_callback, connection->con_handle, sep);
|
||||
@ -161,12 +161,12 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
sep.configured_service_categories = avdtp_unpack_service_capabilities(connection, &sep.configuration, connection->signaling_packet.command+4, connection->signaling_packet.size-4);
|
||||
// TODO check if configuration is supported
|
||||
|
||||
remote_sep_index = avdtp_find_remote_sep(stream_endpoint->connection, sep.seid);
|
||||
remote_sep_index = avdtp_find_remote_sep(connection, sep.seid);
|
||||
if (remote_sep_index != 0xFF){
|
||||
stream_endpoint->remote_sep_index = remote_sep_index;
|
||||
stream_endpoint->connection->remote_seps[stream_endpoint->remote_sep_index] = sep;
|
||||
connection->remote_seps[stream_endpoint->remote_sep_index] = sep;
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURED;
|
||||
printf(" INT: update seid %d, to %p\n", stream_endpoint->connection->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
printf(" INT: update seid %d, to %p\n", connection->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -178,15 +178,15 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
// TODO check if configuration is supported
|
||||
|
||||
// find or add sep
|
||||
remote_sep_index = avdtp_find_remote_sep(stream_endpoint->connection, sep.seid);
|
||||
remote_sep_index = avdtp_find_remote_sep(connection, sep.seid);
|
||||
if (remote_sep_index != 0xFF){
|
||||
stream_endpoint->remote_sep_index = remote_sep_index;
|
||||
} else {
|
||||
stream_endpoint->remote_sep_index = stream_endpoint->connection->remote_seps_num;
|
||||
stream_endpoint->remote_sep_index = connection->remote_seps_num;
|
||||
stream_endpoint->connection->remote_seps_num++;
|
||||
}
|
||||
stream_endpoint->connection->remote_seps[stream_endpoint->remote_sep_index] = sep;
|
||||
printf(" INT: configured remote seid %d, to %p\n", stream_endpoint->connection->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
connection->remote_seps[stream_endpoint->remote_sep_index] = sep;
|
||||
printf(" INT: configured remote seid %d, to %p\n", connection->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURED;
|
||||
break;
|
||||
}
|
||||
|
@ -237,20 +237,20 @@ void avdtp_sink_disconnect(uint16_t con_handle){
|
||||
avdtp_disconnect(con_handle, &avdtp_sink_context);
|
||||
}
|
||||
|
||||
void avdtp_sink_open_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_open_stream(con_handle, acp_seid, &avdtp_sink_context);
|
||||
void avdtp_sink_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_open_stream(con_handle, int_seid, acp_seid, &avdtp_sink_context);
|
||||
}
|
||||
|
||||
void avdtp_sink_start_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_start_stream(con_handle, acp_seid, &avdtp_sink_context);
|
||||
void avdtp_sink_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_start_stream(con_handle, int_seid, acp_seid, &avdtp_sink_context);
|
||||
}
|
||||
|
||||
void avdtp_sink_stop_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_stop_stream(con_handle, acp_seid, &avdtp_sink_context);
|
||||
void avdtp_sink_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_stop_stream(con_handle, int_seid, acp_seid, &avdtp_sink_context);
|
||||
}
|
||||
|
||||
void avdtp_sink_abort_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_abort_stream(con_handle, acp_seid, &avdtp_sink_context);
|
||||
void avdtp_sink_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_abort_stream(con_handle, int_seid, acp_seid, &avdtp_sink_context);
|
||||
}
|
||||
|
||||
void avdtp_sink_discover_stream_endpoints(uint16_t con_handle){
|
||||
|
@ -152,28 +152,28 @@ void avdtp_sink_suspend(uint16_t con_handle, uint8_t acp_seid);
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_sink_open_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_sink_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_sink_start_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_sink_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_sink_abort_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_sink_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_sink_stop_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_sink_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/* API_END */
|
||||
|
||||
|
@ -206,20 +206,20 @@ void avdtp_source_disconnect(uint16_t con_handle){
|
||||
avdtp_disconnect(con_handle, &avdtp_source_context);
|
||||
}
|
||||
|
||||
void avdtp_source_open_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_open_stream(con_handle, acp_seid, &avdtp_source_context);
|
||||
void avdtp_source_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_open_stream(con_handle, int_seid, acp_seid, &avdtp_source_context);
|
||||
}
|
||||
|
||||
void avdtp_source_start_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_start_stream(con_handle, acp_seid, &avdtp_source_context);
|
||||
void avdtp_source_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_start_stream(con_handle, int_seid, acp_seid, &avdtp_source_context);
|
||||
}
|
||||
|
||||
void avdtp_source_stop_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_stop_stream(con_handle, acp_seid, &avdtp_source_context);
|
||||
void avdtp_source_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_stop_stream(con_handle, int_seid, acp_seid, &avdtp_source_context);
|
||||
}
|
||||
|
||||
void avdtp_source_abort_stream(uint16_t con_handle, uint8_t acp_seid){
|
||||
avdtp_abort_stream(con_handle, acp_seid, &avdtp_source_context);
|
||||
void avdtp_source_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid){
|
||||
avdtp_abort_stream(con_handle, int_seid, acp_seid, &avdtp_source_context);
|
||||
}
|
||||
|
||||
void avdtp_source_discover_stream_endpoints(uint16_t con_handle){
|
||||
@ -365,3 +365,10 @@ void avdtp_source_stream_send_media_payload(uint16_t l2cap_media_cid, btstack_ri
|
||||
l2cap_send_prepared(l2cap_media_cid, offset);
|
||||
}
|
||||
|
||||
uint8_t avdtp_source_remote_seps_num(uint16_t con_handle){
|
||||
return avdtp_remote_seps_num(con_handle, &avdtp_source_context);
|
||||
}
|
||||
|
||||
avdtp_sep_t * avdtp_source_remote_sep(uint16_t con_handle, uint8_t index){
|
||||
return avdtp_remote_sep(con_handle, index, &avdtp_source_context);
|
||||
}
|
||||
|
@ -140,34 +140,37 @@ void avdtp_source_suspend(uint16_t con_handle, uint8_t acp_seid);
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_source_open_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_source_open_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_source_start_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_source_start_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_source_abort_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_source_abort_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
/**
|
||||
* @brief Start stream
|
||||
* @param con_handle
|
||||
* @param seid
|
||||
*/
|
||||
void avdtp_source_stop_stream(uint16_t con_handle, uint8_t acp_seid);
|
||||
void avdtp_source_stop_stream(uint16_t con_handle, uint8_t int_seid, uint8_t acp_seid);
|
||||
|
||||
avdtp_stream_endpoint_t * avdtp_source_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type);
|
||||
|
||||
int avdtp_source_streaming_endpoint_ready(uint16_t con_handle);
|
||||
void avdtp_source_request_can_send_now(uint16_t con_handle);
|
||||
void avdtp_source_stream_send_media_payload(uint16_t l2cap_media_cid, btstack_ring_buffer_t * sbc_ring_buffer, uint8_t marker);
|
||||
|
||||
uint8_t avdtp_source_remote_seps_num(uint16_t con_handle);
|
||||
avdtp_sep_t * avdtp_source_remote_sep(uint16_t con_handle, uint8_t index);
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
@ -600,19 +600,19 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
break;
|
||||
case 'o':
|
||||
app_state = AVDTP_APPLICATION_W2_OPEN_STREAM_WITH_SEID;
|
||||
avdtp_sink_open_stream(con_handle, sep.seid);
|
||||
avdtp_sink_open_stream(con_handle, local_stream_endpoint->sep.seid, sep.seid);
|
||||
break;
|
||||
case 'm':
|
||||
app_state = AVDTP_APPLICATION_W2_START_STREAM_WITH_SEID;
|
||||
avdtp_sink_start_stream(con_handle, sep.seid);
|
||||
avdtp_sink_start_stream(con_handle, local_stream_endpoint->sep.seid, sep.seid);
|
||||
break;
|
||||
case 'A':
|
||||
app_state = AVDTP_APPLICATION_W2_ABORT_STREAM_WITH_SEID;
|
||||
avdtp_sink_abort_stream(con_handle, sep.seid);
|
||||
avdtp_sink_abort_stream(con_handle, local_stream_endpoint->sep.seid, sep.seid);
|
||||
break;
|
||||
case 'S':
|
||||
app_state = AVDTP_APPLICATION_W2_STOP_STREAM_WITH_SEID;
|
||||
avdtp_sink_stop_stream(con_handle, sep.seid);
|
||||
avdtp_sink_stop_stream(con_handle, local_stream_endpoint->sep.seid, sep.seid);
|
||||
break;
|
||||
case 'P':
|
||||
app_state = AVDTP_APPLICATION_W2_SUSPEND_STREAM_WITH_SEID;
|
||||
|
@ -137,8 +137,8 @@ static avdtp_stream_endpoint_t * local_stream_endpoint;
|
||||
static uint16_t remote_configuration_bitmap;
|
||||
static avdtp_capabilities_t remote_configuration;
|
||||
|
||||
static avdtp_sep_t remote_seps[MAX_NUM_SEPS];
|
||||
static uint16_t num_remote_seps = 0;
|
||||
// static avdtp_sep_t remote_seps[MAX_NUM_SEPS];
|
||||
// static uint16_t num_remote_seps = 0;
|
||||
static int next_remote_sep_index_to_query = -1;
|
||||
static avdtp_sep_t * active_remote_sep = NULL;
|
||||
|
||||
@ -295,7 +295,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
break;
|
||||
}
|
||||
active_remote_sep = NULL;
|
||||
num_remote_seps = 0;
|
||||
next_remote_sep_index_to_query = -1;
|
||||
app_state = AVDTP_APPLICATION_CONNECTED;
|
||||
printf(" --- avdtp source --- AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED, con handle 0x%02x ---\n", con_handle);
|
||||
@ -318,8 +317,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
sep.in_use = avdtp_subevent_signaling_sep_found_get_in_use(packet);
|
||||
sep.media_type = avdtp_subevent_signaling_sep_found_get_media_type(packet);
|
||||
sep.type = avdtp_subevent_signaling_sep_found_get_sep_type(packet);
|
||||
remote_seps[num_remote_seps++] = sep;
|
||||
printf(" --- avdtp source --- Found sep [%d]: seid %u, in_use %d, media type %d, sep type %d (1-SNK)\n", num_remote_seps, sep.seid, sep.in_use, sep.media_type, sep.type);
|
||||
printf(" --- avdtp source --- Found sep: seid %u, in_use %d, media type %d, sep type %d (1-SNK)\n", sep.seid, sep.in_use, sep.media_type, sep.type);
|
||||
break;
|
||||
|
||||
case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY:{
|
||||
@ -344,7 +342,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
avdtp_choose_sbc_configuration_from_sbc_codec_information(&sbc_capability, media_sbc_codec_configuration);
|
||||
app_state = AVDTP_APPLICATION_W2_SET_CONFIGURATION;
|
||||
|
||||
active_remote_sep = &remote_seps[next_remote_sep_index_to_query];
|
||||
active_remote_sep = avdtp_source_remote_sep(con_handle, next_remote_sep_index_to_query);
|
||||
remote_configuration_bitmap = store_bit16(remote_configuration_bitmap, AVDTP_MEDIA_CODEC, 1);
|
||||
remote_configuration.media_codec.media_type = AVDTP_AUDIO;
|
||||
remote_configuration.media_codec.media_codec_type = AVDTP_CODEC_SBC;
|
||||
@ -383,15 +381,15 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
case AVDTP_APPLICATION_W2_DISCOVER_SEPS:
|
||||
app_state = AVDTP_APPLICATION_W2_GET_ALL_CAPABILITIES;
|
||||
next_remote_sep_index_to_query = 0;
|
||||
printf(" --- avdtp source --- Query get caps for seid %d\n", remote_seps[next_remote_sep_index_to_query].seid);
|
||||
avdtp_source_get_capabilities(con_handle, remote_seps[next_remote_sep_index_to_query].seid);
|
||||
printf(" --- avdtp source --- Query get caps for seid %d\n", avdtp_source_remote_sep(con_handle, next_remote_sep_index_to_query)->seid);
|
||||
avdtp_source_get_capabilities(con_handle, avdtp_source_remote_sep(con_handle, next_remote_sep_index_to_query)->seid);
|
||||
break;
|
||||
case AVDTP_APPLICATION_W2_GET_CAPABILITIES:
|
||||
case AVDTP_APPLICATION_W2_GET_ALL_CAPABILITIES:
|
||||
if (next_remote_sep_index_to_query < num_remote_seps - 1){
|
||||
if (next_remote_sep_index_to_query < avdtp_source_remote_seps_num(con_handle) - 1){
|
||||
next_remote_sep_index_to_query++;
|
||||
printf(" --- avdtp source --- Query get caps for seid %d\n", remote_seps[next_remote_sep_index_to_query].seid);
|
||||
avdtp_source_get_capabilities(con_handle, remote_seps[next_remote_sep_index_to_query].seid);
|
||||
printf(" --- avdtp source --- Query get caps for seid %d\n", avdtp_source_remote_sep(con_handle, next_remote_sep_index_to_query)->seid);
|
||||
avdtp_source_get_capabilities(con_handle, avdtp_source_remote_sep(con_handle, next_remote_sep_index_to_query)->seid);
|
||||
} else {
|
||||
printf(" --- avdtp source --- Cannot query get caps, index %d\n", next_remote_sep_index_to_query);
|
||||
app_state = AVDTP_APPLICATION_IDLE;
|
||||
@ -411,7 +409,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
sbc_configuration.block_length, sbc_configuration.subbands,
|
||||
sbc_configuration.allocation_method, sbc_configuration.sampling_frequency,
|
||||
sbc_configuration.max_bitpool_value);
|
||||
avdtp_source_open_stream(con_handle, active_remote_sep->seid);
|
||||
avdtp_source_open_stream(con_handle, local_stream_endpoint->sep.seid, active_remote_sep->seid);
|
||||
break;
|
||||
case AVDTP_APPLICATION_STREAMING_OPENED:
|
||||
switch (signal_identifier){
|
||||
@ -647,15 +645,15 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
break;
|
||||
case 'm':
|
||||
app_state = AVDTP_APPLICATION_W2_START_STREAM_WITH_SEID;
|
||||
avdtp_source_start_stream(con_handle, active_remote_sep->seid);
|
||||
avdtp_source_start_stream(con_handle, local_stream_endpoint->sep.seid, active_remote_sep->seid);
|
||||
break;
|
||||
case 'A':
|
||||
app_state = AVDTP_APPLICATION_W2_ABORT_STREAM_WITH_SEID;
|
||||
avdtp_source_abort_stream(con_handle, active_remote_sep->seid);
|
||||
avdtp_source_abort_stream(con_handle, local_stream_endpoint->sep.seid, active_remote_sep->seid);
|
||||
break;
|
||||
case 'S':
|
||||
app_state = AVDTP_APPLICATION_W2_STOP_STREAM_WITH_SEID;
|
||||
avdtp_source_stop_stream(con_handle, active_remote_sep->seid);
|
||||
avdtp_source_stop_stream(con_handle, local_stream_endpoint->sep.seid, active_remote_sep->seid);
|
||||
break;
|
||||
case 'P':
|
||||
app_state = AVDTP_APPLICATION_W2_SUSPEND_STREAM_WITH_SEID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user