Common Audio Profile

API Reference

group bt_cap

Common Audio Profile (CAP)

Common Audio Profile (CAP) provides procedures to start, update, and stop unicast and broadcast Audio Streams on individual or groups of devices using procedures in the Basic Audio Profile (BAP). This profile also provides procedures to control volume and device input on groups of devices using procedures in the Volume Control Profile (VCP) and the Microphone Control Profile (MICP). This profile specification also refers to the Common Audio Service (CAS).

Since

3.2

Version

0.8.0

Enums

enum bt_cap_set_type

Type of CAP set.

Values:

enumerator BT_CAP_SET_TYPE_AD_HOC

The set is an ad-hoc set.

enumerator BT_CAP_SET_TYPE_CSIP

The set is a CSIP Coordinated Set.

Functions

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.

This will register and enable the service and make it discoverable by clients. This will also register a Coordinated Set Identification Service instance.

This shall only be done as a server, and requires BT_CAP_ACCEPTOR_SET_MEMBER . If BT_CAP_ACCEPTOR_SET_MEMBER is not enabled, the Common Audio Service will by statically registered.

Parameters:
  • param[in] Coordinated Set Identification Service register parameters.

  • svc_inst[out] Pointer to the registered Coordinated Set Identification Service.

Returns:

0 if success, errno on failure.

int bt_cap_initiator_unicast_discover(struct bt_conn *conn)

Discovers audio support on a remote device.

This will discover the Common Audio Service (CAS) on the remote device, to verify if the remote device supports the Common Audio Profile.

Parameters:
  • conn – Connection to a remote server.

Return values:
  • 0 – Success

  • -EINVALconn is NULL

  • -ENOTCONNconn is not connected

  • -ENOMEM – Could not allocated memory for the request

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.

Register Audio operations for a stream.

Parameters:
  • stream – Stream object.

  • ops – Stream operations structure.

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.

See bt_bap_stream_send() for more information

Note

Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .

Parameters:
  • stream – Stream object.

  • buf – Buffer containing data to be sent.

  • seq_num – Packet Sequence number. This value shall be incremented for each call to this function and at least once per SDU interval for a specific channel.

Return values:
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.

See bt_bap_stream_send() for more information

Note

Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .

Parameters:
  • stream – Stream object.

  • buf – Buffer containing data to be sent.

  • seq_num – Packet Sequence number. This value shall be incremented for each call to this function and at least once per SDU interval for a specific channel.

  • ts – Timestamp of the SDU in microseconds (us). This value can be used to transmit multiple SDUs in the same SDU interval in a CIG or BIG.

Return values:
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.

See bt_bap_stream_get_tx_sync() for more information

Note

Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .

Parameters:
  • stream[in] Stream object.

  • info[out] Transmit info object.

Return values:
int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb)

Register Common Audio Profile Initiator callbacks.

Parameters:
  • cb – The callback structure. Shall remain static.

Returns:

0 on success or negative error value on failure.

int bt_cap_initiator_unregister_cb(const struct bt_cap_initiator_cb *cb)

Unregister Common Audio Profile Initiator callbacks.

Parameters:
  • cb – The callback structure that was previously registered.

Return values:
  • 0 – Success

  • -EINVALcb is NULL or cb was not registered

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.

The result of this operation is that the streams in param will be initialized and will be usable for streaming audio data. The unicast_group value can be used to update and stop the streams.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_UNICAST_CLIENT must be enabled for this function to be enabled.

Parameters:
  • param – Parameters to start the audio streams.

Returns:

0 on success or negative error value on failure.

int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_update_param *param)

Update unicast audio streams.

This will update the metadata of one or more streams.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_UNICAST_CLIENT must be enabled for this function to be enabled.

Parameters:
  • param – Update parameters.

Returns:

0 on success or negative error value on failure.

int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param)

Stop unicast audio streams.

This will stop one or more streams.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_UNICAST_CLIENT must be enabled for this function to be enabled.

Parameters:
  • param – Stop parameters.

Returns:

0 on success or negative error value on failure.

int bt_cap_initiator_unicast_audio_cancel(void)

Cancel any current Common Audio Profile procedure.

This will stop the current procedure from continuing and making it possible to run a new Common Audio Profile procedure.

It is recommended to do this if any existing procedure takes longer time than expected, which could indicate a missing response from the Common Audio Profile Acceptor.

This does not send any requests to any Common Audio Profile Acceptors involved with the current procedure, and thus notifications from the Common Audio Profile Acceptors may arrive after this has been called. It is thus recommended to either only use this if a procedure has stalled, or wait a short while before starting any new Common Audio Profile procedure after this has been called to avoid getting notifications from the cancelled procedure. The wait time depends on the connection interval, the number of devices in the previous procedure and the behavior of the Common Audio Profile Acceptors.

The respective callbacks of the procedure will be called as part of this with the connection pointer set to 0 and the err value set to -ECANCELED.

Return values:
  • 0 – on success

  • -EALREADY – if no procedure is active

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.

Create a new audio broadcast source with one or more audio streams.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • param[in] Parameters to start the audio streams.

  • broadcast_source[out] Pointer to the broadcast source created.

Returns:

0 on success or negative error value on failure.

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.

The broadcast source will be visible for scanners once this has been called, and the device will advertise audio announcements.

This will allow the streams in the broadcast source to send audio by calling bt_bap_stream_send().

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • broadcast_source – Pointer to the broadcast source.

  • adv – Pointer to an extended advertising set with periodic advertising configured.

Returns:

0 on success or negative error value on failure.

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.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • broadcast_source – The broadcast source to update.

  • meta – The new metadata. The metadata shall contain a list of CCIDs as well as a non-0 context bitfield.

  • meta_len – The length of meta.

Returns:

0 on success or negative error value on failure.

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.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • broadcast_source – The broadcast source to stop. The audio streams in this will be stopped and reset.

Returns:

0 on success or negative error value on failure.

int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source)

Delete Common Audio Profile broadcast source.

This can only be done after the broadcast source has been stopped by calling bt_cap_initiator_broadcast_audio_stop() and after the bt_bap_stream_ops.stopped() callback has been called for all streams in the broadcast source.

Note

CONFIG_BT_CAP_INITIATOR and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • broadcast_source – The broadcast source to delete. The broadcast_source will be invalidated.

Returns:

0 on success or negative error value on failure.

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.

This will return the 3-octet broadcast ID that should be advertised in the extended advertising data with BT_UUID_BROADCAST_AUDIO_VAL as BT_DATA_SVC_DATA16.

See table 3.14 in the Basic Audio Profile v1.0.1 for the structure.

Parameters:
  • broadcast_source[in] Pointer to the broadcast source.

  • broadcast_id[out] Pointer to the 3-octet broadcast ID.

Returns:

int 0 if on success, errno on error.

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.

This will encode the BASE of a broadcast source into a buffer, that can be used for advertisement. The encoded BASE will thus be encoded as little-endian. The BASE shall be put into the periodic advertising data (see bt_le_per_adv_set_data()).

See table 3.15 in the Basic Audio Profile v1.0.1 for the structure.

Parameters:
  • broadcast_source – Pointer to the broadcast source.

  • base_buf – Pointer to a buffer where the BASE will be inserted.

Returns:

int 0 if on success, errno on error.

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.

The streams in the unicast group will be stopped and the unicast group will be deleted. This can only be done for source streams.

Note

CONFIG_BT_CAP_INITIATOR , CONFIG_BT_BAP_UNICAST_CLIENT and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • param – The parameters for the handover.

  • source – The resulting broadcast source.

Returns:

0 on success or negative error value on failure.

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.

The streams in the broadcast source will be stopped and the broadcast source will be deleted.

Note

CONFIG_BT_CAP_INITIATOR , CONFIG_BT_BAP_UNICAST_CLIENT and CONFIG_BT_BAP_BROADCAST_SOURCE must be enabled for this function to be enabled.

Parameters:
  • param[in] The parameters for the handover.

  • unicast_group[out] The resulting broadcast source.

Returns:

0 on success or negative error value on failure.

int bt_cap_commander_register_cb(const struct bt_cap_commander_cb *cb)

Register Common Audio Profile Commander callbacks.

Parameters:
  • cb – The callback structure. Shall remain static.

Return values:
  • 0 – Success

  • -EINVALcb is NULL

  • -EALREADY – Callbacks are already registered

int bt_cap_commander_unregister_cb(const struct bt_cap_commander_cb *cb)

Unregister Common Audio Profile Commander callbacks.

Parameters:
  • cb – The callback structure that was previously registered.

Return values:
  • 0 – Success

  • -EINVALcb is NULL or cb was not registered

int bt_cap_commander_discover(struct bt_conn *conn)

Discovers audio support on a remote device.

This will discover the Common Audio Service (CAS) on the remote device, to verify if the remote device supports the Common Audio Profile.

Note

CONFIG_BT_CAP_COMMANDER must be enabled for this function. If CONFIG_BT_CAP_INITIATOR is also enabled, it does not matter if bt_cap_commander_discover() or bt_cap_initiator_unicast_discover() is used.

Parameters:
  • conn – Connection to a remote server.

Return values:
  • 0 – Success

  • -EINVALconn is NULL

  • -ENOTCONNconn is not connected

  • -ENOMEM – Could not allocated memory for the request

  • -EBUSY – Already doing discovery for conn

int bt_cap_commander_cancel(void)

Cancel any current Common Audio Profile commander procedure.

This will stop the current procedure from continuing and making it possible to run a new Common Audio Profile procedure.

It is recommended to do this if any existing procedure takes longer time than expected, which could indicate a missing response from the Common Audio Profile Acceptor.

This does not send any requests to any Common Audio Profile Acceptors involved with the current procedure, and thus notifications from the Common Audio Profile Acceptors may arrive after this has been called. It is thus recommended to either only use this if a procedure has stalled, or wait a short while before starting any new Common Audio Profile procedure after this has been called to avoid getting notifications from the cancelled procedure. The wait time depends on the connection interval, the number of devices in the previous procedure and the behavior of the Common Audio Profile Acceptors.

The respective callbacks of the procedure will be called as part of this with the connection pointer set to NULL and the err value set to -ECANCELED.

Return values:
  • 0 – on success

  • -EALREADY – if no procedure is active

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.

Parameters:
  • param – The parameters to start the broadcast audio

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters to stop the broadcast audio

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters for the volume change

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters for the volume offset change

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters for the volume mute state change

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters for the microphone mute state change

Returns:

0 on success or negative error value on failure.

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.

Parameters:
  • param – The parameters for the microphone gain setting change

Returns:

0 on success or negative error value on failure.

struct bt_cap_initiator_cb
#include <cap.h>

Callback structure for CAP procedures.

Public Members

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().

Param conn:

The connection pointer supplied to bt_cap_initiator_unicast_discover().

Param err:

0 if Common Audio Service was found else -ENODATA.

Param member:

Pointer to the set member. NULL if err != 0.

Param csis_inst:

The Coordinated Set Identification Service if Common Audio Service was found and includes a Coordinated Set Identification Service. NULL on error or if remote device does not include Coordinated Set Identification Service. NULL if err != 0.

void (*unicast_start_complete)(int err, struct bt_conn *conn)

Callback for bt_cap_initiator_unicast_audio_start().

Param err:

0 if success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_initiator_unicast_audio_cancel().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_initiator_unicast_audio_cancel()

void (*unicast_update_complete)(int err, struct bt_conn *conn)

Callback for bt_cap_initiator_unicast_audio_update().

Param err:

0 if success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_initiator_unicast_audio_cancel().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_initiator_unicast_audio_cancel()

void (*unicast_stop_complete)(int err, struct bt_conn *conn)

Callback for bt_cap_initiator_unicast_audio_stop().

Param err:

0 if success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_initiator_unicast_audio_cancel().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_initiator_unicast_audio_cancel()

union bt_cap_set_member
#include <cap.h>

Represents a Common Audio Set member that are either in a Coordinated or ad-hoc set.

Public Members

struct bt_conn *member

Connection pointer if the type is BT_CAP_SET_TYPE_AD_HOC.

struct bt_csip_set_coordinator_csis_inst *csip

CSIP Coordinated Set struct used if type is BT_CAP_SET_TYPE_CSIP.

struct bt_cap_stream
#include <cap.h>

Common Audio Profile stream structure.

Streams represents a Basic Audio Profile (BAP) stream and operation callbacks. See bt_bap_stream for additional information.

Public Members

struct bt_bap_stream bap_stream

The underlying BAP audio stream.

struct bt_bap_stream_ops *ops

Audio stream operations.

struct bt_cap_unicast_audio_start_stream_param
#include <cap.h>

Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function.

Public Members

union bt_cap_set_member member

Coordinated or ad-hoc set member.

struct bt_cap_stream *stream

Stream for the member.

struct bt_bap_ep *ep

Endpoint reference for the stream.

struct bt_audio_codec_cfg *codec_cfg

Codec configuration.

The codec_cfg.meta shall include a list of CCIDs (BT_AUDIO_METADATA_TYPE_CCID_LIST) as well as a non-0 stream context (BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT) bitfield.

This value is assigned to the stream, and shall remain valid while the stream is non-idle.

struct bt_cap_unicast_audio_start_param
#include <cap.h>

Parameters for the bt_cap_initiator_unicast_audio_start() function.

Public Members

enum bt_cap_set_type type

The type of the set.

size_t count

The number of parameters in stream_params.

struct bt_cap_unicast_audio_start_stream_param *stream_params

Array of stream parameters.

struct bt_cap_unicast_audio_update_stream_param
#include <cap.h>

Stream specific parameters for the bt_cap_initiator_unicast_audio_update() function.

Public Members

struct bt_cap_stream *stream

Stream to update.

size_t meta_len

The length of meta.

uint8_t *meta

The new metadata.

The metadata shall contain a list of CCIDs as well as a non-0 context bitfield.

struct bt_cap_unicast_audio_update_param
#include <cap.h>

Parameters for the bt_cap_initiator_unicast_audio_update() function.

Public Members

enum bt_cap_set_type type

The type of the set.

size_t count

The number of parameters in stream_params.

struct bt_cap_unicast_audio_update_stream_param *stream_params

Array of stream parameters.

struct bt_cap_unicast_audio_stop_param
#include <cap.h>

Parameters for the bt_cap_initiator_unicast_audio_stop() function.

Public Members

enum bt_cap_set_type type

The type of the set.

size_t count

The number of streams in streams.

struct bt_cap_stream **streams

Array of streams to stop.

struct bt_cap_initiator_broadcast_stream_param
#include <cap.h>

Parameters part of bt_cap_initiator_broadcast_subgroup_param for bt_cap_initiator_broadcast_audio_create()

Public Members

struct bt_cap_stream *stream

Audio stream.

size_t data_len

The length of the p data array.

The BIS specific data may be omitted and this set to 0.

uint8_t *data

BIS Codec Specific Configuration.

struct bt_cap_initiator_broadcast_subgroup_param
#include <cap.h>

Parameters part of bt_cap_initiator_broadcast_create_param for bt_cap_initiator_broadcast_audio_create()

Public Members

size_t stream_count

The number of parameters in stream_params.

struct bt_cap_initiator_broadcast_stream_param *stream_params

Array of stream parameters.

struct bt_audio_codec_cfg *codec_cfg

Subgroup Codec configuration.

struct bt_cap_initiator_broadcast_create_param
#include <cap.h>

Parameters for * bt_cap_initiator_broadcast_audio_create()

Public Members

size_t subgroup_count

The number of parameters in subgroup_params.

struct bt_cap_initiator_broadcast_subgroup_param *subgroup_params

Array of stream parameters.

struct bt_audio_codec_qos *qos

Quality of Service configuration.

uint8_t packing

Broadcast Source packing mode.

BT_ISO_PACKING_SEQUENTIAL or BT_ISO_PACKING_INTERLEAVED.

Note

This is a recommendation to the controller, which the controller may ignore.

bool encryption

Whether or not to encrypt the streams.

uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]

16-octet broadcast code.

Only valid if encrypt is true.

If the value is a string or a the value is less than 16 octets, the remaining octets shall be 0.

Example: The string “Broadcast Code” shall be [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]

uint8_t irc

Immediate Repetition Count.

The number of times the scheduled payloads are transmitted in a given event.

Value range from BT_ISO_IRC_MIN to BT_ISO_IRC_MAX.

uint8_t pto

Pre-transmission offset.

Offset used for pre-transmissions.

Value range from BT_ISO_PTO_MIN to BT_ISO_PTO_MAX.

uint16_t iso_interval

ISO interval.

Time between consecutive BIS anchor points.

Value range from BT_ISO_ISO_INTERVAL_MIN to BT_ISO_ISO_INTERVAL_MAX.

struct bt_cap_unicast_to_broadcast_param
#include <cap.h>

Parameters for bt_cap_initiator_unicast_to_broadcast()

Public Members

struct bt_bap_unicast_group *unicast_group

The source unicast group with the streams.

bool encrypt

Whether or not to encrypt the streams.

If set to true, then the broadcast code in broadcast_code will be used to encrypt the streams.

uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]

16-octet broadcast code.

Only valid if encrypt is true.

If the value is a string or a the value is less than 16 octets, the remaining octets shall be 0.

Example: The string “Broadcast Code” shall be [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]

struct bt_cap_broadcast_to_unicast_param
#include <cap.h>

Parameters for bt_cap_initiator_broadcast_to_unicast()

Public Members

struct bt_cap_broadcast_source *broadcast_source

The source broadcast source with the streams.

The broadcast source will be stopped and deleted.

enum bt_cap_set_type type

The type of the set.

size_t count

The number of set members in members.

This value shall match the number of streams in the broadcast_source.

union bt_cap_set_member **members

Coordinated or ad-hoc set members.

struct bt_cap_commander_cb
#include <cap.h>

Callback structure for CAP procedures.

Public Members

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().

Param conn:

The connection pointer supplied to bt_cap_initiator_unicast_discover().

Param err:

0 if Common Audio Service was found else -ENODATA.

Param member:

Pointer to the set member. NULL if err != 0.

Param csis_inst:

The Coordinated Set Identification Service if Common Audio Service was found and includes a Coordinated Set Identification Service. NULL on error or if remote device does not include Coordinated Set Identification Service. NULL if err != 0.

void (*volume_changed)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_change_volume().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

void (*volume_mute_changed)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_change_volume_mute_state().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

void (*volume_offset_changed)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_change_volume_offset().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

void (*microphone_mute_changed)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_change_microphone_mute_state().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

void (*microphone_gain_changed)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_change_microphone_gain_setting().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

void (*broadcast_reception_start)(struct bt_conn *conn, int err)

Callback for bt_cap_commander_broadcast_reception_start().

Param conn:

Pointer to the connection where the error occurred. NULL if err is 0 or if cancelled by bt_cap_commander_cancel()

Param err:

0 on success, BT_GATT_ERR() with a specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled by bt_cap_commander_cancel().

struct bt_cap_commander_broadcast_reception_start_member_param
#include <cap.h>

Parameters part of bt_cap_commander_broadcast_reception_start_param for bt_cap_commander_broadcast_reception_start()

Public Members

union bt_cap_set_member member

Coordinated or ad-hoc set member.

bt_addr_le_t addr

Address of the advertiser.

uint8_t adv_sid

SID of the advertising set.

uint16_t pa_interval

Periodic advertising interval in milliseconds.

BT_BAP_PA_INTERVAL_UNKNOWN if unknown.

uint32_t broadcast_id

24-bit broadcast ID

struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]

Pointer to array of subgroups.

At least one bit in one of the subgroups bis_sync parameters shall be set.

size_t num_subgroups

Number of subgroups.

struct bt_cap_commander_broadcast_reception_start_param
#include <cap.h>

Parameters for starting broadcast reception

Public Members

enum bt_cap_set_type type

The type of the set.

struct bt_cap_commander_broadcast_reception_start_member_param *param

The set of devices for this procedure.

size_t count

The number of parameters in param.

struct bt_cap_commander_broadcast_reception_stop_param
#include <cap.h>

Parameters for stopping broadcast reception

Public Members

enum bt_cap_set_type type

The type of the set.

union bt_cap_set_member *members

Coordinated or ad-hoc set member.

size_t count

The number of members in members.

struct bt_cap_commander_change_volume_param
#include <cap.h>

Parameters for changing absolute volume

Public Members

enum bt_cap_set_type type

The type of the set.

union bt_cap_set_member *members

Coordinated or ad-hoc set member.

size_t count

The number of members in members.

uint8_t volume

The absolute volume to set.

struct bt_cap_commander_change_volume_offset_member_param
#include <cap.h>

Parameters part of bt_cap_commander_change_volume_offset_param for bt_cap_commander_change_volume_offset()

Public Members

union bt_cap_set_member member

Coordinated or ad-hoc set member.

int16_t offset

The offset to set.

Value shall be between BT_VOCS_MIN_OFFSET and BT_VOCS_MAX_OFFSET

struct bt_cap_commander_change_volume_offset_param
#include <cap.h>

Parameters for changing volume offset.

Public Members

enum bt_cap_set_type type

The type of the set.

struct bt_cap_commander_change_volume_offset_member_param *param

The set of devices for this procedure.

size_t count

The number of parameters in param.

struct bt_cap_commander_change_volume_mute_state_param
#include <cap.h>

Parameters for changing volume mute state.

Public Members

enum bt_cap_set_type type

The type of the set.

union bt_cap_set_member *members

Coordinated or ad-hoc set member.

size_t count

The number of members in members.

bool mute

The volume mute state to set.

true to mute, and false to unmute

struct bt_cap_commander_change_microphone_mute_state_param
#include <cap.h>

Parameters for changing microphone mute state.

Public Members

enum bt_cap_set_type type

The type of the set.

union bt_cap_set_member *members

Coordinated or ad-hoc set member.

size_t count

The number of members in members.

bool mute

The microphone mute state to set.

true to mute, and false to unmute

struct bt_cap_commander_change_microphone_gain_setting_member_param
#include <cap.h>

Parameters part of bt_cap_commander_change_microphone_gain_setting_param for bt_cap_commander_change_microphone_gain_setting()

Public Members

union bt_cap_set_member member

Coordinated or ad-hoc set member.

int8_t gain

The microphone gain setting to set.

struct bt_cap_commander_change_microphone_gain_setting_param
#include <cap.h>

Parameters for changing microphone mute state.

Public Members

enum bt_cap_set_type type

The type of the set.

struct bt_cap_commander_change_microphone_gain_setting_member_param *param

The set of devices for this procedure.

size_t count

The number of parameters in param.