Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cap.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022-2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_
9
22#include <stdint.h>
23
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
34struct bt_cap_broadcast_source;
35
55 struct bt_csip_set_member_svc_inst **svc_inst);
56
59#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
72 void (*unicast_discovery_complete)(
73 struct bt_conn *conn, int err,
74 const struct bt_csip_set_coordinator_csis_inst *csis_inst);
75
88 void (*unicast_start_complete)(struct bt_bap_unicast_group *unicast_group,
89 int err, struct bt_conn *conn);
90
101 void (*unicast_update_complete)(int err, struct bt_conn *conn);
102
121 void (*unicast_stop_complete)(struct bt_bap_unicast_group *unicast_group,
122 int err, struct bt_conn *conn);
123#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
124};
125
136int bt_cap_initiator_unicast_discover(struct bt_conn *conn);
137
144};
145
149 struct bt_conn *member;
150
153};
154
158};
159
168
188int bt_cap_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num,
189 uint32_t ts);
190
205
209
212
214 struct bt_bap_ep *ep;
215
224};
225
229
231 size_t count;
232
235};
236
240
242 size_t meta_len;
243
250};
251
260
278 struct bt_bap_unicast_group *unicast_group);
279
295 size_t count);
296
310int bt_cap_initiator_unicast_audio_stop(struct bt_bap_unicast_group *unicast_group);
311
335
339
344 size_t data_len;
345
348};
349
353
356
359};
360
364
367
370
379
382
396};
397
413 const struct bt_cap_initiator_broadcast_create_param *param,
414 struct bt_cap_broadcast_source **broadcast_source);
415
435int bt_cap_initiator_broadcast_audio_start(struct bt_cap_broadcast_source *broadcast_source,
436 struct bt_le_ext_adv *adv);
451int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broadcast_source,
452 const uint8_t meta[], size_t meta_len);
453
466int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source);
467
468/*
469 * @brief Delete Common Audio Profile broadcast source
470 *
471 * This can only be done after the broadcast source has been stopped by calling
472 * bt_cap_initiator_broadcast_audio_stop() and after the
473 * bt_bap_stream_ops.stopped() callback has been called for all streams in the
474 * broadcast source.
475 *
476 * @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
477 * @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
478 * to be enabled.
479 *
480 * @param broadcast_source The broadcast source to delete.
481 * The @p broadcast_source will be invalidated.
482 *
483 * @return 0 on success or negative error value on failure.
484 */
485int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source);
486
501int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *broadcast_source,
502 uint32_t *const broadcast_id);
503
519int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source,
520 struct net_buf_simple *base_buf);
521
524 struct bt_bap_unicast_group *unicast_group;
525
533
547};
548
566 struct bt_cap_broadcast_source **source);
567
574 struct bt_cap_broadcast_source *broadcast_source;
575
578
586 size_t count;
587
590};
591
609 struct bt_bap_unicast_group **unicast_group);
610
611#ifdef __cplusplus
612}
613#endif
614
619#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_ */
Bluetooth Audio handling.
Header for Bluetooth BAP.
#define BT_AUDIO_BROADCAST_CODE_SIZE
Definition: audio.h:42
int bt_cap_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
Send data to Common Audio Profile stream.
int bt_cap_initiator_unicast_audio_stop(struct bt_bap_unicast_group *unicast_group)
Stop unicast audio streams for a unicast group.
int bt_cap_initiator_broadcast_audio_start(struct bt_cap_broadcast_source *broadcast_source, struct bt_le_ext_adv *adv)
Start Common Audio Profile broadcast source.
int bt_cap_initiator_broadcast_to_unicast(const struct bt_cap_broadcast_to_unicast_param *param, struct bt_bap_unicast_group **unicast_group)
Hands over the data streams in a broadcast source to a unicast group.
int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_update_param params[], size_t count)
Update unicast audio streams.
int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb)
Register Common Audio Profile callbacks.
int bt_cap_initiator_unicast_to_broadcast(const struct bt_cap_unicast_to_broadcast_param *param, struct bt_cap_broadcast_source **source)
Hands over the data streams in a unicast group to a broadcast source.
int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source, struct net_buf_simple *base_buf)
Get the Broadcast Audio Stream Endpoint of a Common Audio Profile broadcast source.
int bt_cap_initiator_broadcast_audio_create(const struct bt_cap_initiator_broadcast_create_param *param, struct bt_cap_broadcast_source **broadcast_source)
Create a Common Audio Profile broadcast source.
int bt_cap_stream_get_tx_sync(struct bt_cap_stream *stream, struct bt_iso_tx_info *info)
Get ISO transmission timing info for a Common Audio Profile stream.
int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broadcast_source, const uint8_t meta[], size_t meta_len)
Update broadcast audio streams for a Common Audio Profile broadcast source.
int bt_cap_initiator_unicast_audio_cancel(void)
Cancel any current Common Audio Profile procedure.
int bt_cap_initiator_unicast_audio_start(const struct bt_cap_unicast_audio_start_param *param, struct bt_bap_unicast_group *unicast_group)
Setup and start unicast audio streams for a set of devices.
int bt_cap_initiator_unicast_discover(struct bt_conn *conn)
Discovers audio support on a remote device.
void bt_cap_stream_ops_register(struct bt_cap_stream *stream, struct bt_bap_stream_ops *ops)
Register Audio operations for a Common Audio Profile stream.
int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source)
bt_cap_set_type
Type of CAP set.
Definition: cap.h:139
int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source)
Stop broadcast audio streams for a Common Audio Profile broadcast source.
int bt_cap_acceptor_register(const struct bt_csip_set_member_register_param *param, struct bt_csip_set_member_svc_inst **svc_inst)
Register the Common Audio Service.
int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *broadcast_source, uint32_t *const broadcast_id)
Get the broadcast ID of a Common Audio Profile broadcast source.
@ BT_CAP_SET_TYPE_CSIP
The set is a CSIP Coordinated Set.
Definition: cap.h:143
@ BT_CAP_SET_TYPE_AD_HOC
The set is an ad-hoc set.
Definition: cap.h:141
#define BT_ISO_BROADCAST_CODE_SIZE
Broadcast code size.
Definition: iso.h:107
Bluetooth ISO handling.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Codec specific configuration structure.
Definition: audio.h:340
Codec QoS structure.
Definition: audio.h:452
Stream operation.
Definition: bap.h:492
Basic Audio Profile stream structure.
Definition: bap.h:456
union bt_cap_set_member ** members
Coordinated or ad-hoc set members.
Definition: cap.h:589
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:577
size_t count
The number of set members in members.
Definition: cap.h:586
struct bt_cap_broadcast_source * broadcast_source
The source broadcast source with the streams.
Definition: cap.h:574
struct bt_cap_initiator_broadcast_subgroup_param * subgroup_params
Array of stream parameters.
Definition: cap.h:366
bool encryption
Whether or not to encrypt the streams.
Definition: cap.h:381
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition: cap.h:395
uint8_t packing
Broadcast Source packing mode.
Definition: cap.h:378
size_t subgroup_count
The number of parameters in subgroup_params.
Definition: cap.h:363
struct bt_audio_codec_qos * qos
Quality of Service configuration.
Definition: cap.h:369
uint8_t * data
BIS Codec Specific Configuration.
Definition: cap.h:347
struct bt_cap_stream * stream
Audio stream.
Definition: cap.h:338
size_t data_len
The length of the p data array.
Definition: cap.h:344
struct bt_cap_initiator_broadcast_stream_param * stream_params
Array of stream parameters.
Definition: cap.h:355
size_t stream_count
The number of parameters in stream_params.
Definition: cap.h:352
struct bt_audio_codec_cfg * codec_cfg
Subgroup Codec configuration.
Definition: cap.h:358
Callback structure for CAP procedures.
Definition: cap.h:58
Definition: cap.h:155
struct bt_bap_stream_ops * ops
Definition: cap.h:157
struct bt_bap_stream bap_stream
Definition: cap.h:156
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:228
size_t count
The number of parameters in stream_params.
Definition: cap.h:231
struct bt_cap_unicast_audio_start_stream_param * stream_params
Array of stream parameters.
Definition: cap.h:234
struct bt_cap_stream * stream
Stream for the member.
Definition: cap.h:211
struct bt_audio_codec_cfg * codec_cfg
Codec configuration.
Definition: cap.h:223
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition: cap.h:208
struct bt_bap_ep * ep
Endpoint reference for the stream.
Definition: cap.h:214
struct bt_cap_stream * stream
Stream for the member.
Definition: cap.h:239
uint8_t * meta
The new metadata.
Definition: cap.h:249
size_t meta_len
The length of meta.
Definition: cap.h:242
struct bt_bap_unicast_group * unicast_group
The source unicast group with the streams.
Definition: cap.h:524
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition: cap.h:546
bool encrypt
Whether or not to encrypt the streams.
Definition: cap.h:532
Struct representing a coordinated set instance on a remote device.
Definition: csip.h:257
Register structure for Coordinated Set Identification Service.
Definition: csip.h:111
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:311
Simple network buffer representation.
Definition: buf.h:83
Network buffer representation.
Definition: buf.h:906
Represents a Common Audio Set member that are either in a Coordinated or ad-hoc set.
Definition: cap.h:147
struct bt_conn * member
Connection pointer if the type is BT_CAP_SET_TYPE_AD_HOC.
Definition: cap.h:149
struct bt_csip_set_coordinator_csis_inst * csip
CSIP Coordinated Set struct used if type is BT_CAP_SET_TYPE_CSIP.
Definition: cap.h:152