Zephyr Project API  3.3.0
A Scalable Open Source RTOS
Common Audio Profile (CAP)

Common Audio Profile (CAP) More...

Data Structures

struct  bt_cap_initiator_cb
 
union  bt_cap_set_member
 
struct  bt_cap_stream
 
struct  bt_cap_unicast_audio_start_param
 
struct  bt_cap_broadcast_audio_start_param
 
struct  bt_cap_unicast_to_broadcast_param
 
struct  bt_cap_broadcast_to_unicast_param
 

Enumerations

enum  bt_cap_set_type { BT_CAP_SET_TYPE_AD_HOC , BT_CAP_SET_TYPE_CSIP }
 

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. More...
 
int bt_cap_initiator_unicast_discover (struct bt_conn *conn)
 Discovers audio support on a remote device. More...
 
void bt_cap_stream_ops_register (struct bt_cap_stream *stream, struct bt_audio_stream_ops *ops)
 Register Audio operations for a Common Audio Profile stream. More...
 
int bt_cap_initiator_register_cb (const struct bt_cap_initiator_cb *cb)
 Register Common Audio Profile callbacks. More...
 
int bt_cap_initiator_unicast_audio_start (const struct bt_cap_unicast_audio_start_param *param, struct bt_audio_unicast_group **unicast_group)
 Setup and start unicast audio streams for a set of devices. More...
 
int bt_cap_initiator_unicast_audio_update (struct bt_audio_unicast_group *unicast_group, uint8_t meta_count, const struct bt_codec_data *meta)
 Update unicast audio streams for a unicast group. More...
 
int bt_cap_initiator_unicast_audio_stop (struct bt_audio_unicast_group *unicast_group)
 Stop unicast audio streams for a unicast group. More...
 
int bt_cap_initiator_broadcast_audio_start (const struct bt_cap_broadcast_audio_start_param *param, struct bt_audio_broadcast_source **source)
 Start broadcast audio. More...
 
int bt_cap_initiator_broadcast_audio_update (struct bt_audio_broadcast_source *broadcast_source, uint8_t meta_count, const struct bt_codec_data *meta)
 Update broadcast audio streams for a broadcast source. More...
 
int bt_cap_initiator_broadcast_audio_stop (struct bt_audio_broadcast_source *broadcast_source)
 Stop broadcast audio streams for a broadcast source. More...
 
int bt_cap_initiator_unicast_to_broadcast (const struct bt_cap_unicast_to_broadcast_param *param, struct bt_audio_broadcast_source **source)
 Hands over the data streams in a unicast group to a broadcast source. More...
 
int bt_cap_initiator_broadcast_to_unicast (const struct bt_cap_broadcast_to_unicast_param *param, struct bt_audio_unicast_group **unicast_group)
 Hands over the data streams in a broadcast source to a unicast group. More...
 

Detailed Description

Common Audio Profile (CAP)

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Enumeration Type Documentation

◆ bt_cap_set_type

#include <include/zephyr/bluetooth/audio/cap.h>

Type of CAP set

Enumerator
BT_CAP_SET_TYPE_AD_HOC 

The set is an ad-hoc set

BT_CAP_SET_TYPE_CSIP 

The set is a CSIP Coordinated Set

Function Documentation

◆ bt_cap_acceptor_register()

int bt_cap_acceptor_register ( const struct bt_csip_set_member_register_param param,
struct bt_csip_set_member_svc_inst **  svc_inst 
)

#include <include/zephyr/bluetooth/audio/cap.h>

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
[in]paramCoordinated Set Identification Service register parameters.
[out]svc_instPointer to the registered Coordinated Set Identification Service.
Returns
0 if success, errno on failure.

◆ bt_cap_initiator_broadcast_audio_start()

int bt_cap_initiator_broadcast_audio_start ( const struct bt_cap_broadcast_audio_start_param param,
struct bt_audio_broadcast_source **  source 
)

#include <include/zephyr/bluetooth/audio/cap.h>

Start broadcast audio.

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

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

Note
CONFIG_BT_CAP_INITIATOR and CONFIG_BT_AUDIO_BROADCAST_SOURCE must be enabled for this function to be enabled.
Parameters
[in]paramParameters to start the audio streams.
[out]sourcePointer to the broadcast source started.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_broadcast_audio_stop()

int bt_cap_initiator_broadcast_audio_stop ( struct bt_audio_broadcast_source *  broadcast_source)

#include <include/zephyr/bluetooth/audio/cap.h>

Stop broadcast audio streams for a broadcast source.

Note
CONFIG_BT_CAP_INITIATOR and CONFIG_BT_AUDIO_BROADCAST_SOURCE must be enabled for this function to be enabled.
Parameters
broadcast_sourceThe broadcast source to stop. The audio streams in this will be stopped and reset, and the broadcast_source will be invalidated.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_broadcast_audio_update()

int bt_cap_initiator_broadcast_audio_update ( struct bt_audio_broadcast_source *  broadcast_source,
uint8_t  meta_count,
const struct bt_codec_data meta 
)

#include <include/zephyr/bluetooth/audio/cap.h>

Update broadcast audio streams for a broadcast source.

Note
CONFIG_BT_CAP_INITIATOR and CONFIG_BT_AUDIO_BROADCAST_SOURCE must be enabled for this function to be enabled.
Parameters
broadcast_sourceThe broadcast source to update.
meta_countThe number of entries in meta.
metaThe new metadata. The metadata shall contain a list of CCIDs as well as a non-0 context bitfield.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_broadcast_to_unicast()

int bt_cap_initiator_broadcast_to_unicast ( const struct bt_cap_broadcast_to_unicast_param param,
struct bt_audio_unicast_group **  unicast_group 
)

#include <include/zephyr/bluetooth/audio/cap.h>

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_AUDIO_UNICAST_CLIENT and CONFIG_BT_AUDIO_BROADCAST_SOURCE must be enabled for this function to be enabled.
Parameters
[in]paramThe parameters for the handover.
[out]unicast_groupThe resulting broadcast source.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_register_cb()

int bt_cap_initiator_register_cb ( const struct bt_cap_initiator_cb cb)

#include <include/zephyr/bluetooth/audio/cap.h>

Register Common Audio Profile callbacks.

Parameters
cbThe callback structure. Shall remain static.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_unicast_audio_start()

int bt_cap_initiator_unicast_audio_start ( const struct bt_cap_unicast_audio_start_param param,
struct bt_audio_unicast_group **  unicast_group 
)

#include <include/zephyr/bluetooth/audio/cap.h>

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_AUDIO_UNICAST_CLIENT must be enabled for this function to be enabled.
Parameters
[in]paramParameters to start the audio streams.
[out]unicast_groupPointer to the unicast group created.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_unicast_audio_stop()

int bt_cap_initiator_unicast_audio_stop ( struct bt_audio_unicast_group *  unicast_group)

#include <include/zephyr/bluetooth/audio/cap.h>

Stop unicast audio streams for a unicast group.

Note
CONFIG_BT_CAP_INITIATOR and CONFIG_BT_AUDIO_UNICAST_CLIENT must be enabled for this function to be enabled.
Parameters
unicast_groupThe group of unicast devices to stop. The audio streams in this will be stopped and reset, and the unicast_group will be invalidated.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_unicast_audio_update()

int bt_cap_initiator_unicast_audio_update ( struct bt_audio_unicast_group *  unicast_group,
uint8_t  meta_count,
const struct bt_codec_data meta 
)

#include <include/zephyr/bluetooth/audio/cap.h>

Update unicast audio streams for a unicast group.

Note
CONFIG_BT_CAP_INITIATOR and CONFIG_BT_AUDIO_UNICAST_CLIENT must be enabled for this function to be enabled.
Parameters
unicast_groupThe group of unicast devices to update.
meta_countThe number of entries in meta.
metaThe new metadata. The metadata shall contain a list of CCIDs as well as a non-0 context bitfield.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_unicast_discover()

int bt_cap_initiator_unicast_discover ( struct bt_conn *  conn)

#include <include/zephyr/bluetooth/audio/cap.h>

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
connConnection to a remote server.
Returns
0 on success or negative error value on failure.

◆ bt_cap_initiator_unicast_to_broadcast()

int bt_cap_initiator_unicast_to_broadcast ( const struct bt_cap_unicast_to_broadcast_param param,
struct bt_audio_broadcast_source **  source 
)

#include <include/zephyr/bluetooth/audio/cap.h>

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_AUDIO_UNICAST_CLIENT and CONFIG_BT_AUDIO_BROADCAST_SOURCE must be enabled for this function to be enabled.
Parameters
paramThe parameters for the handover.
sourceThe resulting broadcast source.
Returns
0 on success or negative error value on failure.

◆ bt_cap_stream_ops_register()

void bt_cap_stream_ops_register ( struct bt_cap_stream stream,
struct bt_audio_stream_ops ops 
)

#include <include/zephyr/bluetooth/audio/cap.h>

Register Audio operations for a Common Audio Profile stream.

Register Audio operations for a stream.

Parameters
streamStream object.
opsStream operations structure.