Zephyr API 3.6.99
Loading...
Searching...
No Matches

BAP Broadcast Sink APIs . More...

Data Structures

struct  bt_bap_broadcast_sink_cb
 Broadcast Audio Sink callback structure. More...
 

Functions

int bt_bap_broadcast_sink_register_cb (struct bt_bap_broadcast_sink_cb *cb)
 Register Broadcast sink callbacks.
 
int bt_bap_broadcast_sink_create (struct bt_le_per_adv_sync *pa_sync, uint32_t broadcast_id, struct bt_bap_broadcast_sink **sink)
 Create a Broadcast Sink from a periodic advertising sync.
 
int bt_bap_broadcast_sink_sync (struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_bap_stream *streams[], const uint8_t broadcast_code[16])
 Sync to a broadcaster's audio.
 
int bt_bap_broadcast_sink_stop (struct bt_bap_broadcast_sink *sink)
 Stop audio broadcast sink.
 
int bt_bap_broadcast_sink_delete (struct bt_bap_broadcast_sink *sink)
 Release a broadcast sink.
 

Detailed Description

BAP Broadcast Sink APIs .

Function Documentation

◆ bt_bap_broadcast_sink_create()

int bt_bap_broadcast_sink_create ( struct bt_le_per_adv_sync * pa_sync,
uint32_t broadcast_id,
struct bt_bap_broadcast_sink ** sink )

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

Create a Broadcast Sink from a periodic advertising sync.

This should only be done after verifying that the periodic advertising sync is from a Broadcast Source.

The created Broadcast Sink will need to be supplied to bt_bap_broadcast_sink_sync() in order to synchronize to the broadcast audio.

bt_bap_broadcast_sink_cb.pa_synced() will be called with the Broadcast Sink object created if this is successful.

Parameters
pa_syncPointer to the periodic advertising sync object.
broadcast_id24-bit broadcast ID.
[out]sinkPointer to the Broadcast Sink created.
Returns
0 in case of success or errno value in case of error.

◆ bt_bap_broadcast_sink_delete()

int bt_bap_broadcast_sink_delete ( struct bt_bap_broadcast_sink * sink)

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

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

◆ bt_bap_broadcast_sink_register_cb()

int bt_bap_broadcast_sink_register_cb ( struct bt_bap_broadcast_sink_cb * cb)

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

Register Broadcast sink callbacks.

It is possible to register multiple struct of callbacks, but a single struct can only be registered once. Registering the same callback multiple times is undefined behavior and may break the stack.

Parameters
cbBroadcast sink callback structure.
Return values
0in case of success
-EINVALif cb is NULL

◆ bt_bap_broadcast_sink_stop()

int bt_bap_broadcast_sink_stop ( struct bt_bap_broadcast_sink * sink)

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

int bt_bap_broadcast_sink_sync ( struct bt_bap_broadcast_sink * sink,
uint32_t indexes_bitfield,
struct bt_bap_stream * streams[],
const uint8_t broadcast_code[16] )

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