avdtp: rename getter functions

This commit is contained in:
Milanka Ringwald 2020-07-03 14:26:44 +02:00
parent 1945fe3ea5
commit 1436d179b7
10 changed files with 83 additions and 84 deletions

View File

@ -180,7 +180,7 @@ avdtp_stream_endpoint_t * a2dp_sink_create_stream_endpoint(avdtp_media_type_t m
}
uint8_t a2dp_sink_establish_stream(bd_addr_t bd_addr, uint8_t local_seid, uint16_t * avdtp_cid){
sc.local_stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, &a2dp_sink_context);
sc.local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, &a2dp_sink_context);
if (!sc.local_stream_endpoint){
log_info("No local_stream_endpoint for seid %d", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;

View File

@ -556,7 +556,7 @@ avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t
}
uint8_t a2dp_source_establish_stream(bd_addr_t remote_addr, uint8_t loc_seid, uint16_t * a2dp_cid){
sc.local_stream_endpoint = avdtp_stream_endpoint_for_seid(loc_seid, &a2dp_source_context);
sc.local_stream_endpoint = avdtp_get_stream_endpoint_for_seid(loc_seid, &a2dp_source_context);
if (!sc.local_stream_endpoint){
log_error(" no local_stream_endpoint for seid %d", loc_seid);
return AVDTP_SEID_DOES_NOT_EXIST;

View File

@ -92,11 +92,11 @@ static uint16_t avdtp_get_next_cid(avdtp_context_t * context){
} else {
avdtp_cid_counter++;
}
} while (avdtp_connection_for_avdtp_cid(avdtp_cid_counter, context) != NULL) ;
} while (avdtp_get_connection_for_avdtp_cid(avdtp_cid_counter, context) != NULL) ;
return avdtp_cid_counter;
}
static avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_id(avdtp_context_t * context, uint16_t stream_endpoint_id) {
static avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_id(avdtp_context_t * context, uint16_t stream_endpoint_id) {
btstack_linked_item_t *it;
for (it = (btstack_linked_item_t *) context->stream_endpoints; it ; it = it->next){
avdtp_stream_endpoint_t * stream_endpoint = ((avdtp_stream_endpoint_t *) it);
@ -116,7 +116,7 @@ static uint16_t avdtp_get_next_local_seid(avdtp_context_t * context){
} else {
stream_endpoint_id++;
}
} while (avdtp_stream_endpoint_for_id(context, stream_endpoint_id) != NULL) ;
} while (avdtp_get_stream_endpoint_for_id(context, stream_endpoint_id) != NULL) ;
return stream_endpoint_id;
}
@ -138,7 +138,7 @@ uint8_t avdtp_connect(bd_addr_t remote, avdtp_context_t * avdtp_context, uint16_
return ERROR_CODE_COMMAND_DISALLOWED;
}
avdtp_connection_t * connection = avdtp_connection_for_bd_addr(remote, avdtp_context);
avdtp_connection_t * connection = avdtp_get_connection_for_bd_addr(remote, avdtp_context);
if (connection){
return ERROR_CODE_COMMAND_DISALLOWED;
}
@ -442,7 +442,7 @@ static void avdtp_handle_sdp_query_succeeded(avdtp_connection_t * connection){
}
static void avdtp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(sdp_query_context->avdtp_cid, sdp_query_context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(sdp_query_context->avdtp_cid, sdp_query_context);
if (!connection) {
log_error("SDP query, connection with 0x%02x cid not found", sdp_query_context->avdtp_cid);
return;
@ -502,13 +502,13 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
// log_info("avdtp_packet_handler packet type %02x, event %02x ", packet_type, hci_event_packet_get_type(packet));
switch (packet_type) {
case L2CAP_DATA_PACKET:
connection = avdtp_connection_for_l2cap_signaling_cid(channel, context);
connection = avdtp_get_connection_for_l2cap_signaling_cid(channel, context);
if (connection){
handle_l2cap_data_packet_for_signaling_connection(connection, packet, size, context);
break;
}
stream_endpoint = avdtp_stream_endpoint_for_l2cap_cid(channel, context);
stream_endpoint = avdtp_get_stream_endpoint_for_l2cap_cid(channel, context);
if (!stream_endpoint){
if (!connection) break;
handle_l2cap_data_packet_for_signaling_connection(connection, packet, size, context);
@ -545,9 +545,8 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
case L2CAP_EVENT_INCOMING_CONNECTION:
l2cap_event_incoming_connection_get_address(packet, event_addr);
local_cid = l2cap_event_incoming_connection_get_local_cid(packet);
connection = avdtp_connection_for_bd_addr(event_addr, context);
log_info("L2CAP_EVENT_INCOMING_CONNECTION, local cid 0x%02x ", local_cid);
connection = avdtp_get_connection_for_bd_addr(event_addr, context);
if (connection == NULL){
// create connection struct for regular inconming connection request
connection = avdtp_create_connection(event_addr, context);
@ -593,7 +592,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
}
// now, we're only dealing with media connections that are created by remote side - we're acceptor here
stream_endpoint = avdtp_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
if (!stream_endpoint) {
log_info("L2CAP_EVENT_INCOMING_CONNECTION no streamendpoint found for local seid %x", connection->acceptor_local_seid);
l2cap_decline_connection(local_cid);
@ -623,10 +622,10 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
// inform about new l2cap connection
l2cap_event_channel_opened_get_address(packet, event_addr);
local_cid = l2cap_event_channel_opened_get_local_cid(packet);
connection = avdtp_connection_for_bd_addr(event_addr, context);
connection = avdtp_get_connection_for_bd_addr(event_addr, context);
log_info("L2CAP_EVENT_CHANNEL_OPENED: status %d, cid 0x%02x , signaling connection %p ", status, local_cid, connection);
connection = avdtp_connection_for_bd_addr(event_addr, context);
connection = avdtp_get_connection_for_bd_addr(event_addr, context);
if (!connection){
log_info("L2CAP_EVENT_CHANNEL_OPENED 2: status %d, signaling connection %p ", status, connection);
break;
@ -652,7 +651,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
break;
}
stream_endpoint = avdtp_stream_endpoint_for_signaling_cid(connection->l2cap_signaling_cid, context);
stream_endpoint = avdtp_get_stream_endpoint_for_signaling_cid(connection->l2cap_signaling_cid, context);
if (!stream_endpoint){
log_info("L2CAP_EVENT_CHANNEL_OPENED: stream_endpoint not found for signaling cid 0x%02x", connection->l2cap_signaling_cid);
return;
@ -685,8 +684,8 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
case L2CAP_EVENT_CHANNEL_CLOSED:
local_cid = l2cap_event_channel_closed_get_local_cid(packet);
connection = avdtp_connection_for_l2cap_signaling_cid(local_cid, context);
stream_endpoint = avdtp_stream_endpoint_for_l2cap_cid(local_cid, context);
connection = avdtp_get_connection_for_l2cap_signaling_cid(local_cid, context);
stream_endpoint = avdtp_get_stream_endpoint_for_l2cap_cid(local_cid, context);
log_info("Received L2CAP_EVENT_CHANNEL_CLOSED, cid 0x%2x, connection %p, stream_endpoint %p", local_cid, connection, stream_endpoint);
if (stream_endpoint){
@ -736,9 +735,9 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
case L2CAP_EVENT_CAN_SEND_NOW:
log_debug("avdtp_packet_handler, L2CAP_EVENT_CAN_SEND_NOW l2cap_cid 0x%02x", channel);
connection = avdtp_connection_for_l2cap_signaling_cid(channel, context);
connection = avdtp_get_connection_for_l2cap_signaling_cid(channel, context);
if (!connection) {
stream_endpoint = avdtp_stream_endpoint_for_l2cap_cid(channel, context);
stream_endpoint = avdtp_get_stream_endpoint_for_l2cap_cid(channel, context);
if (!stream_endpoint->connection) break;
connection = stream_endpoint->connection;
}
@ -757,7 +756,7 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
}
uint8_t avdtp_disconnect(uint16_t avdtp_cid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection) return AVDTP_CONNECTION_DOES_NOT_EXIST;
if (connection->state == AVDTP_SIGNALING_CONNECTION_IDLE){
avdtp_signaling_emit_connection_released(context->avdtp_callback, connection->avdtp_cid);
@ -771,7 +770,7 @@ uint8_t avdtp_disconnect(uint16_t avdtp_cid, avdtp_context_t * context){
}
uint8_t avdtp_open_stream(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_media_connect: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -782,7 +781,7 @@ uint8_t avdtp_open_stream(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote
return AVDTP_CONNECTION_IN_WRONG_STATE;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_media_connect: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;
@ -805,13 +804,13 @@ uint8_t avdtp_open_stream(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote
}
uint8_t avdtp_start_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_start_stream: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_start_stream: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;
@ -839,13 +838,13 @@ uint8_t avdtp_start_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context
}
uint8_t avdtp_stop_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_stop_stream: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_stop_stream: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;
@ -868,13 +867,13 @@ uint8_t avdtp_stop_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_
}
uint8_t avdtp_abort_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_abort_stream: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_abort_stream: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;
@ -897,12 +896,12 @@ uint8_t avdtp_abort_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context
}
uint8_t avdtp_suspend_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_suspend_stream: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_suspend_stream: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;
@ -925,7 +924,7 @@ uint8_t avdtp_suspend_stream(uint16_t avdtp_cid, uint8_t local_seid, avdtp_conte
}
uint8_t avdtp_discover_stream_endpoints(uint16_t avdtp_cid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("avdtp_discover_stream_endpoints: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -942,7 +941,7 @@ uint8_t avdtp_discover_stream_endpoints(uint16_t avdtp_cid, avdtp_context_t * co
uint8_t avdtp_get_capabilities(uint16_t avdtp_cid, uint8_t remote_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -960,7 +959,7 @@ uint8_t avdtp_get_capabilities(uint16_t avdtp_cid, uint8_t remote_seid, avdtp_co
uint8_t avdtp_get_all_capabilities(uint16_t avdtp_cid, uint8_t remote_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -977,7 +976,7 @@ uint8_t avdtp_get_all_capabilities(uint16_t avdtp_cid, uint8_t remote_seid, avdt
}
uint8_t avdtp_get_configuration(uint16_t avdtp_cid, uint8_t remote_seid, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -994,7 +993,7 @@ uint8_t avdtp_get_configuration(uint16_t avdtp_cid, uint8_t remote_seid, avdtp_c
}
uint8_t avdtp_set_configuration(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -1009,7 +1008,7 @@ uint8_t avdtp_set_configuration(uint16_t avdtp_cid, uint8_t local_seid, uint8_t
return AVDTP_CONNECTION_IN_WRONG_STATE;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, context);
if (!stream_endpoint) {
log_error("No initiator stream endpoint for seid %d", local_seid);
return AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST;
@ -1040,7 +1039,7 @@ uint8_t avdtp_set_configuration(uint16_t avdtp_cid, uint8_t local_seid, uint8_t
}
uint8_t avdtp_reconfigure(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration, avdtp_context_t * context){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, context);
if (!connection){
log_error("No connection for AVDTP cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -1051,7 +1050,7 @@ uint8_t avdtp_reconfigure(uint16_t avdtp_cid, uint8_t local_seid, uint8_t remote
return AVDTP_CONNECTION_IN_WRONG_STATE;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, context);
if (!stream_endpoint) {
log_error("avdtp_reconfigure: no initiator stream endpoint for seid %d", local_seid);
return AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST;

View File

@ -162,7 +162,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, uint8_t
case AVDTP_SI_RECONFIGURE:
case AVDTP_SI_DELAYREPORT:
connection->acceptor_local_seid = packet[offset++] >> 2;
stream_endpoint = avdtp_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
if (!stream_endpoint){
log_info("ACP: cmd %d - RESPONSE REJECT", connection->acceptor_signaling_packet.signal_identifier);
connection->error_code = BAD_ACP_SEID;
@ -204,7 +204,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, uint8_t
}
// deal with first susspended seid
connection->acceptor_local_seid = connection->suspended_seids[0];
stream_endpoint = avdtp_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->acceptor_local_seid, context);
if (!stream_endpoint){
log_info("ACP: stream_endpoint not found, CATEGORY RESPONSE REJECT BAD_ACP_SEID");
connection->error_code = BAD_ACP_SEID;
@ -479,7 +479,7 @@ void avdtp_acceptor_stream_config_subsm_run(avdtp_connection_t * connection, avd
return;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(connection->acceptor_local_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(connection->acceptor_local_seid, context);
if (!stream_endpoint) return;
uint8_t reject_service_category = connection->reject_service_category;

View File

@ -81,9 +81,9 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
if (connection->initiator_connection_state == AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ANSWER) {
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
} else {
stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(connection->initiator_remote_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_associated_with_acp_seid(connection->initiator_remote_seid, context);
if (!stream_endpoint){
stream_endpoint = avdtp_stream_endpoint_with_seid(connection->initiator_local_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->initiator_local_seid, context);
}
if (!stream_endpoint) {
log_error("stream_endpoint for seid 0x%02x not found", connection->initiator_local_seid);
@ -370,9 +370,9 @@ void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection, av
bool sent = avdtp_initiator_stream_config_subsm_run_signaling(connection);
if (sent) return;
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_associated_with_acp_seid(connection->initiator_remote_seid, context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_associated_with_acp_seid(connection->initiator_remote_seid, context);
if (!stream_endpoint){
stream_endpoint = avdtp_stream_endpoint_with_seid(connection->initiator_local_seid, context);
stream_endpoint = avdtp_get_stream_endpoint_with_seid(connection->initiator_local_seid, context);
}
if (!stream_endpoint) return;

View File

@ -55,42 +55,42 @@
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
void avdtp_sink_register_media_transport_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_media_transport_category(stream_endpoint);
}
void avdtp_sink_register_reporting_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_reporting_category(stream_endpoint);
}
void avdtp_sink_register_delay_reporting_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_delay_reporting_category(stream_endpoint);
}
void avdtp_sink_register_recovery_category(uint8_t seid, uint8_t maximum_recovery_window_size, uint8_t maximum_number_media_packets){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_recovery_category(stream_endpoint, maximum_recovery_window_size, maximum_number_media_packets);
}
void avdtp_sink_register_content_protection_category(uint8_t seid, uint16_t cp_type, const uint8_t * cp_type_value, uint8_t cp_type_value_len){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_content_protection_category(stream_endpoint, cp_type, cp_type_value, cp_type_value_len);
}
void avdtp_sink_register_header_compression_category(uint8_t seid, uint8_t back_ch, uint8_t media, uint8_t recovery){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_header_compression_category(stream_endpoint, back_ch, media, recovery);
}
void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_media_codec_category(stream_endpoint, media_type, media_codec_type, media_codec_info, media_codec_info_len);
}
void avdtp_sink_register_multiplexing_category(uint8_t seid, uint8_t fragmentation){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_sink_context);
avdtp_register_multiplexing_category(stream_endpoint, fragmentation);
}
@ -195,7 +195,7 @@ uint8_t avdtp_sink_reconfigure(uint16_t avdtp_cid, uint8_t local_seid, uint8_t r
}
uint8_t avdtp_sink_delay_report(uint16_t avdtp_cid, uint8_t local_seid, uint16_t delay_100us){
avdtp_connection_t * connection = avdtp_connection_for_avdtp_cid(avdtp_cid, avdtp_sink_context);
avdtp_connection_t * connection = avdtp_get_connection_for_avdtp_cid(avdtp_cid, avdtp_sink_context);
if (!connection){
log_error("delay_report: no connection for signaling cid 0x%02x found", avdtp_cid);
return AVDTP_CONNECTION_DOES_NOT_EXIST;
@ -207,7 +207,7 @@ uint8_t avdtp_sink_delay_report(uint16_t avdtp_cid, uint8_t local_seid, uint16_t
return AVDTP_CONNECTION_IN_WRONG_STATE;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_with_seid(local_seid, avdtp_sink_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_with_seid(local_seid, avdtp_sink_context);
if (!stream_endpoint) {
log_error("delay_report: no stream_endpoint with seid %d found", local_seid);
return AVDTP_SEID_DOES_NOT_EXIST;

View File

@ -57,42 +57,42 @@
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
void avdtp_source_register_media_transport_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_media_transport_category(stream_endpoint);
}
void avdtp_source_register_reporting_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_reporting_category(stream_endpoint);
}
void avdtp_source_register_delay_reporting_category(uint8_t seid){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_delay_reporting_category(stream_endpoint);
}
void avdtp_source_register_recovery_category(uint8_t seid, uint8_t maximum_recovery_window_size, uint8_t maximum_number_media_packets){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_recovery_category(stream_endpoint, maximum_recovery_window_size, maximum_number_media_packets);
}
void avdtp_source_register_content_protection_category(uint8_t seid, uint16_t cp_type, const uint8_t * cp_type_value, uint8_t cp_type_value_len){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_content_protection_category(stream_endpoint, cp_type, cp_type_value, cp_type_value_len);
}
void avdtp_source_register_header_compression_category(uint8_t seid, uint8_t back_ch, uint8_t media, uint8_t recovery){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_header_compression_category(stream_endpoint, back_ch, media, recovery);
}
void avdtp_source_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_media_codec_category(stream_endpoint, media_type, media_codec_type, media_codec_info, media_codec_info_len);
}
void avdtp_source_register_multiplexing_category(uint8_t seid, uint8_t fragmentation){
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid, avdtp_source_context);
avdtp_register_multiplexing_category(stream_endpoint, fragmentation);
}
@ -228,7 +228,7 @@ int avdtp_source_stream_send_media_payload(uint16_t avdtp_cid, uint8_t local_sei
log_error("avdtp source: avdtp cid 0x%02x not known, expected 0x%02x", avdtp_cid, avdtp_source_context->avdtp_cid);
return 0;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, avdtp_source_context);
if (!stream_endpoint) {
log_error("avdtp source: no stream_endpoint with seid %d", local_seid);
return 0;
@ -257,7 +257,7 @@ void avdtp_source_stream_endpoint_request_can_send_now(uint16_t avdtp_cid, uint8
log_error("AVDTP source: avdtp cid 0x%02x not known, expected 0x%02x", avdtp_cid, avdtp_source_context->avdtp_cid);
return;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, avdtp_source_context);
if (!stream_endpoint) {
log_error("AVDTP source: no stream_endpoint with seid %d", local_seid);
return;
@ -271,7 +271,7 @@ int avdtp_max_media_payload_size(uint16_t avdtp_cid, uint8_t local_seid){
log_error("A2DP source: a2dp cid 0x%02x not known, expected 0x%02x", avdtp_cid, avdtp_source_context->avdtp_cid);
return 0;
}
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, avdtp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, avdtp_source_context);
if (!stream_endpoint) {
log_error("A2DP source: no stream_endpoint with seid %d", local_seid);
return 0;

View File

@ -99,7 +99,7 @@ void avdtp_reset_stream_endpoint(avdtp_stream_endpoint_t * stream_endpoint){
stream_endpoint->sequence_number = 0;
}
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_seid(uint16_t seid, avdtp_context_t * context){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){
@ -111,7 +111,7 @@ avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_seid(uint16_t seid, avdtp_co
return NULL;
}
avdtp_connection_t * avdtp_connection_for_bd_addr(bd_addr_t addr, avdtp_context_t * context){
avdtp_connection_t * avdtp_get_connection_for_bd_addr(bd_addr_t addr, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->connections);
while (btstack_linked_list_iterator_has_next(&it)){
@ -122,7 +122,7 @@ avdtp_connection_t * avdtp_connection_for_bd_addr(bd_addr_t addr, avdtp_context_
return NULL;
}
avdtp_connection_t * avdtp_connection_for_avdtp_cid(uint16_t avdtp_cid, avdtp_context_t * context){
avdtp_connection_t * avdtp_get_connection_for_avdtp_cid(uint16_t avdtp_cid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->connections);
while (btstack_linked_list_iterator_has_next(&it)){
@ -133,7 +133,7 @@ avdtp_connection_t * avdtp_connection_for_avdtp_cid(uint16_t avdtp_cid, avdtp_co
return NULL;
}
avdtp_connection_t * avdtp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context){
avdtp_connection_t * avdtp_get_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->connections);
while (btstack_linked_list_iterator_has_next(&it)){
@ -144,7 +144,7 @@ avdtp_connection_t * avdtp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid
return NULL;
}
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_l2cap_cid(uint16_t l2cap_cid, avdtp_context_t * context){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_l2cap_cid(uint16_t l2cap_cid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){
@ -162,7 +162,7 @@ avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_l2cap_cid(uint16_t l2cap_cid
return NULL;
}
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){
@ -176,7 +176,7 @@ avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_signaling_cid(uint16_t l2cap
return NULL;
}
avdtp_stream_endpoint_t * avdtp_stream_endpoint_with_seid(uint8_t seid, avdtp_context_t * context){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_with_seid(uint8_t seid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){
@ -188,7 +188,7 @@ avdtp_stream_endpoint_t * avdtp_stream_endpoint_with_seid(uint8_t seid, avdtp_co
return NULL;
}
avdtp_stream_endpoint_t * avdtp_stream_endpoint_associated_with_acp_seid(uint16_t acp_seid, avdtp_context_t * context){
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_associated_with_acp_seid(uint16_t acp_seid, avdtp_context_t * context){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &context->stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){

View File

@ -52,14 +52,14 @@
extern "C" {
#endif
avdtp_connection_t * avdtp_connection_for_bd_addr(bd_addr_t addr, avdtp_context_t * context);
avdtp_connection_t * avdtp_connection_for_avdtp_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_connection_t * avdtp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_l2cap_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_stream_endpoint_with_seid(uint8_t seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_stream_endpoint_associated_with_acp_seid(uint16_t acp_seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_seid(uint16_t seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_stream_endpoint_for_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_connection_t * avdtp_get_connection_for_bd_addr(bd_addr_t addr, avdtp_context_t * context);
avdtp_connection_t * avdtp_get_connection_for_avdtp_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_connection_t * avdtp_get_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_l2cap_cid(uint16_t l2cap_cid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_with_seid(uint8_t seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_associated_with_acp_seid(uint16_t acp_seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid, avdtp_context_t * context);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_signaling_cid(uint16_t l2cap_cid, avdtp_context_t * context);
static inline uint8_t avdtp_header(uint8_t tr_label, avdtp_packet_type_t packet_type, avdtp_message_type_t msg_type){
return (tr_label<<4) | ((uint8_t)packet_type<<2) | (uint8_t)msg_type;

View File

@ -265,7 +265,7 @@ static void avdtp_audio_timeout_handler(btstack_timer_source_t * timer){
context->sbc_ready_to_send = 1;
// a2dp_source_stream_endpoint_request_can_send_now(context->local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(context->local_seid, &a2dp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(context->local_seid, &a2dp_source_context);
if (!stream_endpoint) {
printf("no stream_endpoint for seid %d\n", context->local_seid);
return;
@ -278,7 +278,7 @@ static void avdtp_audio_timeout_handler(btstack_timer_source_t * timer){
}
// static int avdtp_max_media_payload_size(uint8_t local_seid){
// avdtp_stream_endpoint_t * stream_endpoint = avdtp_stream_endpoint_for_seid(local_seid, &a2dp_source_context);
// avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(local_seid, &a2dp_source_context);
// if (!stream_endpoint) {
// log_error("no stream_endpoint found for seid %d", local_seid);
// return 0;