Skip to content

Commit c0f71e9

Browse files
Thalleynashif
authored andcommitted
samples: Bluetooth: Audio: Add/fix API includes and references
Update the includes for Bluetooth Audio samples so they properly include what they use. The includes are then used to determine which relevant APIs to refer to in the READMEs. Finally improve the naming and description of the samples using the Profile names and role. Signed-off-by: Emil Gydesen <[email protected]>
1 parent f1b57f6 commit c0f71e9

File tree

41 files changed

+353
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+353
-145
lines changed

samples/bluetooth/bap_broadcast_assistant/README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
.. zephyr:code-sample:: bluetooth_bap_broadcast_assistant
2-
:name: Broadcast Audio Assistant
3-
:relevant-api: bt_bap
2+
:name: Basic Audio Profile (BAP) Broadcast Audio Assistant
3+
:relevant-api: bluetooth bt_audio bt_bap bt_conn
44

5-
Use LE Audio Broadcast Assistant functionality.
5+
Use BAP Broadcast Assistant functionality.
66

77
Overview
88
********
99

10-
Application demonstrating the LE Audio broadcast assistant functionality.
10+
Application demonstrating the BAP Broadcast Assistant functionality.
1111

1212
The sample will automatically try to connect to a device in the BAP Scan Delegator
1313
role (advertising support for the Broadcast Audio Scan Service (BASS)).
1414
It will then search for a broadcast source and (if found) add the broadcast ID to
1515
the BAP Scan Delegator.
1616

17-
Practical use of this sample requires a sink (e.g. the Broadcast Audio Sink sample or
18-
a set of LE Audio Broadcast capable earbuds) and a source (e.g. the Broadcast Audio
17+
Practical use of this sample requires a sink (e.g. the BAP Broadcast Audio Sink sample or
18+
a set of BAP Broadcast capable earbuds) and a source (e.g. the BAP Broadcast Audio
1919
Source sample).
2020

2121
This sample can be found under

samples/bluetooth/bap_broadcast_assistant/src/main.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
/*
22
* Copyright (c) 2024 Demant A/S
3+
* Copyright (c) 2024 Nordic Semiconductor ASA
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
67

7-
#include <zephyr/types.h>
8+
#include <errno.h>
89
#include <stddef.h>
10+
#include <stdint.h>
11+
#include <string.h>
912
#include <strings.h>
10-
#include <errno.h>
11-
#include <zephyr/kernel.h>
12-
#include <zephyr/sys/printk.h>
1313

14-
#include <zephyr/bluetooth/bluetooth.h>
14+
#include <zephyr/autoconf.h>
15+
#include <zephyr/bluetooth/addr.h>
1516
#include <zephyr/bluetooth/audio/audio.h>
1617
#include <zephyr/bluetooth/audio/bap.h>
18+
#include <zephyr/bluetooth/bluetooth.h>
19+
#include <zephyr/bluetooth/conn.h>
20+
#include <zephyr/bluetooth/gap.h>
21+
#include <zephyr/bluetooth/hci.h>
22+
#include <zephyr/bluetooth/hci_types.h>
23+
#include <zephyr/bluetooth/iso.h>
24+
#include <zephyr/bluetooth/uuid.h>
25+
#include <zephyr/kernel.h>
26+
#include <zephyr/net_buf.h>
1727
#include <zephyr/sys/byteorder.h>
28+
#include <zephyr/sys/printk.h>
29+
#include <zephyr/sys/util.h>
30+
#include <zephyr/types.h>
1831

1932
#define NAME_LEN 30
2033
#define PA_SYNC_SKIP 5

samples/bluetooth/bap_broadcast_sink/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.. zephyr:code-sample:: bluetooth_bap_broadcast_sink
2-
:name: Broadcast Audio Sink
3-
:relevant-api: bluetooth
2+
:name: Basic Audio Profile (BAP) Broadcast Audio Sink
3+
:relevant-api: bluetooth bt_audio bt_bap bt_conn bt_pacs
44

5-
Use LE Audio Broadcast Sink functionality.
5+
Use BAP Broadcast Sink functionality.
66

77
Overview
88
********
99

10-
Application demonstrating the LE Audio broadcast sink functionality.
11-
Starts by scanning for LE Audio broadcast sources and then synchronizes to
10+
Application demonstrating the BAP Broadcast Sink functionality.
11+
Starts by scanning for BAP Broadcast Sources and then synchronizes to
1212
the first found and listens to it until the source is (potentially) stopped.
1313

1414
This sample can be found under

samples/bluetooth/bap_broadcast_sink/src/main.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
11
/*
2-
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
2+
* Copyright (c) 2022-2024 Nordic Semiconductor ASA
33
* Copyright (c) 2024 Demant A/S
44
*
55
* SPDX-License-Identifier: Apache-2.0
66
*/
77

8-
#include <ctype.h>
8+
#include <errno.h>
9+
#include <stdint.h>
10+
#include <string.h>
911
#include <strings.h>
1012

13+
#include <zephyr/autoconf.h>
14+
#include <zephyr/bluetooth/addr.h>
15+
#include <zephyr/bluetooth/audio/lc3.h>
1116
#include <zephyr/bluetooth/bluetooth.h>
1217
#include <zephyr/bluetooth/audio/audio.h>
1318
#include <zephyr/bluetooth/audio/bap.h>
1419
#include <zephyr/bluetooth/audio/pacs.h>
20+
#include <zephyr/bluetooth/conn.h>
21+
#include <zephyr/bluetooth/gap.h>
22+
#include <zephyr/bluetooth/hci.h>
23+
#include <zephyr/bluetooth/hci_types.h>
24+
#include <zephyr/bluetooth/iso.h>
25+
#include <zephyr/bluetooth/uuid.h>
26+
#include <zephyr/kernel.h>
27+
#include <zephyr/net_buf.h>
1528
#include <zephyr/sys/byteorder.h>
29+
#include <zephyr/sys/printk.h>
30+
#include <zephyr/sys/util.h>
31+
#include <zephyr/sys/util_macro.h>
32+
#include <zephyr/sys_clock.h>
33+
#include <zephyr/toolchain.h>
34+
1635
#if defined(CONFIG_LIBLC3)
1736
#include "lc3.h"
1837
#endif /* defined(CONFIG_LIBLC3) */
1938
#if defined(CONFIG_USB_DEVICE_AUDIO)
39+
#include <zephyr/device.h>
40+
#include <zephyr/devicetree.h>
2041
#include <zephyr/usb/usb_device.h>
2142
#include <zephyr/usb/class/usb_audio.h>
2243
#include <zephyr/sys/ring_buffer.h>

samples/bluetooth/bap_broadcast_source/README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
.. zephyr:code-sample:: bluetooth_bap_broadcast_source
2-
:name: Broadcast Audio Source
3-
:relevant-api: bluetooth
2+
:name: Basic Audio Profile (BAP) Broadcast Audio Source
3+
:relevant-api: bluetooth bt_audio bt_bap
44

5-
Use LE Audio Broadcast Source functionality.
5+
Use BAP Broadcast Source functionality.
66

77
Overview
88
********
99

10-
Application demonstrating the LE Audio broadcast audio source functionality.
10+
Application demonstrating the BAP Broadcast Source functionality.
1111
Will start advertising extended advertising with audio flags, periodic advertising with the
12-
broadcast audio source endpoint (BASE) and finally the BIGinfo together with
12+
Broadcast Audio Source Endpoint (BASE) and finally the BIGinfo together with
1313
(mock) Audio (ISO) data.
1414

15-
The broadcast source will reset every 30 seconds to show the full API.
15+
The BAP Broadcast Source will reset every 30 seconds to show the full API.
1616

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

samples/bluetooth/bap_broadcast_source/src/main.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
/*
2-
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
2+
* Copyright (c) 2022-2024 Nordic Semiconductor ASA
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <zephyr/bluetooth/bluetooth.h>
7+
#include <errno.h>
8+
#include <stddef.h>
9+
#include <stdint.h>
10+
#include <string.h>
11+
12+
#include <zephyr/autoconf.h>
813
#include <zephyr/bluetooth/audio/audio.h>
914
#include <zephyr/bluetooth/audio/bap.h>
1015
#include <zephyr/bluetooth/audio/bap_lc3_preset.h>
16+
#include <zephyr/bluetooth/bluetooth.h>
17+
#include <zephyr/bluetooth/byteorder.h>
18+
#include <zephyr/bluetooth/gap.h>
19+
#include <zephyr/bluetooth/iso.h>
20+
#include <zephyr/bluetooth/uuid.h>
21+
#include <zephyr/device.h>
22+
#include <zephyr/devicetree.h>
23+
#include <zephyr/kernel.h>
24+
#include <zephyr/net_buf.h>
25+
#include <zephyr/sys/printk.h>
26+
#include <zephyr/sys/util.h>
27+
#include <zephyr/sys_clock.h>
28+
#include <zephyr/toolchain.h>
1129

1230
BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_AUDIO_BROADCAST_CODE_SIZE,
1331
"Invalid broadcast code");

samples/bluetooth/bap_unicast_client/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.. zephyr:code-sample:: bluetooth_bap_unicast_client
2-
:name: Unicast Audio Client
3-
:relevant-api: bt_bap bt_audio
2+
:name: Basic Audio Profile (BAP) Unicast Audio Client
3+
:relevant-api: bluetooth bt_audio bt_bap bt_conn
44

5-
Use LE Audio Unicast Client functionality.
5+
Use BAP Unicast Client functionality.
66

77
Overview
88
********
99

10-
Application demonstrating the LE Audio unicast client functionality. Scans for and
11-
connects to a LE Audio unicast server and establishes an audio stream.
10+
Application demonstrating the BAP Unicast Client functionality. Scans for and
11+
connects to a BAP Unicast Server and establishes an audio stream.
1212

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

samples/bluetooth/bap_unicast_client/src/main.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,32 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <stddef.h>
87
#include <errno.h>
8+
#include <inttypes.h>
9+
#include <stddef.h>
10+
#include <stdint.h>
11+
#include <string.h>
912

13+
#include <zephyr/autoconf.h>
14+
#include <zephyr/bluetooth/addr.h>
15+
#include <zephyr/bluetooth/att.h>
1016
#include <zephyr/bluetooth/audio/audio.h>
1117
#include <zephyr/bluetooth/audio/bap.h>
1218
#include <zephyr/bluetooth/audio/bap_lc3_preset.h>
1319
#include <zephyr/bluetooth/bluetooth.h>
1420
#include <zephyr/bluetooth/conn.h>
21+
#include <zephyr/bluetooth/gap.h>
22+
#include <zephyr/bluetooth/gatt.h>
23+
#include <zephyr/bluetooth/hci.h>
24+
#include <zephyr/bluetooth/hci_types.h>
25+
#include <zephyr/bluetooth/iso.h>
26+
#include <zephyr/bluetooth/uuid.h>
1527
#include <zephyr/kernel.h>
28+
#include <zephyr/net_buf.h>
29+
#include <zephyr/sys/__assert.h>
1630
#include <zephyr/sys/byteorder.h>
1731
#include <zephyr/sys/printk.h>
32+
#include <zephyr/sys/util.h>
1833
#include <zephyr/sys/util_macro.h>
1934
#include <zephyr/types.h>
2035

samples/bluetooth/bap_unicast_client/src/stream_tx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef STREAM_TX_H
88
#define STREAM_TX_H
99

10+
#include <stdint.h>
11+
1012
#include <zephyr/bluetooth/conn.h>
1113
#include <zephyr/bluetooth/audio/bap.h>
1214
#include <zephyr/bluetooth/audio/cap.h>

samples/bluetooth/bap_unicast_server/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.. zephyr:code-sample:: bluetooth_bap_unicast_server
2-
:name: Unicast Audio Server
3-
:relevant-api: bt_bap bt_audio
2+
:name: Basic Audio Profile (BAP) Unicast Audio Server
3+
:relevant-api: bluetooth bt_audio bt_bap bt_pacs
44

5-
Use LE Audio Unicast Server functionality.
5+
Use BAP Unicast Server functionality.
66

77
Overview
88
********
99

10-
Application demonstrating the LE Audio unicast server functionality.
11-
Starts advertising and awaits connection from a LE Audio unicast client.
10+
Application demonstrating the BAP Unicast Server functionality.
11+
Starts advertising and awaits connection from a BAP Unicast Client.
1212

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

0 commit comments

Comments
 (0)