Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
86 void (*unicast_start_complete)(int err, struct bt_conn *conn);
87
98 void (*unicast_update_complete)(int err, struct bt_conn *conn);
99
110 void (*unicast_stop_complete)(int err, struct bt_conn *conn);
111#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
112};
113
127int bt_cap_initiator_unicast_discover(struct bt_conn *conn);
128
135};
136
140 struct bt_conn *member;
141
144};
145
149};
150
159
175int bt_cap_stream_send(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num);
176
194int bt_cap_stream_send_ts(struct bt_cap_stream *stream, struct net_buf *buf, uint16_t seq_num,
195 uint32_t ts);
196
211
216
219
221 struct bt_bap_ep *ep;
222
234};
235
240
242 size_t count;
243
246};
247
252
254 size_t meta_len;
255
262};
263
268
270 size_t count;
271
274};
275
280
282 size_t count;
283
286};
287
296
313
328
343
367
371
376 size_t data_len;
377
380};
381
385
388
391};
392
396
399
402
411
414
428
429#if defined(CONFIG_BT_ISO_TEST_PARAMS)
437 uint8_t irc;
438
445 uint8_t pto;
446
454 uint16_t iso_interval;
455#endif /* CONFIG_BT_ISO_TEST_PARAMS */
456};
457
473 const struct bt_cap_initiator_broadcast_create_param *param,
474 struct bt_cap_broadcast_source **broadcast_source);
475
495int bt_cap_initiator_broadcast_audio_start(struct bt_cap_broadcast_source *broadcast_source,
496 struct bt_le_ext_adv *adv);
511int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broadcast_source,
512 const uint8_t meta[], size_t meta_len);
513
526int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source);
527
545int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source);
546
561int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *broadcast_source,
562 uint32_t *const broadcast_id);
563
579int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source,
580 struct net_buf_simple *base_buf);
581
584 struct bt_bap_unicast_group *unicast_group;
585
593
607};
608
626 struct bt_cap_broadcast_source **source);
627
634 struct bt_cap_broadcast_source *broadcast_source;
635
638
646 size_t count;
647
650};
651
669 struct bt_bap_unicast_group **unicast_group);
670
685 void (*discovery_complete)(struct bt_conn *conn, int err,
686 const struct bt_csip_set_coordinator_csis_inst *csis_inst);
687
688#if defined(CONFIG_BT_VCP_VOL_CTLR)
699 void (*volume_changed)(struct bt_conn *conn, int err);
700
711 void (*volume_mute_changed)(struct bt_conn *conn, int err);
712
713#if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS)
724 void (*volume_offset_changed)(struct bt_conn *conn, int err);
725#endif /* CONFIG_BT_VCP_VOL_CTLR_VOCS */
726#endif /* CONFIG_BT_VCP_VOL_CTLR */
727#if defined(CONFIG_BT_MICP_MIC_CTLR)
738 void (*microphone_mute_changed)(struct bt_conn *conn, int err);
739#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
750 void (*microphone_gain_changed)(struct bt_conn *conn, int err);
751#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
752#endif /* CONFIG_BT_MICP_MIC_CTLR */
753
754#if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT)
765 void (*broadcast_reception_start)(struct bt_conn *conn, int err);
766#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */
767};
768
779
789
808int bt_cap_commander_discover(struct bt_conn *conn);
809
833
837
840
843
850
853
859 struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS];
860
863};
864
869
872
874 size_t count;
875};
876
887
892
895
897 size_t count;
898};
899
910
915
918
920 size_t count;
921
924};
925
934
938
945};
946
951
954
956 size_t count;
957};
958
968
973
976
978 size_t count;
979
985 bool mute;
986};
987
997
1002
1005
1007 size_t count;
1008
1014 bool mute;
1015};
1016
1026
1030
1033};
1034
1039
1042
1044 size_t count;
1045};
1046
1056#ifdef __cplusplus
1057}
1058#endif
1059
1064#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CAP_H_ */
Header for Bluetooth BAP.
Bluetooth Audio handling.
#define BT_AUDIO_BROADCAST_CODE_SIZE
Definition: audio.h:42
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_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:130
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_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.
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:134
@ BT_CAP_SET_TYPE_AD_HOC
The set is an ad-hoc set.
Definition: cap.h:132
#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
__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:584
Codec QoS structure.
Definition: audio.h:704
Struct to hold subgroup specific information for the receive state.
Definition: bap.h:249
Stream operation.
Definition: bap.h:474
Basic Audio Profile stream structure.
Definition: bap.h:434
union bt_cap_set_member ** members
Coordinated or ad-hoc set members.
Definition: cap.h:649
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:637
size_t count
The number of set members in members.
Definition: cap.h:646
struct bt_cap_broadcast_source * broadcast_source
The source broadcast source with the streams.
Definition: cap.h:634
size_t num_subgroups
Number of subgroups.
Definition: cap.h:862
uint16_t pa_interval
Periodic advertising interval in milliseconds.
Definition: cap.h:849
uint32_t broadcast_id
24-bit broadcast ID
Definition: cap.h:852
bt_addr_le_t addr
Address of the advertiser.
Definition: cap.h:839
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition: cap.h:836
uint8_t adv_sid
SID of the advertising set.
Definition: cap.h:842
struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]
Pointer to array of subgroups.
Definition: cap.h:859
Parameters for starting broadcast reception
Definition: cap.h:866
struct bt_cap_commander_broadcast_reception_start_member_param * param
The set of devices for this procedure.
Definition: cap.h:871
size_t count
The number of parameters in param.
Definition: cap.h:874
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:868
Parameters for stopping broadcast reception
Definition: cap.h:889
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition: cap.h:894
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:891
size_t count
The number of members in members.
Definition: cap.h:897
Callback structure for CAP procedures.
Definition: cap.h:672
void(* discovery_complete)(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst)
Callback for bt_cap_initiator_unicast_discover().
Definition: cap.h:685
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition: cap.h:1029
int8_t gain
The microphone gain setting to set.
Definition: cap.h:1032
Parameters for changing microphone mute state.
Definition: cap.h:1036
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:1038
struct bt_cap_commander_change_microphone_gain_setting_member_param * param
The set of devices for this procedure.
Definition: cap.h:1041
size_t count
The number of parameters in param.
Definition: cap.h:1044
Parameters for changing microphone mute state.
Definition: cap.h:999
bool mute
The microphone mute state to set.
Definition: cap.h:1014
size_t count
The number of members in members.
Definition: cap.h:1007
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition: cap.h:1004
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:1001
Parameters for changing volume mute state.
Definition: cap.h:970
size_t count
The number of members in members.
Definition: cap.h:978
bool mute
The volume mute state to set.
Definition: cap.h:985
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:972
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition: cap.h:975
int16_t offset
The offset to set.
Definition: cap.h:944
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition: cap.h:937
Parameters for changing volume offset.
Definition: cap.h:948
struct bt_cap_commander_change_volume_offset_member_param * param
The set of devices for this procedure.
Definition: cap.h:953
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:950
size_t count
The number of parameters in param.
Definition: cap.h:956
Parameters for changing absolute volume
Definition: cap.h:912
size_t count
The number of members in members.
Definition: cap.h:920
union bt_cap_set_member * members
Coordinated or ad-hoc set member.
Definition: cap.h:917
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:914
uint8_t volume
The absolute volume to set.
Definition: cap.h:923
struct bt_cap_initiator_broadcast_subgroup_param * subgroup_params
Array of stream parameters.
Definition: cap.h:398
bool encryption
Whether or not to encrypt the streams.
Definition: cap.h:413
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition: cap.h:427
uint8_t packing
Broadcast Source packing mode.
Definition: cap.h:410
size_t subgroup_count
The number of parameters in subgroup_params.
Definition: cap.h:395
struct bt_audio_codec_qos * qos
Quality of Service configuration.
Definition: cap.h:401
uint8_t * data
BIS Codec Specific Configuration.
Definition: cap.h:379
struct bt_cap_stream * stream
Audio stream.
Definition: cap.h:370
size_t data_len
The length of the p data array.
Definition: cap.h:376
struct bt_cap_initiator_broadcast_stream_param * stream_params
Array of stream parameters.
Definition: cap.h:387
size_t stream_count
The number of parameters in stream_params.
Definition: cap.h:384
struct bt_audio_codec_cfg * codec_cfg
Subgroup Codec configuration.
Definition: cap.h:390
Callback structure for CAP procedures.
Definition: cap.h:58
Definition: cap.h:146
struct bt_bap_stream_ops * ops
Definition: cap.h:148
struct bt_bap_stream bap_stream
Definition: cap.h:147
Parameters for the bt_cap_initiator_unicast_audio_start() function.
Definition: cap.h:237
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:239
size_t count
The number of parameters in stream_params.
Definition: cap.h:242
struct bt_cap_unicast_audio_start_stream_param * stream_params
Array of stream parameters.
Definition: cap.h:245
Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function.
Definition: cap.h:213
struct bt_cap_stream * stream
Stream for the member.
Definition: cap.h:218
struct bt_audio_codec_cfg * codec_cfg
Codec configuration.
Definition: cap.h:233
union bt_cap_set_member member
Coordinated or ad-hoc set member.
Definition: cap.h:215
struct bt_bap_ep * ep
Endpoint reference for the stream.
Definition: cap.h:221
Parameters for the bt_cap_initiator_unicast_audio_stop() function.
Definition: cap.h:277
size_t count
The number of streams in streams.
Definition: cap.h:282
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:279
struct bt_cap_stream ** streams
Array of streams to stop.
Definition: cap.h:285
Parameters for the bt_cap_initiator_unicast_audio_update() function.
Definition: cap.h:265
struct bt_cap_unicast_audio_update_stream_param * stream_params
Array of stream parameters.
Definition: cap.h:273
enum bt_cap_set_type type
The type of the set.
Definition: cap.h:267
size_t count
The number of parameters in stream_params.
Definition: cap.h:270
Stream specific parameters for the bt_cap_initiator_unicast_audio_update() function.
Definition: cap.h:249
size_t meta_len
The length of meta.
Definition: cap.h:254
struct bt_cap_stream * stream
Stream to update.
Definition: cap.h:251
uint8_t * meta
The new metadata.
Definition: cap.h:261
struct bt_bap_unicast_group * unicast_group
The source unicast group with the streams.
Definition: cap.h:584
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]
16-octet broadcast code.
Definition: cap.h:606
bool encrypt
Whether or not to encrypt the streams.
Definition: cap.h:592
Struct representing a coordinated set instance on a remote device.
Definition: csip.h:280
Register structure for Coordinated Set Identification Service.
Definition: csip.h:112
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:303
Simple network buffer representation.
Definition: buf.h:87
Network buffer representation.
Definition: buf.h:1004
Represents a Common Audio Set member that are either in a Coordinated or ad-hoc set.
Definition: cap.h:138
struct bt_conn * member
Connection pointer if the type is BT_CAP_SET_TYPE_AD_HOC.
Definition: cap.h:140
struct bt_csip_set_coordinator_csis_inst * csip
CSIP Coordinated Set struct used if type is BT_CAP_SET_TYPE_CSIP.
Definition: cap.h:143