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

Audio Broadcast APIs. More...

Data Structures

struct  bt_audio_broadcast_source_stream_param
 
struct  bt_audio_broadcast_source_subgroup_param
 
struct  bt_audio_broadcast_source_create_param
 

Functions

int bt_audio_broadcast_source_create (struct bt_audio_broadcast_source_create_param *param, struct bt_audio_broadcast_source **source)
 Create audio broadcast source. More...
 
int bt_audio_broadcast_source_reconfig (struct bt_audio_broadcast_source *source, struct bt_codec *codec, struct bt_codec_qos *qos)
 Reconfigure audio broadcast source. More...
 
int bt_audio_broadcast_source_update_metadata (struct bt_audio_broadcast_source *source, const struct bt_codec_data meta[], size_t meta_count)
 Modify the metadata of an audio broadcast source. More...
 
int bt_audio_broadcast_source_start (struct bt_audio_broadcast_source *source, struct bt_le_ext_adv *adv)
 Start audio broadcast source. More...
 
int bt_audio_broadcast_source_stop (struct bt_audio_broadcast_source *source)
 Stop audio broadcast source. More...
 
int bt_audio_broadcast_source_delete (struct bt_audio_broadcast_source *source)
 Delete audio broadcast source. More...
 
int bt_audio_broadcast_source_get_id (const struct bt_audio_broadcast_source *source, uint32_t *const broadcast_id)
 Get the broadcast ID of a broadcast source. More...
 
int bt_audio_broadcast_source_get_base (struct bt_audio_broadcast_source *source, struct net_buf_simple *base_buf)
 Get the Broadcast Audio Stream Endpoint of a broadcast source. More...
 
void bt_audio_broadcast_sink_register_cb (struct bt_audio_broadcast_sink_cb *cb)
 Register Broadcast sink callbacks *. More...
 
int bt_audio_broadcast_sink_scan_start (const struct bt_le_scan_param *param)
 Start scan for broadcast sources. More...
 
int bt_audio_broadcast_sink_scan_stop (void)
 Stop scan for broadcast sources. More...
 
int bt_audio_broadcast_sink_sync (struct bt_audio_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_audio_stream *streams[], const uint8_t broadcast_code[16])
 Sync to a broadcaster's audio. More...
 
int bt_audio_broadcast_sink_stop (struct bt_audio_broadcast_sink *sink)
 Stop audio broadcast sink. More...
 
int bt_audio_broadcast_sink_delete (struct bt_audio_broadcast_sink *sink)
 Release a broadcast sink. More...
 

Detailed Description

Audio Broadcast APIs.

Function Documentation

◆ bt_audio_broadcast_sink_delete()

int bt_audio_broadcast_sink_delete ( struct bt_audio_broadcast_sink *  sink)

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

Release a broadcast sink.

Once a broadcast sink has been allocated after the pa_synced callback, it can be deleted using this function. If the sink has synchronized to any broadcast audio streams, these must first be stopped using bt_audio_stream_stop.

Parameters
sinkPointer to the sink object to delete.
Returns
0 in case of success or negative value in case of error.

◆ bt_audio_broadcast_sink_register_cb()

void bt_audio_broadcast_sink_register_cb ( struct bt_audio_broadcast_sink_cb cb)

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

Register Broadcast sink callbacks *.

Parameters
cbBroadcast sink callback structure.

◆ bt_audio_broadcast_sink_scan_start()

int bt_audio_broadcast_sink_scan_start ( const struct bt_le_scan_param param)

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

Start scan for broadcast sources.

Starts a scan for broadcast sources. Scan results will be received by the scan_recv callback. Only reports from devices advertising broadcast audio support will be sent. Note that a broadcast source may advertise broadcast audio capabilities, but may not be streaming.

Parameters
paramScan parameters.
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_sink_scan_stop()

int bt_audio_broadcast_sink_scan_stop ( void  )

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

Stop scan for broadcast sources.

Stops ongoing scanning for broadcast sources.

Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_sink_stop()

int bt_audio_broadcast_sink_stop ( struct bt_audio_broadcast_sink *  sink)

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

Stop audio broadcast sink.

Stop an audio broadcast sink. The broadcast sink will stop receiving BIGInfo, and audio data can no longer be streamed.

Parameters
sinkPointer to the broadcast sink
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_sink_sync()

int bt_audio_broadcast_sink_sync ( struct bt_audio_broadcast_sink *  sink,
uint32_t  indexes_bitfield,
struct bt_audio_stream streams[],
const uint8_t  broadcast_code[16] 
)

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

Sync to a broadcaster's audio.

Parameters
sinkPointer to the sink object from the base_recv callback.
indexes_bitfieldBitfield of the BIS index to sync to. To sync to e.g. BIS index 1 and 2, this should have the value of BIT(1) | BIT(2).
streamsStream object pointers to be used for the receiver. If multiple BIS indexes shall be synchronized, multiple streams shall be provided.
broadcast_codeThe 16-octet broadcast code. Shall be supplied if the broadcast is encrypted (see the syncable callback). 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]

Returns
0 in case of success or negative value in case of error.

◆ bt_audio_broadcast_source_create()

int bt_audio_broadcast_source_create ( struct bt_audio_broadcast_source_create_param param,
struct bt_audio_broadcast_source **  source 
)

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

Create audio broadcast source.

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.

No audio data can be sent until bt_audio_broadcast_source_start() has been called and no audio information (BIGInfo) will be visible to scanners (see bt_le_per_adv_sync_cb).

Parameters
[in]paramPointer to parameters used to create the broadcast source.
[out]sourcePointer to the broadcast source created
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_source_delete()

int bt_audio_broadcast_source_delete ( struct bt_audio_broadcast_source *  source)

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

Delete audio broadcast source.

Delete an audio broadcast source. The broadcast source will stop advertising entirely, and the source can no longer be used.

Parameters
sourcePointer to the broadcast source
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_source_get_base()

int bt_audio_broadcast_source_get_base ( struct bt_audio_broadcast_source *  source,
struct net_buf_simple base_buf 
)

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

Get the Broadcast Audio Stream Endpoint of a 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
sourcePointer to the broadcast source.
base_bufPointer to a buffer where the BASE will be inserted.
Returns
int 0 if on success, errno on error.

◆ bt_audio_broadcast_source_get_id()

int bt_audio_broadcast_source_get_id ( const struct bt_audio_broadcast_source *  source,
uint32_t *const  broadcast_id 
)

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

Get the broadcast ID of a 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
[in]sourcePointer to the broadcast source.
[out]broadcast_idPointer to the 3-octet broadcast ID.
Returns
int 0 if on success, errno on error.

◆ bt_audio_broadcast_source_reconfig()

int bt_audio_broadcast_source_reconfig ( struct bt_audio_broadcast_source *  source,
struct bt_codec codec,
struct bt_codec_qos qos 
)

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

Reconfigure audio broadcast source.

Reconfigure an audio broadcast source with a new codec and codec quality of service parameters. This can only be done when the source is stopped.

Parameters
sourcePointer to the broadcast source
codecCodec configuration.
qosQuality of Service configuration
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_source_start()

int bt_audio_broadcast_source_start ( struct bt_audio_broadcast_source *  source,
struct bt_le_ext_adv *  adv 
)

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

Start audio broadcast source.

Start an audio broadcast source with one or more audio streams. The broadcast source will start advertising BIGInfo, and audio data can be streamed.

Parameters
sourcePointer to the broadcast source
advPointer to an extended advertising set with periodic advertising configured.
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_source_stop()

int bt_audio_broadcast_source_stop ( struct bt_audio_broadcast_source *  source)

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

Stop audio broadcast source.

Stop an audio broadcast source. The broadcast source will stop advertising BIGInfo, and audio data can no longer be streamed.

Parameters
sourcePointer to the broadcast source
Returns
Zero on success or (negative) error code otherwise.

◆ bt_audio_broadcast_source_update_metadata()

int bt_audio_broadcast_source_update_metadata ( struct bt_audio_broadcast_source *  source,
const struct bt_codec_data  meta[],
size_t  meta_count 
)

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

Modify the metadata of an audio broadcast source.

Modify the metadata an audio broadcast source. This can only be done when the source is started. To update the metadata in the stopped state, use bt_audio_broadcast_source_reconfig().

Parameters
sourcePointer to the broadcast source.
metaMetadata entries.
meta_countNumber of metadata entries.
Returns
Zero on success or (negative) error code otherwise.