Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cap.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2022-2024 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_
14
33#include <stdbool.h>
34#include <stddef.h>
35#include <stdint.h>
36
44#include <zephyr/net_buf.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
51struct bt_cap_broadcast_source;
52
72 struct bt_csip_set_member_svc_inst **svc_inst);
73
76#if defined(CONFIG_BT_BAP_UNICAST_CLIENT) || defined(__DOXYGEN__)
91 struct bt_conn *conn, int err,
92 const struct bt_csip_set_coordinator_set_member *member,
93 const struct bt_csip_set_coordinator_csis_inst *csis_inst);
94
105 void (*unicast_start_complete)(int err, struct bt_conn *conn);
106
117 void (*unicast_update_complete)(int err, struct bt_conn *conn);
118
129 void (*unicast_stop_complete)(int err, struct bt_conn *conn);
130#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
131};
132
146int bt_cap_initiator_unicast_discover(struct bt_conn *conn);
147
155
159 struct bt_conn *member;
160
163};
164
178
188
204int bt_cap_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num);
205
223int bt_cap_stream_send_ts(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num,
224 uint32_t ts);
225
240
264
276
292
304
319
328
338
358
373
391
416
434
449
454
457
460
469
472
486
487#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
496
505
514#endif /* CONFIG_BT_ISO_TEST_PARAMS */
515};
516
532 const struct bt_cap_initiator_broadcast_create_param *param,
533 struct bt_cap_broadcast_source **broadcast_source);
534
554int bt_cap_initiator_broadcast_audio_start(struct bt_cap_broadcast_source *broadcast_source,
555 struct bt_le_ext_adv *adv);
570int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broadcast_source,
571 const uint8_t meta[], size_t meta_len);
572
585int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source);
586
604int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source);
605
621int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source,
622 struct net_buf_simple *base_buf);
623
651
669 struct bt_cap_broadcast_source **source);
670
678 struct bt_cap_broadcast_source *broadcast_source;
679
682
690 size_t count;
691
694};
695
713 struct bt_bap_unicast_group **unicast_group);
714
730 void (*discovery_complete)(struct bt_conn *conn, int err,
731 const struct bt_csip_set_coordinator_set_member *member,
732 const struct bt_csip_set_coordinator_csis_inst *csis_inst);
733
734#if defined(CONFIG_BT_VCP_VOL_CTLR) || defined(__DOXYGEN__)
745 void (*volume_changed)(struct bt_conn *conn, int err);
746
757 void (*volume_mute_changed)(struct bt_conn *conn, int err);
758
759#if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS) || defined(__DOXYGEN__)
770 void (*volume_offset_changed)(struct bt_conn *conn, int err);
771#endif /* CONFIG_BT_VCP_VOL_CTLR_VOCS */
772#endif /* CONFIG_BT_VCP_VOL_CTLR */
773#if defined(CONFIG_BT_MICP_MIC_CTLR) || defined(__DOXYGEN__)
784 void (*microphone_mute_changed)(struct bt_conn *conn, int err);
785#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS) || defined(__DOXYGEN__)
796 void (*microphone_gain_changed)(struct bt_conn *conn, int err);
797#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
798#endif /* CONFIG_BT_MICP_MIC_CTLR */
799
800#if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) || defined(__DOXYGEN__)
811 void (*broadcast_reception_start)(struct bt_conn *conn, int err);
822 void (*broadcast_reception_stop)(struct bt_conn *conn, int err);
823#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */
824};
825
836
846
865int bt_cap_commander_discover(struct bt_conn *conn);
866
891
926
938
949
962
973
984
999
1008
1024
1036
1046
1065
1075
1094
1104
1116
1128
1138#ifdef __cplusplus
1139}
1140#endif
1141
1146#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_ */
Bluetooth device address definitions and utilities.
Header for Bluetooth BAP.
Bluetooth Audio handling.
Bluetooth subsystem core APIs.
Bluetooth connection handling.
Bluetooth Coordinated Set Identification Profile (CSIP) APIs.
int bt_cap_commander_discover(struct bt_conn *conn)
Discovers audio support on a remote device.
int bt_cap_commander_change_microphone_mute_state(const struct bt_cap_commander_change_microphone_mute_state_param *param)
Change the microphone mute state on one or more Common Audio Profile Acceptors.
int bt_cap_stream_send_ts(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
Send data to Common Audio Profile stream with timestamp.
int bt_cap_commander_broadcast_reception_start(const struct bt_cap_commander_broadcast_reception_start_param *param)
Starts the reception of broadcast audio on one or more remote Common Audio Profile Acceptors.
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_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num)
Send data to Common Audio Profile stream without timestamp.
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_commander_unregister_cb(const struct bt_cap_commander_cb *cb)
Unregister Common Audio Profile Commander callbacks.
int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb)
Register Common Audio Profile Initiator 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_commander_cancel(void)
Cancel any current Common Audio Profile commander procedure.
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_update(const struct bt_cap_unicast_audio_update_param *param)
Update unicast audio streams.
int bt_cap_commander_change_microphone_gain_setting(const struct bt_cap_commander_change_microphone_gain_setting_param *param)
Change the microphone gain setting on one or more Common Audio Profile Acceptors.
int bt_cap_initiator_unicast_audio_cancel(void)
Cancel any current Common Audio Profile procedure.
int bt_cap_initiator_unregister_cb(const struct bt_cap_initiator_cb *cb)
Unregister Common Audio Profile Initiator callbacks.
int bt_cap_commander_register_cb(const struct bt_cap_commander_cb *cb)
Register Common Audio Profile Commander callbacks.
int bt_cap_initiator_unicast_discover(struct bt_conn *conn)
Discovers audio support on a remote device.
int bt_cap_commander_broadcast_reception_stop(const struct bt_cap_commander_broadcast_reception_stop_param *param)
Stops the reception of broadcast audio on one or more remote Common Audio Profile Acceptors.
int bt_cap_commander_change_volume_mute_state(const struct bt_cap_commander_change_volume_mute_state_param *param)
Change the volume mute state on one or more Common Audio Profile Acceptors.
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)
Delete Common Audio Profile broadcast source.
bt_cap_set_type
Type of CAP set.
Definition cap.h:149
int bt_cap_initiator_unicast_audio_start(const struct bt_cap_unicast_audio_start_param *param)
Setup and start unicast audio streams for a set of devices.
int bt_cap_commander_change_volume_offset(const struct bt_cap_commander_change_volume_offset_param *param)
Change the volume offset on one or more Common Audio Profile Acceptors.
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_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param)
Stop unicast audio streams.
int bt_cap_commander_change_volume(const struct bt_cap_commander_change_volume_param *param)
Change the volume on one or more Common Audio Profile Acceptors.
@ BT_CAP_SET_TYPE_CSIP
The set is a CSIP Coordinated Set.
Definition cap.h:153
@ BT_CAP_SET_TYPE_AD_HOC
The set is an ad-hoc set.
Definition cap.h:151
#define BT_ISO_BROADCAST_CODE_SIZE
Broadcast code size.
Definition iso.h:129
Bluetooth ISO handling.
Buffer management.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
__INT16_TYPE__ int16_t
Definition stdint.h:73
Bluetooth LE Device Address.
Definition addr.h:49
Codec specific configuration structure.
Definition audio.h:718
Struct to hold subgroup specific information for the receive state.
Definition bap.h:537
QoS configuration structure.
Definition bap.h:128
Stream operation.
Definition bap.h:781
Basic Audio Profile stream structure.
Definition bap.h:740
Parameters for bt_cap_initiator_broadcast_to_unicast()
Definition cap.h:672
union bt_cap_set_member ** members
Coordinated or ad-hoc set members.
Definition cap.h:693
enum bt_cap_set_type type
The type of the set.
Definition cap.h:681
size_t count
The number of set members in members.
Definition cap.h:690
struct bt_cap_broadcast_source * broadcast_source
The source broadcast source with the streams.
Definition cap.h:678
Parameters part of bt_cap_commander_broadcast_reception_start_param for bt_cap_commander_broadcast_re...
Definition cap.h:896
size_t num_subgroups
Number of subgroups.
Definition cap.h:924
uint16_t pa_interval
Periodic advertising interval in milliseconds.
Definition cap.h:911
uint32_t broadcast_id
24-bit broadcast ID
Definition cap.h:914
bt_addr_le_t addr
Address of the advertiser.
Definition cap.h:901
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition cap.h:898
uint8_t adv_sid
SID of the advertising set.
Definition cap.h:904
struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]
Pointer to array of subgroups.
Definition cap.h:921
Parameters for starting broadcast reception
Definition cap.h:928
struct bt_cap_commander_broadcast_reception_start_member_param * param
The set of devices for this procedure.
Definition cap.h:933
size_t count
The number of parameters in param.
Definition cap.h:936
enum bt_cap_set_type type
The type of the set.
Definition cap.h:930
Parameters for stopping broadcast reception
Definition cap.h:952
uint8_t src_id
Source ID of the receive state.
Definition cap.h:957
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition cap.h:954
size_t num_subgroups
Number of subgroups.
Definition cap.h:960
enum bt_cap_set_type type
The type of the set.
Definition cap.h:965
struct bt_cap_commander_broadcast_reception_stop_member_param * param
The set of devices for this procedure.
Definition cap.h:968
size_t count
The number of parameters in param.
Definition cap.h:971
Callback structure for CAP procedures.
Definition cap.h:716
void(* broadcast_reception_start)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_broadcast_reception_start().
Definition cap.h:811
void(* microphone_gain_changed)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_change_microphone_gain_setting().
Definition cap.h:796
void(* broadcast_reception_stop)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_broadcast_reception_stop().
Definition cap.h:822
void(* volume_changed)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_change_volume().
Definition cap.h:745
void(* volume_offset_changed)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_change_volume_offset().
Definition cap.h:770
void(* microphone_mute_changed)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_change_microphone_mute_state().
Definition cap.h:784
void(* volume_mute_changed)(struct bt_conn *conn, int err)
Callback for bt_cap_commander_change_volume_mute_state().
Definition cap.h:757
void(* discovery_complete)(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_set_member *member, const struct bt_csip_set_coordinator_csis_inst *csis_inst)
Callback for bt_cap_initiator_unicast_discover().
Definition cap.h:730
Parameters part of bt_cap_commander_change_microphone_gain_setting_param for bt_cap_commander_change_...
Definition cap.h:1109
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition cap.h:1111
int8_t gain
The microphone gain setting to set.
Definition cap.h:1114
Parameters for changing microphone mute state.
Definition cap.h:1118
enum bt_cap_set_type type
The type of the set.
Definition cap.h:1120
struct bt_cap_commander_change_microphone_gain_setting_member_param * param
The set of devices for this procedure.
Definition cap.h:1123
size_t count
The number of parameters in param.
Definition cap.h:1126
Parameters for changing microphone mute state.
Definition cap.h:1077
bool mute
The microphone mute state to set.
Definition cap.h:1092
size_t count
The number of members in members.
Definition cap.h:1085
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition cap.h:1082
enum bt_cap_set_type type
The type of the set.
Definition cap.h:1079
Parameters for changing volume mute state.
Definition cap.h:1048
size_t count
The number of members in members.
Definition cap.h:1056
bool mute
The volume mute state to set.
Definition cap.h:1063
enum bt_cap_set_type type
The type of the set.
Definition cap.h:1050
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition cap.h:1053
Parameters part of bt_cap_commander_change_volume_offset_param for bt_cap_commander_change_volume_off...
Definition cap.h:1013
int16_t offset
The offset to set.
Definition cap.h:1022
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition cap.h:1015
Parameters for changing volume offset.
Definition cap.h:1026
struct bt_cap_commander_change_volume_offset_member_param * param
The set of devices for this procedure.
Definition cap.h:1031
enum bt_cap_set_type type
The type of the set.
Definition cap.h:1028
size_t count
The number of parameters in param.
Definition cap.h:1034
Parameters for changing absolute volume
Definition cap.h:986
size_t count
The number of members in members.
Definition cap.h:994
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition cap.h:991
enum bt_cap_set_type type
The type of the set.
Definition cap.h:988
uint8_t volume
The absolute volume to set.
Definition cap.h:997
Parameters for * bt_cap_initiator_broadcast_audio_create()
Definition cap.h:451
uint8_t pto
Pre-transmission offset.
Definition cap.h:504
struct bt_bap_qos_cfg * qos
Quality of Service configuration.
Definition cap.h:459
struct bt_cap_initiator_broadcast_subgroup_param * subgroup_params
Array of stream parameters.
Definition cap.h:456
bool encryption
Whether or not to encrypt the streams.
Definition cap.h:471
uint8_t irc
Immediate Repetition Count.
Definition cap.h:495
uint16_t iso_interval
ISO interval.
Definition cap.h:513
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition cap.h:485
uint8_t packing
Broadcast Source packing mode.
Definition cap.h:468
size_t subgroup_count
The number of parameters in subgroup_params.
Definition cap.h:453
Parameters part of bt_cap_initiator_broadcast_subgroup_param for bt_cap_initiator_broadcast_audio_cre...
Definition cap.h:421
uint8_t * data
BIS Codec Specific Configuration.
Definition cap.h:432
struct bt_cap_stream * stream
Audio stream.
Definition cap.h:423
size_t data_len
The length of the p data array.
Definition cap.h:429
Parameters part of bt_cap_initiator_broadcast_create_param for bt_cap_initiator_broadcast_audio_creat...
Definition cap.h:439
struct bt_cap_initiator_broadcast_stream_param * stream_params
Array of stream parameters.
Definition cap.h:444
size_t stream_count
The number of parameters in stream_params.
Definition cap.h:441
struct bt_audio_codec_cfg * codec_cfg
Subgroup Codec configuration.
Definition cap.h:447
Callback structure for CAP procedures.
Definition cap.h:75
void(* unicast_stop_complete)(int err, struct bt_conn *conn)
Callback for bt_cap_initiator_unicast_audio_stop().
Definition cap.h:129
void(* unicast_discovery_complete)(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_set_member *member, const struct bt_csip_set_coordinator_csis_inst *csis_inst)
Callback for bt_cap_initiator_unicast_discover().
Definition cap.h:90
void(* unicast_update_complete)(int err, struct bt_conn *conn)
Callback for bt_cap_initiator_unicast_audio_update().
Definition cap.h:117
void(* unicast_start_complete)(int err, struct bt_conn *conn)
Callback for bt_cap_initiator_unicast_audio_start().
Definition cap.h:105
Common Audio Profile stream structure.
Definition cap.h:171
struct bt_bap_stream_ops * ops
Audio stream operations.
Definition cap.h:176
struct bt_bap_stream bap_stream
The underlying BAP audio stream.
Definition cap.h:173
Parameters for the bt_cap_initiator_unicast_audio_start() function.
Definition cap.h:266
enum bt_cap_set_type type
The type of the set.
Definition cap.h:268
size_t count
The number of parameters in stream_params.
Definition cap.h:271
struct bt_cap_unicast_audio_start_stream_param * stream_params
Array of stream parameters.
Definition cap.h:274
Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function.
Definition cap.h:242
struct bt_cap_stream * stream
Stream for the member.
Definition cap.h:247
struct bt_audio_codec_cfg * codec_cfg
Codec configuration.
Definition cap.h:262
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition cap.h:244
struct bt_bap_ep * ep
Endpoint reference for the stream.
Definition cap.h:250
Parameters for the bt_cap_initiator_unicast_audio_stop() function.
Definition cap.h:306
size_t count
The number of streams in streams.
Definition cap.h:311
bool release
Whether to release the streams after they have stopped.
Definition cap.h:317
enum bt_cap_set_type type
The type of the set.
Definition cap.h:308
struct bt_cap_stream ** streams
Array of streams to stop.
Definition cap.h:314
Parameters for the bt_cap_initiator_unicast_audio_update() function.
Definition cap.h:294
struct bt_cap_unicast_audio_update_stream_param * stream_params
Array of stream parameters.
Definition cap.h:302
enum bt_cap_set_type type
The type of the set.
Definition cap.h:296
size_t count
The number of parameters in stream_params.
Definition cap.h:299
Stream specific parameters for the bt_cap_initiator_unicast_audio_update() function.
Definition cap.h:278
size_t meta_len
The length of meta.
Definition cap.h:283
struct bt_cap_stream * stream
Stream to update.
Definition cap.h:280
uint8_t * meta
The new metadata.
Definition cap.h:290
Parameters for bt_cap_initiator_unicast_to_broadcast()
Definition cap.h:625
struct bt_bap_unicast_group * unicast_group
The source unicast group with the streams.
Definition cap.h:627
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition cap.h:649
bool encrypt
Whether or not to encrypt the streams.
Definition cap.h:635
Struct representing a coordinated set instance on a remote device.
Definition csip.h:301
Struct representing a remote device as a set member.
Definition csip.h:310
Register structure for Coordinated Set Identification Service.
Definition csip.h:133
ISO Meta Data structure for transmitted ISO packets.
Definition iso.h:346
Simple network buffer representation.
Definition net_buf.h:89
Network buffer representation.
Definition net_buf.h:1006
Represents a Common Audio Set member that are either in a Coordinated or ad-hoc set.
Definition cap.h:157
struct bt_conn * member
Connection pointer if the type is BT_CAP_SET_TYPE_AD_HOC.
Definition cap.h:159
struct bt_csip_set_coordinator_csis_inst * csip
CSIP Coordinated Set struct used if type is BT_CAP_SET_TYPE_CSIP.
Definition cap.h:162