zephyr/samples/bluetooth/iso_peripheral
Emil Gydesen 065dca7e92 Bluetooth: ISO: Make setting ISO data explicit
The stack will no longer implicitly set the data path
for ISO channel, and the responsibility for doing that is
now for the upper layers/applications.

This provides additional flexibility for the higher layers
as they can better control the values and timing of the data
path, as well as support removing and even reconfiguring the
data path at will.
This also removes some complexity from the stack.

This commit also fixed a inconsistency in the disconnected
handler. CIS for centrals as well as BIS were still valid
bt_iso_chan channels in the disconnected callback,
but CIS for peripherals were completely cleaned up at this
point. This issue is fixed by moving the disconnected callback
handling to before the code to cleanup the channel for
peripherals.

Since there is a difference in how you remove data paths
depending on the GAP role (central/peripheral), the
iso_info struct type has been expanded to be more
concise of which type of CIS it is.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-19 10:56:57 +01:00
..
src Bluetooth: ISO: Make setting ISO data explicit 2025-03-19 10:56:57 +01:00
CMakeLists.txt
prj.conf Bluetooth: Audio: Update SCAN_DELEGATOR dependency to GATT_DYNAMIC_DB 2024-10-23 16:53:37 +02:00
README.rst doc: samples: Adopt code-sample-category across tree 2024-09-23 12:00:00 +02:00
sample.yaml

.. zephyr:code-sample:: ble_peripheral_iso
   :name: ISO (Peripheral)
   :relevant-api: bt_bas bluetooth

   Implement a Bluetooth LE Peripheral that uses isochronous channels.

Overview
********

This sample demonstrates how to use isochronous channels as a peripheral.
The sample starts advertising, waits for a central to connect to it and set up an isochronous channel.
Once the isochronous channel is set up, received isochronous data is printed out.
It is recommended to run this sample together with the :zephyr:code-sample:`ble_central_iso` sample.

Requirements
************

* BlueZ running on the host, or
* A board with Bluetooth Low Energy 5.2 support
* A Bluetooth Controller and board that supports setting
  CONFIG_BT_CTLR_PERIPHERAL_ISO=y

Building and Running
********************

This sample can be found under :zephyr_file:`samples/bluetooth/iso_peripheral` in the Zephyr tree.

1. Start the application.
   In the terminal window, check that it is advertising.

      Bluetooth initialized
      Advertising successfully started

2. Observe that the central device connects and sets up an isochronous channel.

      Connected E8:DC:8D:B3:47:69 (random)
      Incoming request from 0x20002260
      ISO Channel 0x20000698 connected

3. Observe that incoming data is printed.

      Incoming data channel 0x20000698 len 1
               00
      Incoming data channel 0x20000698 len 2
               0001
      Incoming data channel 0x20000698 len 3
               000102
      Incoming data channel 0x20000698 len 4
               00010203
      Incoming data channel 0x20000698 len 5
               0001020304
      Incoming data channel 0x20000698 len 6
               000102030405
      Incoming data channel 0x20000698 len 7
               000102...040506
      Incoming data channel 0x20000698 len 8
               000102...050607
      Incoming data channel 0x20000698 len 9
               000102...060708
      Incoming data channel 0x20000698 len 10
               000102...070809
      Incoming data channel 0x20000698 len 11
               000102...08090a
      Incoming data channel 0x20000698 len 12
               000102...090a0b

See :zephyr:code-sample-category:`bluetooth` samples for more details.