Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bluetooth Basic Audio Profile

Bluetooth Basic Audio Profile (BAP) More...

Modules

 BAP Broadcast APIs
 BAP Broadcast APIs.
 
 BAP Broadcast Sink APIs
 BAP Broadcast Sink APIs.
 
 BAP Broadcast Source APIs
 BAP Broadcast Source APIs.
 
 BAP Unicast Client APIs
 
 BAP Unicast Server APIs
 

Data Structures

struct  bt_bap_ascs_rsp
 Structure storing values of fields of ASE Control Point notification. More...
 
struct  bt_bap_bass_subgroup
 Struct to hold subgroup specific information for the receive state. More...
 
struct  bt_bap_scan_delegator_recv_state
 Represents the Broadcast Audio Scan Service receive state. More...
 
struct  bt_bap_scan_delegator_cb
 
struct  bt_bap_ep_info
 Structure holding information of audio stream endpoint. More...
 
struct  bt_bap_stream
 Basic Audio Profile stream structure. More...
 
struct  bt_bap_stream_ops
 Stream operation. More...
 
struct  bt_bap_scan_delegator_add_src_param
 
struct  bt_bap_scan_delegator_mod_src_param
 
struct  bt_bap_broadcast_assistant_cb
 
struct  bt_bap_broadcast_assistant_add_src_param
 Parameters for adding a source to a Broadcast Audio Scan Service server. More...
 
struct  bt_bap_broadcast_assistant_mod_src_param
 Parameters for modifying a source. More...
 

Macros

#define BT_BAP_PA_INTERVAL_UNKNOWN   0xFFFF
 Value indicating that the periodic advertising interval is unknown.
 
#define BT_BAP_BIS_SYNC_NO_PREF   0xFFFFFFFF
 Broadcast Assistant no BIS sync preference.
 
#define BT_BAP_ASCS_RSP(c, r)   (struct bt_bap_ascs_rsp) { .code = c, .reason = r }
 Macro used to initialise the object storing values of ASE Control Point notification.
 

Typedefs

typedef bool(* bt_bap_scan_delegator_state_func_t) (const struct bt_bap_scan_delegator_recv_state *recv_state, void *user_data)
 Callback function for Scan Delegator receive state search functions.
 
typedef void(* bt_bap_broadcast_assistant_write_cb) (struct bt_conn *conn, int err)
 Callback function for writes.
 

Enumerations

enum  bt_bap_pa_state {
  BT_BAP_PA_STATE_NOT_SYNCED = 0x00 , BT_BAP_PA_STATE_INFO_REQ = 0x01 , BT_BAP_PA_STATE_SYNCED = 0x02 , BT_BAP_PA_STATE_FAILED = 0x03 ,
  BT_BAP_PA_STATE_NO_PAST = 0x04
}
 Periodic advertising state reported by the Scan Delegator. More...
 
enum  bt_bap_big_enc_state { BT_BAP_BIG_ENC_STATE_NO_ENC = 0x00 , BT_BAP_BIG_ENC_STATE_BCODE_REQ = 0x01 , BT_BAP_BIG_ENC_STATE_DEC = 0x02 , BT_BAP_BIG_ENC_STATE_BAD_CODE = 0x03 }
 Broadcast Isochronous Group encryption state reported by the Scan Delegator. More...
 
enum  bt_bap_bass_att_err { BT_BAP_BASS_ERR_OPCODE_NOT_SUPPORTED = 0x80 , BT_BAP_BASS_ERR_INVALID_SRC_ID = 0x81 }
 Broadcast Audio Scan Service (BASS) specific ATT error codes. More...
 
enum  bt_bap_ep_state {
  BT_BAP_EP_STATE_IDLE = 0x00 , BT_BAP_EP_STATE_CODEC_CONFIGURED = 0x01 , BT_BAP_EP_STATE_QOS_CONFIGURED = 0x02 , BT_BAP_EP_STATE_ENABLING = 0x03 ,
  BT_BAP_EP_STATE_STREAMING = 0x04 , BT_BAP_EP_STATE_DISABLING = 0x05 , BT_BAP_EP_STATE_RELEASING = 0x06
}
 Endpoint states. More...
 
enum  bt_bap_ascs_rsp_code {
  BT_BAP_ASCS_RSP_CODE_SUCCESS = 0x00 , BT_BAP_ASCS_RSP_CODE_NOT_SUPPORTED = 0x01 , BT_BAP_ASCS_RSP_CODE_INVALID_LENGTH = 0x02 , BT_BAP_ASCS_RSP_CODE_INVALID_ASE = 0x03 ,
  BT_BAP_ASCS_RSP_CODE_INVALID_ASE_STATE = 0x04 , BT_BAP_ASCS_RSP_CODE_INVALID_DIR = 0x05 , BT_BAP_ASCS_RSP_CODE_CAP_UNSUPPORTED = 0x06 , BT_BAP_ASCS_RSP_CODE_CONF_UNSUPPORTED = 0x07 ,
  BT_BAP_ASCS_RSP_CODE_CONF_REJECTED = 0x08 , BT_BAP_ASCS_RSP_CODE_CONF_INVALID = 0x09 , BT_BAP_ASCS_RSP_CODE_METADATA_UNSUPPORTED = 0x0a , BT_BAP_ASCS_RSP_CODE_METADATA_REJECTED = 0x0b ,
  BT_BAP_ASCS_RSP_CODE_METADATA_INVALID = 0x0c , BT_BAP_ASCS_RSP_CODE_NO_MEM = 0x0d , BT_BAP_ASCS_RSP_CODE_UNSPECIFIED = 0x0e
}
 Response Status Code. More...
 
enum  bt_bap_ascs_reason {
  BT_BAP_ASCS_REASON_NONE = 0x00 , BT_BAP_ASCS_REASON_CODEC = 0x01 , BT_BAP_ASCS_REASON_CODEC_DATA = 0x02 , BT_BAP_ASCS_REASON_INTERVAL = 0x03 ,
  BT_BAP_ASCS_REASON_FRAMING = 0x04 , BT_BAP_ASCS_REASON_PHY = 0x05 , BT_BAP_ASCS_REASON_SDU = 0x06 , BT_BAP_ASCS_REASON_RTN = 0x07 ,
  BT_BAP_ASCS_REASON_LATENCY = 0x08 , BT_BAP_ASCS_REASON_PD = 0x09 , BT_BAP_ASCS_REASON_CIS = 0x0a
}
 Response Reasons. More...
 

Functions

int bt_bap_ep_get_info (const struct bt_bap_ep *ep, struct bt_bap_ep_info *info)
 Return structure holding information of audio stream endpoint.
 
void bt_bap_stream_cb_register (struct bt_bap_stream *stream, struct bt_bap_stream_ops *ops)
 Register Audio callbacks for a stream.
 
int bt_bap_stream_config (struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg)
 Configure Audio Stream.
 
int bt_bap_stream_reconfig (struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg)
 Reconfigure Audio Stream.
 
int bt_bap_stream_qos (struct bt_conn *conn, struct bt_bap_unicast_group *group)
 Configure Audio Stream QoS.
 
int bt_bap_stream_enable (struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len)
 Enable Audio Stream.
 
int bt_bap_stream_metadata (struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len)
 Change Audio Stream Metadata.
 
int bt_bap_stream_disable (struct bt_bap_stream *stream)
 Disable Audio Stream.
 
int bt_bap_stream_start (struct bt_bap_stream *stream)
 Start Audio Stream.
 
int bt_bap_stream_stop (struct bt_bap_stream *stream)
 Stop Audio Stream.
 
int bt_bap_stream_release (struct bt_bap_stream *stream)
 Release Audio Stream.
 
int bt_bap_stream_send (struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num)
 Send data to Audio stream without timestamp.
 
int bt_bap_stream_send_ts (struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
 Send data to Audio stream with timestamp.
 
int bt_bap_stream_get_tx_sync (struct bt_bap_stream *stream, struct bt_iso_tx_info *info)
 Get ISO transmission timing info for a Basic Audio Profile stream.
 
void bt_bap_scan_delegator_register_cb (struct bt_bap_scan_delegator_cb *cb)
 Register the callbacks for the Basic Audio Profile Scan Delegator.
 
int bt_bap_scan_delegator_set_pa_state (uint8_t src_id, enum bt_bap_pa_state pa_state)
 Set the periodic advertising sync state to syncing.
 
int bt_bap_scan_delegator_set_bis_sync_state (uint8_t src_id, uint32_t bis_synced[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS])
 Set the sync state of a receive state in the server.
 
int bt_bap_scan_delegator_add_src (const struct bt_bap_scan_delegator_add_src_param *param)
 Add a receive state source locally.
 
int bt_bap_scan_delegator_mod_src (const struct bt_bap_scan_delegator_mod_src_param *param)
 Add a receive state source locally.
 
int bt_bap_scan_delegator_rem_src (uint8_t src_id)
 Remove a receive state source.
 
void bt_bap_scan_delegator_foreach_state (bt_bap_scan_delegator_state_func_t func, void *user_data)
 Iterate through all existing receive states.
 
const struct bt_bap_scan_delegator_recv_statebt_bap_scan_delegator_find_state (bt_bap_scan_delegator_state_func_t func, void *user_data)
 Find and return a receive state based on a compare function.
 
int bt_bap_broadcast_assistant_discover (struct bt_conn *conn)
 Discover Broadcast Audio Scan Service on the server.
 
int bt_bap_broadcast_assistant_scan_start (struct bt_conn *conn, bool start_scan)
 Scan start for BISes for a remote server.
 
int bt_bap_broadcast_assistant_scan_stop (struct bt_conn *conn)
 Stop remote scanning for BISes for a server.
 
void bt_bap_broadcast_assistant_register_cb (struct bt_bap_broadcast_assistant_cb *cb)
 Registers the callbacks used by Broadcast Audio Scan Service client.
 
int bt_bap_broadcast_assistant_add_src (struct bt_conn *conn, const struct bt_bap_broadcast_assistant_add_src_param *param)
 Add a source on the server.
 
int bt_bap_broadcast_assistant_mod_src (struct bt_conn *conn, const struct bt_bap_broadcast_assistant_mod_src_param *param)
 Modify a source on the server.
 
int bt_bap_broadcast_assistant_set_broadcast_code (struct bt_conn *conn, uint8_t src_id, const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE])
 Set a broadcast code to the specified receive state.
 
int bt_bap_broadcast_assistant_rem_src (struct bt_conn *conn, uint8_t src_id)
 Remove a source from the server.
 
int bt_bap_broadcast_assistant_read_recv_state (struct bt_conn *conn, uint8_t idx)
 Read the specified receive state from the server.
 

Detailed Description

Bluetooth Basic Audio Profile (BAP)

Macro Definition Documentation

◆ BT_BAP_ASCS_RSP

#define BT_BAP_ASCS_RSP (   c,
  r 
)    (struct bt_bap_ascs_rsp) { .code = c, .reason = r }

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

Macro used to initialise the object storing values of ASE Control Point notification.

Parameters
cResponse Code field
rReason field - bt_bap_ascs_reason or bt_audio_metadata_type (see notes in bt_bap_ascs_rsp).

◆ BT_BAP_BIS_SYNC_NO_PREF

#define BT_BAP_BIS_SYNC_NO_PREF   0xFFFFFFFF

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

Broadcast Assistant no BIS sync preference.

Value indicating that the Broadcast Assistant has no preference to which BIS the Scan Delegator syncs to

◆ BT_BAP_PA_INTERVAL_UNKNOWN

#define BT_BAP_PA_INTERVAL_UNKNOWN   0xFFFF

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

Value indicating that the periodic advertising interval is unknown.

Typedef Documentation

◆ bt_bap_broadcast_assistant_write_cb

typedef void(* bt_bap_broadcast_assistant_write_cb) (struct bt_conn *conn, int err)

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

Callback function for writes.

Parameters
connThe connection to the peer device.
errError value. 0 on success, GATT error on fail.

◆ bt_bap_scan_delegator_state_func_t

typedef bool(* bt_bap_scan_delegator_state_func_t) (const struct bt_bap_scan_delegator_recv_state *recv_state, void *user_data)

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

Callback function for Scan Delegator receive state search functions.

Parameters
recv_stateThe receive state.
user_dataUser data.
Return values
trueto stop iterating. If this is used in the context of bt_bap_scan_delegator_find_state(), the recv_state will be returned by bt_bap_scan_delegator_find_state()
falseto continue iterating

Enumeration Type Documentation

◆ bt_bap_ascs_reason

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

Response Reasons.

These are used if the bt_bap_ascs_rsp_code value is BT_BAP_ASCS_RSP_CODE_CONF_UNSUPPORTED, BT_BAP_ASCS_RSP_CODE_CONF_REJECTED or BT_BAP_ASCS_RSP_CODE_CONF_INVALID.

Enumerator
BT_BAP_ASCS_REASON_NONE 

No reason.

BT_BAP_ASCS_REASON_CODEC 

Codec ID.

BT_BAP_ASCS_REASON_CODEC_DATA 

Codec configuration.

BT_BAP_ASCS_REASON_INTERVAL 

SDU interval.

BT_BAP_ASCS_REASON_FRAMING 

Framing.

BT_BAP_ASCS_REASON_PHY 

PHY.

BT_BAP_ASCS_REASON_SDU 

Maximum SDU size.

BT_BAP_ASCS_REASON_RTN 

RTN.

BT_BAP_ASCS_REASON_LATENCY 

Max transport latency.

BT_BAP_ASCS_REASON_PD 

Presendation delay.

BT_BAP_ASCS_REASON_CIS 

Invalid CIS mapping.

◆ bt_bap_ascs_rsp_code

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

Response Status Code.

These are sent by the server to the client when a stream operation is requested.

Enumerator
BT_BAP_ASCS_RSP_CODE_SUCCESS 

Server completed operation successfully.

BT_BAP_ASCS_RSP_CODE_NOT_SUPPORTED 

Server did not support operation by client.

BT_BAP_ASCS_RSP_CODE_INVALID_LENGTH 

Server rejected due to invalid operation length.

BT_BAP_ASCS_RSP_CODE_INVALID_ASE 

Invalid ASE ID.

BT_BAP_ASCS_RSP_CODE_INVALID_ASE_STATE 

Invalid ASE state.

BT_BAP_ASCS_RSP_CODE_INVALID_DIR 

Invalid operation for direction.

BT_BAP_ASCS_RSP_CODE_CAP_UNSUPPORTED 

Capabilities not supported by server.

BT_BAP_ASCS_RSP_CODE_CONF_UNSUPPORTED 

Configuration parameters not supported by server.

BT_BAP_ASCS_RSP_CODE_CONF_REJECTED 

Configuration parameters rejected by server.

BT_BAP_ASCS_RSP_CODE_CONF_INVALID 

Invalid Configuration parameters.

BT_BAP_ASCS_RSP_CODE_METADATA_UNSUPPORTED 

Unsupported metadata.

BT_BAP_ASCS_RSP_CODE_METADATA_REJECTED 

Metadata rejected by server.

BT_BAP_ASCS_RSP_CODE_METADATA_INVALID 

Invalid metadata.

BT_BAP_ASCS_RSP_CODE_NO_MEM 

Server has insufficient resources.

BT_BAP_ASCS_RSP_CODE_UNSPECIFIED 

Unspecified error.

◆ bt_bap_bass_att_err

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

Broadcast Audio Scan Service (BASS) specific ATT error codes.

Enumerator
BT_BAP_BASS_ERR_OPCODE_NOT_SUPPORTED 

Opcode not supported.

BT_BAP_BASS_ERR_INVALID_SRC_ID 

Invalid source ID supplied.

◆ bt_bap_big_enc_state

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

Broadcast Isochronous Group encryption state reported by the Scan Delegator.

Enumerator
BT_BAP_BIG_ENC_STATE_NO_ENC 

The Broadcast Isochronous Group not encrypted.

BT_BAP_BIG_ENC_STATE_BCODE_REQ 

The Broadcast Isochronous Group broadcast code requested.

BT_BAP_BIG_ENC_STATE_DEC 

The Broadcast Isochronous Group decrypted.

BT_BAP_BIG_ENC_STATE_BAD_CODE 

The Broadcast Isochronous Group bad broadcast code.

◆ bt_bap_ep_state

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

Endpoint states.

Enumerator
BT_BAP_EP_STATE_IDLE 

Audio Stream Endpoint Idle state.

BT_BAP_EP_STATE_CODEC_CONFIGURED 

Audio Stream Endpoint Codec Configured state.

BT_BAP_EP_STATE_QOS_CONFIGURED 

Audio Stream Endpoint QoS Configured state.

BT_BAP_EP_STATE_ENABLING 

Audio Stream Endpoint Enabling state.

BT_BAP_EP_STATE_STREAMING 

Audio Stream Endpoint Streaming state.

BT_BAP_EP_STATE_DISABLING 

Audio Stream Endpoint Disabling state.

BT_BAP_EP_STATE_RELEASING 

Audio Stream Endpoint Streaming state.

◆ bt_bap_pa_state

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

Periodic advertising state reported by the Scan Delegator.

Enumerator
BT_BAP_PA_STATE_NOT_SYNCED 

The periodic advertising has not been synchronized.

BT_BAP_PA_STATE_INFO_REQ 

Waiting for SyncInfo from Broadcast Assistant.

BT_BAP_PA_STATE_SYNCED 

Synchronized to periodic advertising.

BT_BAP_PA_STATE_FAILED 

Failed to synchronized to periodic advertising.

BT_BAP_PA_STATE_NO_PAST 

No periodic advertising sync transfer receiver from Broadcast Assistant.

Function Documentation

◆ bt_bap_broadcast_assistant_add_src()

int bt_bap_broadcast_assistant_add_src ( struct bt_conn *  conn,
const struct bt_bap_broadcast_assistant_add_src_param param 
)

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

Add a source on the server.

Parameters
connConnection to the server.
paramParameter struct.
Returns
Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_discover()

int bt_bap_broadcast_assistant_discover ( struct bt_conn *  conn)

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

Discover Broadcast Audio Scan Service on the server.

Warning: Only one connection can be active at any time; discovering for a new connection, will delete all previous data.

Parameters
connThe connection
Returns
int Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_mod_src()

int bt_bap_broadcast_assistant_mod_src ( struct bt_conn *  conn,
const struct bt_bap_broadcast_assistant_mod_src_param param 
)

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

Modify a source on the server.

Parameters
connConnection to the server.
paramParameter struct.
Returns
Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_read_recv_state()

int bt_bap_broadcast_assistant_read_recv_state ( struct bt_conn *  conn,
uint8_t  idx 
)

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

Read the specified receive state from the server.

Parameters
connConnection to the server.
idxThe index of the receive start (0 up to the value from bt_bap_broadcast_assistant_discover_cb)
Returns
Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_register_cb()

void bt_bap_broadcast_assistant_register_cb ( struct bt_bap_broadcast_assistant_cb cb)

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

Registers the callbacks used by Broadcast Audio Scan Service client.

◆ bt_bap_broadcast_assistant_rem_src()

int bt_bap_broadcast_assistant_rem_src ( struct bt_conn *  conn,
uint8_t  src_id 
)

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

Remove a source from the server.

Parameters
connConnection to the server.
src_idSource ID of the receive state.
Returns
Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_scan_start()

int bt_bap_broadcast_assistant_scan_start ( struct bt_conn *  conn,
bool  start_scan 
)

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

Scan start for BISes for a remote server.

This will let the Broadcast Audio Scan Service server know that this device is actively scanning for broadcast sources. The function can optionally also start scanning, if the caller does not want to start scanning itself.

Scan results, if start_scan is true, is sent to the bt_bap_broadcast_assistant_scan_cb callback.

Parameters
connConnection to the Broadcast Audio Scan Service server. Used to let the server know that we are scanning.
start_scanStart scanning if true. If false, the application should enable scan itself.
Returns
int Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_scan_stop()

int bt_bap_broadcast_assistant_scan_stop ( struct bt_conn *  conn)

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

Stop remote scanning for BISes for a server.

Parameters
connConnection to the server.
Returns
int Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_broadcast_assistant_set_broadcast_code()

int bt_bap_broadcast_assistant_set_broadcast_code ( struct bt_conn *  conn,
uint8_t  src_id,
const uint8_t  broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE] 
)

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

Set a broadcast code to the specified receive state.

Parameters
connConnection to the server.
src_idSource ID of the receive state.
broadcast_codeThe broadcast code.
Returns
Error value. 0 on success, GATT error or ERRNO on fail.

◆ bt_bap_ep_get_info()

int bt_bap_ep_get_info ( const struct bt_bap_ep *  ep,
struct bt_bap_ep_info info 
)

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

Return structure holding information of audio stream endpoint.

Parameters
epThe audio stream endpoint object.
infoThe structure object to be filled with the info.
Returns
0 in case of success or negative value in case of error.

◆ bt_bap_scan_delegator_add_src()

int bt_bap_scan_delegator_add_src ( const struct bt_bap_scan_delegator_add_src_param param)

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

Add a receive state source locally.

This will notify any connected clients about the new source. This allows them to modify and even remove it.

If CONFIG_BT_BAP_BROADCAST_SINK is enabled, any Broadcast Sink sources are autonomously added.

Parameters
paramThe parameters for adding the new source
Returns
int errno on failure, or source ID on success.

◆ bt_bap_scan_delegator_find_state()

const struct bt_bap_scan_delegator_recv_state * bt_bap_scan_delegator_find_state ( bt_bap_scan_delegator_state_func_t  func,
void *  user_data 
)

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

Find and return a receive state based on a compare function.

Parameters
funcThe compare callback function
user_dataUser specified data that sent to the callback function
Returns
The first receive state where the func returned true, or NULL

◆ bt_bap_scan_delegator_foreach_state()

void bt_bap_scan_delegator_foreach_state ( bt_bap_scan_delegator_state_func_t  func,
void *  user_data 
)

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

Iterate through all existing receive states.

Parameters
funcThe callback function
user_dataUser specified data that sent to the callback function

◆ bt_bap_scan_delegator_mod_src()

int bt_bap_scan_delegator_mod_src ( const struct bt_bap_scan_delegator_mod_src_param param)

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

Add a receive state source locally.

This will notify any connected clients about the new source. This allows them to modify and even remove it.

If CONFIG_BT_BAP_BROADCAST_SINK is enabled, any Broadcast Sink sources are autonomously modifed.

Parameters
paramThe parameters for adding the new source
Returns
int errno on failure, or source ID on success.

◆ bt_bap_scan_delegator_register_cb()

void bt_bap_scan_delegator_register_cb ( struct bt_bap_scan_delegator_cb cb)

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

Register the callbacks for the Basic Audio Profile Scan Delegator.

Parameters
cbPointer to the callback struct

◆ bt_bap_scan_delegator_rem_src()

int bt_bap_scan_delegator_rem_src ( uint8_t  src_id)

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

Remove a receive state source.

This will remove the receive state. If the receive state periodic advertising is synced, bt_bap_scan_delegator_cb.pa_sync_term_req() will be called.

If CONFIG_BT_BAP_BROADCAST_SINK is enabled, any Broadcast Sink sources are autonomously removed.

Parameters
src_idThe source ID to remove
Returns
int Error value. 0 on success, errno on fail.

◆ bt_bap_scan_delegator_set_bis_sync_state()

int bt_bap_scan_delegator_set_bis_sync_state ( uint8_t  src_id,
uint32_t  bis_synced[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS] 
)

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

Set the sync state of a receive state in the server.

Parameters
src_idThe source id used to identify the receive state.
bis_syncedArray of bitfields to set the BIS sync state for each subgroup.
Returns
int Error value. 0 on success, ERRNO on fail.

◆ bt_bap_scan_delegator_set_pa_state()

int bt_bap_scan_delegator_set_pa_state ( uint8_t  src_id,
enum bt_bap_pa_state  pa_state 
)

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

Set the periodic advertising sync state to syncing.

Set the periodic advertising sync state for a receive state to syncing, notifying Broadcast Assistants.

Parameters
src_idThe source id used to identify the receive state.
pa_stateThe Periodic Advertising sync state to set. BT_BAP_PA_STATE_NOT_SYNCED and BT_BAP_PA_STATE_SYNCED is not necessary to provide, as they are handled internally.
Returns
int Error value. 0 on success, errno on fail.

◆ bt_bap_stream_cb_register()

void bt_bap_stream_cb_register ( struct bt_bap_stream stream,
struct bt_bap_stream_ops ops 
)

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

Register Audio callbacks for a stream.

Register Audio callbacks for a stream.

Parameters
streamStream object.
opsStream operations structure.

◆ bt_bap_stream_config()

int bt_bap_stream_config ( struct bt_conn *  conn,
struct bt_bap_stream stream,
struct bt_bap_ep *  ep,
struct bt_audio_codec_cfg codec_cfg 
)

#include <zephyr/bluetooth/audio/bap.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
codec_cfgCodec configuration
Returns
Allocated Audio Stream object or NULL in case of error.

◆ bt_bap_stream_disable()

int bt_bap_stream_disable ( struct bt_bap_stream stream)

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

int bt_bap_stream_enable ( struct bt_bap_stream stream,
const uint8_t  meta[],
size_t  meta_len 
)

#include <zephyr/bluetooth/audio/bap.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
metaMetadata
meta_lenMetadata length
Returns
0 in case of success or negative value in case of error.

◆ bt_bap_stream_get_tx_sync()

int bt_bap_stream_get_tx_sync ( struct bt_bap_stream stream,
struct bt_iso_tx_info info 
)

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

Get ISO transmission timing info for a Basic Audio Profile stream.

Reads timing information for transmitted ISO packet on an ISO channel. The HCI_LE_Read_ISO_TX_Sync HCI command is used to retrieve this information from the controller.

Note
An SDU must have already been successfully transmitted on the ISO channel for this function to return successfully. Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .
Parameters
[in]streamStream object.
[out]infoTransmit info object.
Return values
0on success
-EINVALif the stream is invalid, if the stream is not configured for sending or if it is not connected with a isochronous stream
Anyreturn value from bt_iso_chan_get_tx_sync()

◆ bt_bap_stream_metadata()

int bt_bap_stream_metadata ( struct bt_bap_stream stream,
const uint8_t  meta[],
size_t  meta_len 
)

#include <zephyr/bluetooth/audio/bap.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
metaMetadata
meta_lenMetadata length
Returns
0 in case of success or negative value in case of error.

◆ bt_bap_stream_qos()

int bt_bap_stream_qos ( struct bt_conn *  conn,
struct bt_bap_unicast_group *  group 
)

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

int bt_bap_stream_reconfig ( struct bt_bap_stream stream,
struct bt_audio_codec_cfg codec_cfg 
)

#include <zephyr/bluetooth/audio/bap.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
codec_cfgCodec configuration
Returns
0 in case of success or negative value in case of error.

◆ bt_bap_stream_release()

int bt_bap_stream_release ( struct bt_bap_stream stream)

#include <zephyr/bluetooth/audio/bap.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_bap_broadcast_sink_delete(). Broadcast source streams cannot be released, but can be deleted by bt_bap_broadcast_source_delete().

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

◆ bt_bap_stream_send()

int bt_bap_stream_send ( struct bt_bap_stream stream,
struct net_buf buf,
uint16_t  seq_num 
)

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

Send data to Audio stream without timestamp.

Send data from buffer to the stream.

Note
Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .
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.
Returns
Bytes sent in case of success or negative value in case of error.

◆ bt_bap_stream_send_ts()

int bt_bap_stream_send_ts ( struct bt_bap_stream stream,
struct net_buf buf,
uint16_t  seq_num,
uint32_t  ts 
)

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

Send data to Audio stream with timestamp.

Send data from buffer to the stream.

Note
Support for sending must be supported, determined by CONFIG_BT_AUDIO_TX .
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.
Returns
Bytes sent in case of success or negative value in case of error.

◆ bt_bap_stream_start()

int bt_bap_stream_start ( struct bt_bap_stream stream)

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

Start Audio Stream.

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

For the unicast client, this will connect the CIS for the stream before sending the start command.

For the unicast server, this will put a BT_AUDIO_DIR_SINK stream into the streaming state if the CIS is connected (initialized by the unicast client). If the CIS is not connected yet, the stream will go into the streaming state as soon as the CIS is connected. BT_AUDIO_DIR_SOURCE streams will go into the streaming state when the unicast client sends the Receiver Start Ready operation, which will trigger the bt_bap_unicast_server_cb::start() callback.

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_bap_broadcast_source_start().

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

◆ bt_bap_stream_stop()

int bt_bap_stream_stop ( struct bt_bap_stream stream)

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

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