Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

BAP Broadcast Source APIs . More...

Data Structures

struct  bt_bap_broadcast_source_cb
 Struct to hold the Broadcast Source callbacks. More...
 
struct  bt_bap_broadcast_source_stream_param
 Broadcast Source stream parameters. More...
 
struct  bt_bap_broadcast_source_subgroup_param
 Broadcast Source subgroup parameters. More...
 
struct  bt_bap_broadcast_source_param
 Broadcast Source create parameters. More...
 

Functions

int bt_bap_broadcast_source_register_cb (struct bt_bap_broadcast_source_cb *cb)
 Registers callbacks for Broadcast Sources.
 
int bt_bap_broadcast_source_unregister_cb (struct bt_bap_broadcast_source_cb *cb)
 Unregisters callbacks for Broadcast Sources.
 
int bt_bap_broadcast_source_create (struct bt_bap_broadcast_source_param *param, struct bt_bap_broadcast_source **source)
 Create audio broadcast source.
 
int bt_bap_broadcast_source_reconfig (struct bt_bap_broadcast_source *source, struct bt_bap_broadcast_source_param *param)
 Reconfigure audio broadcast source.
 
int bt_bap_broadcast_source_update_metadata (struct bt_bap_broadcast_source *source, const uint8_t meta[], size_t meta_len)
 Modify the metadata of an audio broadcast source.
 
int bt_bap_broadcast_source_start (struct bt_bap_broadcast_source *source, struct bt_le_ext_adv *adv)
 Start audio broadcast source.
 
int bt_bap_broadcast_source_stop (struct bt_bap_broadcast_source *source)
 Stop audio broadcast source.
 
int bt_bap_broadcast_source_delete (struct bt_bap_broadcast_source *source)
 Delete audio broadcast source.
 
int bt_bap_broadcast_source_get_base (struct bt_bap_broadcast_source *source, struct net_buf_simple *base_buf)
 Get the Broadcast Audio Stream Endpoint of a broadcast source.
 

Detailed Description

BAP Broadcast Source APIs .

Function Documentation

◆ bt_bap_broadcast_source_create()

int bt_bap_broadcast_source_create ( struct bt_bap_broadcast_source_param * param,
struct bt_bap_broadcast_source ** source )

#include <zephyr/bluetooth/audio/bap.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_bap_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_bap_broadcast_source_delete()

int bt_bap_broadcast_source_delete ( struct bt_bap_broadcast_source * source)

#include <zephyr/bluetooth/audio/bap.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_bap_broadcast_source_get_base()

int bt_bap_broadcast_source_get_base ( struct bt_bap_broadcast_source * source,
struct net_buf_simple * base_buf )

#include <zephyr/bluetooth/audio/bap.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
Zero on success or (negative) error code otherwise.

◆ bt_bap_broadcast_source_reconfig()

int bt_bap_broadcast_source_reconfig ( struct bt_bap_broadcast_source * source,
struct bt_bap_broadcast_source_param * param )

#include <zephyr/bluetooth/audio/bap.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.

Since this may modify the Broadcast Audio Source Endpoint (BASE), bt_bap_broadcast_source_get_base() should be called after this to get the new BASE information.

If the param.params_count is smaller than the number of subgroups that have been created in the Broadcast Source, only the first param.params_count subgroups are updated. If a stream exist in a subgroup not part of param, then that stream is left as is (i.e. it is not removed; the only way to remove a stream from a Broadcast Source is to recreate the Broadcast Source).

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

◆ bt_bap_broadcast_source_register_cb()

int bt_bap_broadcast_source_register_cb ( struct bt_bap_broadcast_source_cb * cb)

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

Registers callbacks for Broadcast Sources.

Parameters
cbPointer to the callback structure.
Return values
0on success
-EINVALif cb is NULL
-EEXISTif cb is already registered

◆ bt_bap_broadcast_source_start()

int bt_bap_broadcast_source_start ( struct bt_bap_broadcast_source * source,
struct bt_le_ext_adv * adv )

#include <zephyr/bluetooth/audio/bap.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_bap_broadcast_source_stop()

int bt_bap_broadcast_source_stop ( struct bt_bap_broadcast_source * source)

#include <zephyr/bluetooth/audio/bap.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_bap_broadcast_source_unregister_cb()

int bt_bap_broadcast_source_unregister_cb ( struct bt_bap_broadcast_source_cb * cb)

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

Unregisters callbacks for Broadcast Sources.

Parameters
cbPointer to the callback structure.
Return values
0on success
-EINVALif cb is NULL
-ENOENTif cb is not registered

◆ bt_bap_broadcast_source_update_metadata()

int bt_bap_broadcast_source_update_metadata ( struct bt_bap_broadcast_source * source,
const uint8_t meta[],
size_t meta_len )

#include <zephyr/bluetooth/audio/bap.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_bap_broadcast_source_reconfig().

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