1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <stdint.h>
7 
8 #include <zephyr/bluetooth/audio/bap.h>
9 #include <zephyr/bluetooth/audio/cap.h>
10 #include <zephyr/bluetooth/conn.h>
11 
12 struct tx_stream {
13 	struct bt_cap_stream *stream;
14 	uint16_t seq_num;
15 };
16 
17 /**
18  * @brief Run the application as a CAP Initiator for unicast
19  *
20  * This will start scanning for and connecting to a CAP acceptor, and then attempt to setup
21  * unicast streams.
22  *
23  * @return 0 if success, errno on failure.
24  */
25 int cap_initiator_unicast(void);
26 
27 /**
28  * @brief Run the application as a CAP Initiator for broadcast
29  *
30  * This will start advertising broadcast audio that CAP acceptors can synchronize to.
31  *
32  * @return 0 if success, errno on failure.
33  */
34 int cap_initiator_broadcast(void);
35 
36 /**
37  * @brief Initialize TX
38  *
39  * This will initialize TX if not already initialized. This creates and starts a thread that
40  * will attempt to send data on all streams registered with cap_initiator_tx_register_stream().
41  */
42 void cap_initiator_tx_init(void);
43 
44 /**
45  * @brief Register a stream for TX
46  *
47  * This will add it to the list of streams the TX thread will attempt to send on.
48  *
49  * @retval 0 on success
50  * @retval -EINVAL if @p cap_stream is NULL
51  * @retval -ENOMEM if not more streams can be registered
52  */
53 int cap_initiator_tx_register_stream(struct bt_cap_stream *cap_stream);
54 
55 /**
56  * @brief Unregister a stream for TX
57  *
58  * This will remove it to the list of streams the TX thread will attempt to send on.
59  *
60  * @retval 0 on success
61  * @retval -EINVAL if @p cap_stream is NULL
62  * @retval -EALREADY if the stream is currently not registered
63  */
64 int cap_initiator_tx_unregister_stream(struct bt_cap_stream *cap_stream);
65