Zephyr Project API  3.4.0
A Scalable Open Source RTOS

BAP Broadcast Sink APIs. More...

Data Structures

struct  bt_bap_broadcast_sink_cb
 

Functions

int bt_bap_broadcast_sink_register_cb (struct bt_bap_broadcast_sink_cb *cb)
 Register Broadcast sink callbacks *. More...
 
int bt_bap_broadcast_sink_scan_start (const struct bt_le_scan_param *param)
 Start scan for broadcast sources. More...
 
int bt_bap_broadcast_sink_scan_stop (void)
 Stop scan for broadcast sources. More...
 
int bt_bap_broadcast_sink_create (struct bt_le_per_adv_sync *pa_sync, uint32_t broadcast_id)
 Create a Broadcast Sink from a periodic advertising sync. More...
 
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. More...
 
int bt_bap_broadcast_sink_stop (struct bt_bap_broadcast_sink *sink)
 Stop audio broadcast sink. More...
 
int bt_bap_broadcast_sink_delete (struct bt_bap_broadcast_sink *sink)
 Release a broadcast sink. More...
 

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 
)

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

Register Broadcast sink callbacks *.

Parameters
cbBroadcast sink callback structure.

◆ bt_bap_broadcast_sink_scan_start()

int bt_bap_broadcast_sink_scan_start ( const struct bt_le_scan_param param)

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

int bt_bap_broadcast_sink_scan_stop ( void  )

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

Stop scan for broadcast sources.

Stops ongoing scanning for broadcast sources.

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

◆ bt_bap_broadcast_sink_stop()

int bt_bap_broadcast_sink_stop ( struct bt_bap_broadcast_sink *  sink)

#include <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 <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.