mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 11:42:34 +00:00
a2dp: remove redundant functions
This commit is contained in:
parent
2dbb0487a7
commit
22bed8e12d
@ -225,12 +225,12 @@ static void a2dp_sink_packet_handler_internal(uint8_t packet_type, uint16_t chan
|
||||
// only care for outgoing connections
|
||||
if (!outgoing_active) break;
|
||||
outgoing_active = false;
|
||||
a2dp_emit_signaling_connection_established(a2dp_sink_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_sink_packet_handler_user, packet, size, A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED);
|
||||
log_info("A2DP sink signaling connection failed status %d", status);
|
||||
break;
|
||||
}
|
||||
|
||||
a2dp_emit_signaling_connection_established(a2dp_sink_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_sink_packet_handler_user, packet, size, A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED);
|
||||
log_info("A2DP sink signaling connection established avdtp_cid 0x%02x", cid);
|
||||
break;
|
||||
|
||||
@ -264,12 +264,12 @@ static void a2dp_sink_packet_handler_internal(uint8_t packet_type, uint16_t chan
|
||||
status = avdtp_subevent_streaming_connection_established_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
log_info("A2DP sink streaming connection could not be established, avdtp_cid 0x%02x, status 0x%02x ---", cid, status);
|
||||
a2dp_emit_streaming_connection_established(a2dp_sink_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_sink_packet_handler_user, packet, size, A2DP_SUBEVENT_STREAM_ESTABLISHED);
|
||||
break;
|
||||
}
|
||||
|
||||
log_info("A2DP streaming connection established --- avdtp_cid 0x%02x, local seid %d, remote seid %d", cid, local_seid, remote_seid);
|
||||
a2dp_emit_streaming_connection_established(a2dp_sink_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_sink_packet_handler_user, packet, size, A2DP_SUBEVENT_STREAM_ESTABLISHED);
|
||||
break;
|
||||
|
||||
case AVDTP_SUBEVENT_SIGNALING_ACCEPT:
|
||||
@ -325,13 +325,7 @@ static void a2dp_sink_packet_handler_internal(uint8_t packet_type, uint16_t chan
|
||||
if (cid != a2dp_sink_cid) break;
|
||||
|
||||
stream_endpoint_configured = false;
|
||||
// for outgoing connections, suppress release event and report stream established failed
|
||||
if (outgoing_active){
|
||||
outgoing_active = false;
|
||||
log_info("A2DP sink outgoing connection failed - disconnect");
|
||||
a2dp_emit_signaling_connection_established(a2dp_sink_packet_handler_user, packet, size, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
break;
|
||||
}
|
||||
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_sink_packet_handler_user, packet, size, A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED);
|
||||
break;
|
||||
|
@ -294,14 +294,14 @@ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t ch
|
||||
if (outgoing_active && (a2dp_source_cid == cid)){
|
||||
log_info("A2DP source signaling connection failed status 0x%02x", status);
|
||||
outgoing_active = false;
|
||||
a2dp_emit_signaling_connection_established(a2dp_source_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_source_packet_handler_user, packet, size, A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
log_info("A2DP source signaling connection established avdtp_cid 0x%02x", cid);
|
||||
|
||||
// notify app
|
||||
a2dp_emit_signaling_connection_established(a2dp_source_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_source_packet_handler_user, packet, size, A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED);
|
||||
|
||||
// we already have a valid setup
|
||||
if (stream_endpoint_configured) return;
|
||||
@ -509,13 +509,13 @@ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t ch
|
||||
status = avdtp_subevent_streaming_connection_established_get_status(packet);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
log_info("A2DP source streaming connection could not be established, avdtp_cid 0x%02x, status 0x%02x ---", cid, status);
|
||||
a2dp_emit_streaming_connection_established(a2dp_source_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_source_packet_handler_user, packet, size, A2DP_SUBEVENT_STREAM_ESTABLISHED);
|
||||
break;
|
||||
}
|
||||
|
||||
log_info("A2DP source streaming connection established --- avdtp_cid 0x%02x, local seid 0x%02x, remote seid 0x%02x", cid, local_seid, remote_seid);
|
||||
a2dp_source_state = A2DP_STREAMING_OPENED;
|
||||
a2dp_emit_streaming_connection_established(a2dp_source_packet_handler_user, packet, size, status);
|
||||
a2dp_replace_subevent_id_and_emit_cmd(a2dp_source_packet_handler_user, packet, size, A2DP_SUBEVENT_STREAM_ESTABLISHED);
|
||||
break;
|
||||
|
||||
case AVDTP_SUBEVENT_SIGNALING_ACCEPT:
|
||||
|
@ -1043,22 +1043,6 @@ void a2dp_replace_subevent_id_and_emit_cmd(btstack_packet_handler_t callback, ui
|
||||
(*callback)(HCI_EVENT_PACKET, 0, packet, size);
|
||||
}
|
||||
|
||||
void a2dp_emit_streaming_connection_established(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size, uint8_t status){
|
||||
btstack_assert(callback != NULL);
|
||||
packet[0] = HCI_EVENT_A2DP_META;
|
||||
packet[2] = A2DP_SUBEVENT_STREAM_ESTABLISHED;
|
||||
packet[12] = status;
|
||||
(*callback)(HCI_EVENT_PACKET, 0, packet, size);
|
||||
}
|
||||
|
||||
void a2dp_emit_signaling_connection_established(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size, uint8_t status){
|
||||
btstack_assert(callback != NULL);
|
||||
packet[0] = HCI_EVENT_A2DP_META;
|
||||
packet[2] = A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED;
|
||||
packet[13] = status;
|
||||
(*callback)(HCI_EVENT_PACKET, 0, packet, size);
|
||||
}
|
||||
|
||||
void a2dp_emit_stream_event(btstack_packet_handler_t callback, uint16_t cid, uint8_t local_seid, uint8_t subevent_id){
|
||||
uint8_t event[6];
|
||||
int pos = 0;
|
||||
|
@ -120,8 +120,6 @@ const char * avdtp_si2str(uint16_t index);
|
||||
|
||||
void a2dp_replace_subevent_id_and_emit_cmd(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size, uint8_t subevent_id);
|
||||
|
||||
void a2dp_emit_streaming_connection_established(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size, uint8_t status);
|
||||
void a2dp_emit_signaling_connection_established(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size, uint8_t status);
|
||||
void a2dp_emit_stream_event(btstack_packet_handler_t callback, uint16_t cid, uint8_t local_seid, uint8_t subevent_id);
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user