A2DP Source and Sink Combo device,how to distinguish avdtp signaling conenction event

11 views
Skip to first unread message

Daniel Su

unread,
Aug 16, 2025, 5:02:18 AMAug 16
to btstack-dev
Hi Sir;

    For a combo device with both a2dp source and sink service supported, when start connection from remote side(source(mobilephone) or sink(stereo headset)),  the avdtp signaling connection setup event will be triggered twice for both local souce and sink service.

  For example, when start connection from remote source to local sink, the log is as below:
(23628):[00:00:23.628] (23628):LOG -- l2cap.c.1140: L2CAP_EVENT_CHANNEL_OPENED status 0x0 addr 64:EC:65:80:5B:82 handle 0x80 psm 0x19 local_cid 0x4c remote_cid 0x63 local_mtu 1017, remote_mtu 1024, flush_timeout 0
(23628):[00:00:23.628] (23628):LOG -- l2cap.c.1157: ERTM mode 0, fcs enabled 0
(23628):[00:00:23.628] (23628):LOG -- avdtp.c.985: Connection opened l2cap_signaling_cid 0x4c, avdtp_cid 0x01, con_handle 0x80
(23628):[00:00:23.628] (23628):LOG -- a2dp.c.518: A2DP signaling connection established avdtp_cid 0x01 role 0
(23628):A2DPSrc: Connected to  64:EC:65:80:5B:82, a2dp cid 0x01, local seid 0x02.
(23628):[00:00:23.628] (23628):LOG -- a2dp.c.340: wait a bit, then discover seps
(23628):[00:00:23.628] (23628):LOG -- a2dp.c.298: Config timer start for cid 001
(23628):[00:00:23.628] (23628):LOG -- a2dp.c.518: A2DP signaling connection established avdtp_cid 0x01 role 1
A2DPSnk: Connected to address 64:EC:65:80:5B:82, a2dp cid 0x00, local seid 0x00.

so how to distinguish the connection target service is a2dp source or sink?
 

Daniel Su

unread,
Aug 16, 2025, 5:23:18 AMAug 16
to btstack-dev
   or we should use   "A2DP_SUBEVENT_STREAM_ESTABLISHED" instead of  "A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED"  for real connection information? I can find that  a2dp_source_demo handles both events above and a2dp_sink_demo handle " A2DP_SUBEVENT_STREAM_ESTABLISHED "  only.

Matthias Ringwald

unread,
Aug 16, 2025, 2:03:25 PMAug 16
to btsta...@googlegroups.com
Hi Daniel

A2DP does not indicate the role when the signal connection gets established. However, the A2DP_SUBEVENT_STREAM_ESTABLISHED and A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION are only delivered via the packet handlers registered with a2dp_source_register_packet_handler and a2dp_sink_register_packet_handler. You can either wait for these or store the role of the remote device for later, so you know if A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED is for A2DP Sink or A2DP Source.

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/29789e92-07a4-40d5-861a-4c48aa788664n%40googlegroups.com.


Daniel Su

unread,
Aug 17, 2025, 8:10:42 AMAug 17
to btstack-dev
Hi  Matthias;
  We've already tried that and it works. Thansk for your clarification.

Best
Daniel
Reply all
Reply to author
Forward
0 new messages