Zephyr Project API  3.3.0
A Scalable Open Source RTOS
Audio Client APIs

Data Structures

struct  bt_audio_discover_params
 
struct  bt_audio_unicast_group_stream_param
 
struct  bt_audio_unicast_group_stream_pair_param
 Parameter struct for the unicast group functions. More...
 
struct  bt_audio_unicast_group_param
 

Typedefs

typedef void(* bt_audio_discover_func_t) (struct bt_conn *conn, struct bt_codec *codec, struct bt_audio_ep *ep, struct bt_audio_discover_params *params)
 Discover Audio capabilities and endpoints callback function. More...
 

Functions

int bt_audio_discover (struct bt_conn *conn, struct bt_audio_discover_params *params)
 Discover remote capabilities and endpoints. More...
 
int bt_audio_stream_config (struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_audio_ep *ep, struct bt_codec *codec)
 Configure Audio Stream. More...
 
int bt_audio_stream_reconfig (struct bt_audio_stream *stream, struct bt_codec *codec)
 Reconfigure Audio Stream. More...
 
int bt_audio_stream_qos (struct bt_conn *conn, struct bt_audio_unicast_group *group)
 Configure Audio Stream QoS. More...
 
int bt_audio_stream_enable (struct bt_audio_stream *stream, struct bt_codec_data *meta, size_t meta_count)
 Enable Audio Stream. More...
 
int bt_audio_stream_metadata (struct bt_audio_stream *stream, struct bt_codec_data *meta, size_t meta_count)
 Change Audio Stream Metadata. More...
 
int bt_audio_stream_disable (struct bt_audio_stream *stream)
 Disable Audio Stream. More...
 
int bt_audio_stream_start (struct bt_audio_stream *stream)
 Start Audio Stream. More...
 
int bt_audio_stream_stop (struct bt_audio_stream *stream)
 Stop Audio Stream. More...
 
int bt_audio_stream_release (struct bt_audio_stream *stream)
 Release Audio Stream. More...
 
int bt_audio_stream_send (struct bt_audio_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
 Send data to Audio stream. More...
 
int bt_audio_unicast_group_create (struct bt_audio_unicast_group_param *param, struct bt_audio_unicast_group **unicast_group)
 Create audio unicast group. More...
 
int bt_audio_unicast_group_add_streams (struct bt_audio_unicast_group *unicast_group, struct bt_audio_unicast_group_stream_pair_param params[], size_t num_param)
 Add streams to a unicast group as a unicast client. More...
 
int bt_audio_unicast_group_delete (struct bt_audio_unicast_group *unicast_group)
 Delete audio unicast group. More...
 

Detailed Description

Typedef Documentation

◆ bt_audio_discover_func_t

bt_audio_discover_func_t

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

Discover Audio capabilities and endpoints callback function.

If discovery procedure has complete both cap and ep are set to NULL.

Function Documentation

◆ bt_audio_discover()

int bt_audio_discover ( struct bt_conn *  conn,
struct bt_audio_discover_params params 
)

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

Discover remote capabilities and endpoints.

This procedure is used by a client to discover remote capabilities and endpoints and notifies via params callback.

Note
This procedure is asynchronous therefore the parameters need to remains valid while it is active.
Parameters
connConnection object
paramsDiscover parameters

◆ bt_audio_stream_config()

int bt_audio_stream_config ( struct bt_conn *  conn,
struct bt_audio_stream stream,
struct bt_audio_ep *  ep,
struct bt_codec codec 
)

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

Configure Audio Stream.

This procedure is used by a client to configure a new stream using the remote endpoint, local capability and codec configuration.

Parameters
connConnection object
streamStream object being configured
epRemote Audio Endpoint being configured
codecCodec configuration
Returns
Allocated Audio Stream object or NULL in case of error.

◆ bt_audio_stream_disable()

int bt_audio_stream_disable ( struct bt_audio_stream stream)

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

Disable Audio Stream.

This procedure is used by a unicast client or unicast server to disable a stream.

This shall only be called for unicast streams, as broadcast streams will always be enabled once created.

Parameters
streamStream object
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_enable()

int bt_audio_stream_enable ( struct bt_audio_stream stream,
struct bt_codec_data meta,
size_t  meta_count 
)

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

Enable Audio Stream.

This procedure is used by a client to enable a stream.

This shall only be called for unicast streams, as broadcast streams will always be enabled once created.

Parameters
streamStream object
meta_countNumber of metadata entries
metaMetadata entries
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_metadata()

int bt_audio_stream_metadata ( struct bt_audio_stream stream,
struct bt_codec_data meta,
size_t  meta_count 
)

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

Change Audio Stream Metadata.

This procedure is used by a unicast client or unicast server to change the metadata of a stream.

Parameters
streamStream object
meta_countNumber of metadata entries
metaMetadata entries
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_qos()

int bt_audio_stream_qos ( struct bt_conn *  conn,
struct bt_audio_unicast_group *  group 
)

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

Configure Audio Stream QoS.

This procedure is used by a client to configure the Quality of Service of streams in a unicast group. All streams in the group for the specified conn will have the Quality of Service configured. This shall only be used to configure unicast streams.

Parameters
connConnection object
groupUnicast group object
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_reconfig()

int bt_audio_stream_reconfig ( struct bt_audio_stream stream,
struct bt_codec codec 
)

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

Reconfigure Audio Stream.

This procedure is used by a unicast client or unicast server to reconfigure a stream to use a different local codec configuration.

This can only be done for unicast streams.

Parameters
streamStream object being reconfigured
codecCodec configuration
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_release()

int bt_audio_stream_release ( struct bt_audio_stream stream)

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

Release Audio Stream.

This procedure is used by a unicast client or unicast server to release a unicast stream.

Broadcast sink streams cannot be released, but can be deleted by bt_audio_broadcast_sink_delete(). Broadcast source streams cannot be released, but can be deleted by bt_audio_broadcast_source_delete().

Parameters
streamStream object
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_send()

int bt_audio_stream_send ( struct bt_audio_stream stream,
struct net_buf buf,
uint16_t  seq_num,
uint32_t  ts 
)

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

Send data to Audio stream.

Send data from buffer to the stream.

Note
Data will not be sent to linked streams since linking is only consider for procedures affecting the state machine.
Parameters
streamStream object.
bufBuffer containing data to be sent.
seq_numPacket Sequence number. This value shall be incremented for each call to this function and at least once per SDU interval for a specific channel.
tsTimestamp 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. Can be omitted by using BT_ISO_TIMESTAMP_NONE which will simply enqueue the ISO SDU in a FIFO manner.
Returns
Bytes sent in case of success or negative value in case of error.

◆ bt_audio_stream_start()

int bt_audio_stream_start ( struct bt_audio_stream stream)

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

Start Audio Stream.

This procedure is used by a unicast client or unicast server to make a stream start streaming.

This shall only be called for unicast streams. Broadcast sinks will always be started once synchronized, and broadcast source streams shall be started with bt_audio_broadcast_source_start().

Parameters
streamStream object
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_stream_stop()

int bt_audio_stream_stop ( struct bt_audio_stream stream)

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

Stop Audio Stream.

This procedure is used by a client to make a stream stop streaming.

This shall only be called for unicast streams. Broadcast sinks cannot be stopped. Broadcast sources shall be stopped with bt_audio_broadcast_source_stop().

Parameters
streamStream object
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_unicast_group_add_streams()

int bt_audio_unicast_group_add_streams ( struct bt_audio_unicast_group *  unicast_group,
struct bt_audio_unicast_group_stream_pair_param  params[],
size_t  num_param 
)

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

Add streams to a unicast group as a unicast client.

This function can be used to add additional streams to a bt_audio_unicast_group.

This can be called at any time before any of the streams in the group has been started (see bt_audio_stream_ops.started()). This can also be called after the streams have been stopped (see bt_audio_stream_ops.stopped()).

Once a stream has been added to a unicast group, it cannot be removed. To remove a stream from a group, the group must be deleted with bt_audio_unicast_group_delete(), but this will require all streams in the group to be released first.

Parameters
unicast_groupPointer to the unicast group
paramsArray of stream parameters with streams being added to the group.
num_paramNumber of paramers in params.
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_unicast_group_create()

int bt_audio_unicast_group_create ( struct bt_audio_unicast_group_param param,
struct bt_audio_unicast_group **  unicast_group 
)

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

Create audio unicast group.

Create a new audio unicast group with one or more audio streams as a unicast client. Streams in a unicast group shall share the same interval, framing and latency (see bt_codec_qos).

Parameters
[in]paramThe unicast group create parameters.
[out]unicast_groupPointer to the unicast group created.
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_unicast_group_delete()

int bt_audio_unicast_group_delete ( struct bt_audio_unicast_group *  unicast_group)

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

Delete audio unicast group.

Delete a audio unicast group as a client. All streams in the group shall be in the idle or configured state.

Parameters
unicast_groupPointer to the unicast group to delete
Returns
Zero on success or (negative) error code otherwise.