Bluetooth: BAP: Unicast client Split start and connect

Removes the CIS connection establishment from bt_bap_stream_start
and move the behavior to a new funciton bt_bap_stream_connect.

This has 2 advantages:
1) The behavior of bt_bap_stream_start is much more clear and more aligned
with the spec's behavior for the receiver start ready opcode.
2) It is possible to connect streams in both the enabling
and the QoS configured state with bt_bap_stream_connect as
per the spec. This allows us to pass additional PTS test cases.

To implement this new behavior, samples and tests have been updated.

The CAP Initiator implementation has also been updated
to accomodate for the change in BAP, but the CAP
initiator implementation should work the same for application, except
that it's now possible to do unicast start on ASEs in any order
(https://github.com/zephyrproject-rtos/zephyr/issues/72138).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-05-20 17:07:48 +02:00 committed by Alberto Escolar
commit d2fbeffaa9
17 changed files with 969 additions and 231 deletions

View file

@ -34,6 +34,7 @@ Commands
stream_qos : interval [framing] [latency] [pd] [sdu] [phy] [rtn]
qos : Send QoS configure for Unicast Group
enable : [context]
connect : Connect the CIS of the stream
stop
list
print_ase_info : Print ASE info for default connection
@ -62,10 +63,8 @@ Commands
[extended <meta>]
[vendor <meta>]]
send : Send to Audio Stream [data]
start_sine : Start sending a LC3 encoded sine wave [all]
stop_sine : Stop sending a LC3 encoded sine wave [all]
recv_stats : Sets or gets the receive statistics reporting interval
in # of packets
bap_stats : Sets or gets the statistics reporting interval in # of
packets
set_location : <direction: sink, source> <location bitmask>
set_context : <direction: sink, source><context bitmask> <type:
supported, available>
@ -80,19 +79,19 @@ Commands
"config","discover","idle/codec-configured/qos-configured","codec-configured"
"qos","config","codec-configured/qos-configured","qos-configured"
"enable","qos","qos-configured","enabling"
"[start]","enable","enabling","streaming"
"connect","qos/enable","qos-configured/enabling","qos-configured/enabling"
"[start]","enable/connect","enabling","streaming"
"disable","enable", "enabling/streaming","disabling"
"[stop]","disable","disabling","qos-configure/idle"
"release","config","any","releasing/codec-configure/idle"
"list","none","any","none"
"select_unicast","none","any","none"
"connect","discover","idle/codec-configured/qos-configured","codec-configured"
"send","enable","streaming","none"
Example Central
***************
Connect and establish a stream:
Connect and establish a sink stream:
.. code-block:: console
@ -104,8 +103,9 @@ Connect and establish a stream:
uart:~$ bap config sink 0
uart:~$ bap qos
uart:~$ bap enable
uart:~$ bap connect
Or using connect command:
Connect and establish a source stream:
.. code-block:: console
@ -113,8 +113,12 @@ Or using connect command:
uart:~$ bap init
uart:~$ bt connect <address>
uart:~$ gatt exchange-mtu
uart:~$ bap discover sink
uart:~$ bap connect sink 0
uart:~$ bap discover source
uart:~$ bap config source 0
uart:~$ bap qos
uart:~$ bap enable
uart:~$ bap connect
uart:~$ bap start
Disconnect and release:
@ -479,8 +483,7 @@ parameters.
Enable
******
The :code:`enable` command attempts to enable the stream previously configured,
if the remote peer accepts then the ISO connection procedure is also initiated.
The :code:`enable` command attempts to enable the stream previously configured.
.. csv-table:: State Machine Transitions
:header: "Depends", "Allowed States", "Next States"
@ -493,17 +496,33 @@ if the remote peer accepts then the ISO connection procedure is also initiated.
uart:~$ bap enable [context]
uart:~$ bap enable Media
Start
*****
Connect
*******
The :code:`start` command is only necessary when acting as a sink as it
indicates to the source the stack is ready to start receiving data.
The :code:`connect` command attempts to connect the stream previously configured.
Sink streams will have to be started by the unicast server, and source streams will have to be
started by the unicast client.
.. csv-table:: State Machine Transitions
:header: "Depends", "Allowed States", "Next States"
:widths: auto
"enable","enabling","streaming"
"qos/enable","qos-configured/enabling","qos-configured/enabling"
.. code-block:: console
uart:~$ bap connect
Start
*****
The :code:`start` command is only necessary when starting a source stream.
.. csv-table:: State Machine Transitions
:header: "Depends", "Allowed States", "Next States"
:widths: auto
"enable/connect","enabling","streaming"
.. code-block:: console

View file

@ -447,6 +447,10 @@ Bluetooth Audio
This needs to be added to all instances of CAP discovery callback functions defined.
(:github:`72797`)
* :c:func:`bt_bap_stream_start` no longer connects the CIS. To connect the CIS,
the :c:func:`bt_bap_stream_connect` shall now be called before :c:func:`bt_bap_stream_start`.
(:github:`73032`)
* All occurrences of ``set_sirk`` have been changed to just ``sirk`` as the ``s`` in ``sirk`` stands
for set. (:github:`73413`)