@@ -445,6 +445,95 @@ On device A, you should have received the data:
445445 Incoming data channel 0x20000210 len 14
446446 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... |
447447
448+ A2DP
449+ *****
450+ The :code: `a2dp ` command exposes parts of the A2DP API.
451+
452+ The following examples assume that you have two devices already connected.
453+
454+ Here is a example connecting two devices:
455+ * Source and Sink sides register a2dp callbacks. using :code: `a2dp register_cb `.
456+ * Source and Sink sides register stream endpoints. using :code: `a2dp register_ep source sbc ` and :code: `a2dp register_ep sink sbc `.
457+ * Source establish A2dp connection. It will create the AVDTP Signaling and Media L2CAP channels. using :code: `a2dp connect `.
458+ * Source and Sink side can discover remote device's stream endpoints. using :code: `a2dp discover_peer_eps `
459+ * Source or Sink configure the stream to create the stream after discover remote's endpoints. using :code: `a2dp configure `.
460+ * Source or Sink establish the stream. using :code: `a2dp establish `.
461+ * Source or Sink start the media. using :code: `a2dp start `.
462+ * Source test the media sending. using :code: `a2dp send_media ` to send one test packet data.
463+
464+ .. tabs ::
465+
466+ .. group-tab :: Device A (Audio Source Side)
467+
468+ .. code-block :: console
469+
470+ uart:~$ a2dp register_cb
471+ success
472+ uart:~$ a2dp register_ep source sbc
473+ SBC source endpoint is registered
474+ uart:~$ a2dp connect
475+ Bonded with XX:XX:XX:XX:XX:XX
476+ Security changed: XX:XX:XX:XX:XX:XX level 2
477+ a2dp connected
478+ uart:~$ a2dp discover_peer_eps
479+ endpoint id: 1, (sink), (idle):
480+ codec type: SBC
481+ sample frequency:
482+ 44100
483+ 48000
484+ channel mode:
485+ Mono
486+ Stereo
487+ Joint-Stereo
488+ Block Length:
489+ 16
490+ Subbands:
491+ 8
492+ Allocation Method:
493+ Loudness
494+ Bitpool Range: 18 - 35
495+ uart:~$ a2dp configure
496+ success to configure
497+ stream configured
498+ uart:~$ a2dp establish
499+ success to establish
500+ stream established
501+ uart:~$ a2dp start
502+ success to start
503+ stream started
504+ uart:~$ a2dp send_media
505+ frames num: 1, data length: 160
506+ data: 1, 2, 3, 4, 5, 6 ......
507+
508+ .. group-tab :: Device B (Audio Sink Side)
509+
510+ .. code-block :: console
511+
512+ uart:~$ a2dp register_cb
513+ success
514+ uart:~$ a2dp register_ep sink sbc
515+ SBC sink endpoint is registered
516+ <after a2dp connect>
517+ Connected: XX:XX:XX:XX:XX:XX
518+ Bonded with XX:XX:XX:XX:XX:XX
519+ Security changed: XX:XX:XX:XX:XX:XX level 2
520+ a2dp connected
521+ <after a2dp configure of source side>
522+ receive requesting config and accept
523+ SBC configure success
524+ sample rate 44100Hz
525+ stream configured
526+ <after a2dp establish of source side>
527+ receive requesting establishment and accept
528+ stream established
529+ <after a2dp start of source side>
530+ receive requesting start and accept
531+ stream started
532+ <after a2dp send_media of source side>
533+ received, num of frames: 1, data length: 160
534+ data: 1, 2, 3, 4, 5, 6 ......
535+ ...
536+
448537 Logging
449538*******
450539
0 commit comments