.. zephyr:code-sample:: bluetooth_cap_initiator
:name: Common Audio Profile (CAP) Initiator
:relevant-api: bluetooth bt_bap bt_cap bt_conn
Connect to CAP Acceptors and setup unicast audio streaming or broadcast audio streams.
Overview
********
Application demonstrating the CAP Initiator functionality.
Starts by either scanning for a CAP Acceptor and then connects to and sets up available unicast
audio streams, sets up a broadcast audio stream, or both.
This sample can be found under :zephyr_file:`samples/bluetooth/cap_initiator` in the Zephyr tree.
Check the :zephyr:code-sample-category:`bluetooth` samples for general information.
Requirements
************
* BlueZ running on the host, or
* A board with Bluetooth Low Energy 5.2 support
Building and Running
********************
When building targeting an nrf52 series board with the Zephyr Bluetooth Controller,
use ``-DEXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf`` to enable the required ISO
feature support.
Building for an nrf5340dk
-------------------------
You can build both the application core image and an appropriate controller image for the network
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/cap_initiator/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/cap_initiator/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
In that case you can pair this application core image with the
:zephyr:code-sample:`bluetooth_hci_ipc` sample
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf` configuration.
Building for a simulated nrf5340bsim
------------------------------------
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/cap_initiator/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
Note this will produce a Linux executable in :file:`./build/zephyr/zephyr.exe`.
For more information, check :ref:`this board documentation <nrf5340bsim>`.
Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/cap_initiator/
:board: nrf52_bsim
:goals: build
:gen-args: -DEXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf