Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
Bluetooth Basic Audio Profile (BAP) . More...
Topics | |
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_qos_cfg |
QoS configuration structure. More... | |
struct | bt_bap_qos_cfg_pref |
Audio Stream Quality of Service Preference structure. More... | |
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 to hold the Basic Audio Profile Scan Delegator callbacks. More... | |
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_unicast_server_register_param |
Structure for registering Unicast Server. More... | |
struct | bt_bap_scan_delegator_add_src_param |
Parameters for bt_bap_scan_delegator_add_src() More... | |
struct | bt_bap_scan_delegator_mod_src_param |
Parameters for bt_bap_scan_delegator_mod_src() More... | |
struct | bt_bap_broadcast_assistant_cb |
Struct to hold the Basic Audio Profile Broadcast Assistant callbacks. More... | |
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_BASS_MAX_SUBGROUPS 0 |
#define | BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU |
An invalid Broadcast ID. | |
#define | BT_BAP_BASS_VALID_BIT_BITFIELD(_bis_bitfield) |
Check if a BAP BASS BIS_Sync bitfield is valid. | |
#define | BT_BAP_QOS_CFG(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd) |
Helper to declare elements of bt_bap_qos_cfg. | |
#define | BT_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) |
Helper to declare Input Unframed bt_bap_qos_cfg. | |
#define | BT_BAP_QOS_CFG_FRAMED(_interval, _sdu, _rtn, _latency, _pd) |
Helper to declare Input Framed bt_bap_qos_cfg. | |
#define | BT_BAP_QOS_CFG_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, _pref_pd_min, _pref_pd_max) |
Helper to declare elements of bt_bap_qos_cfg_pref. | |
#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_BIS_SYNC_FAILED 0xFFFFFFFF |
BIS sync value indicating that the BIG sync has failed for any reason. | |
#define | BT_BAP_ASCS_RSP(c, 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. | |
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_connect (struct bt_bap_stream *stream) |
Connect unicast 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. | |
int | bt_bap_scan_delegator_register (struct bt_bap_scan_delegator_cb *cb) |
Register the Basic Audio Profile Scan Delegator and BASS. | |
int | bt_bap_scan_delegator_unregister (void) |
unregister the Basic Audio Profile Scan Delegator and BASS. | |
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[0]) |
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_state * | bt_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. | |
int | 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_unregister_cb (struct bt_bap_broadcast_assistant_cb *cb) |
Unregisters the callbacks used by the 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_ISO_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. | |
Bluetooth Basic Audio Profile (BAP) .
The Basic Audio Profile (BAP) allows for both unicast and broadcast Audio Stream control.
#define BT_BAP_ASCS_RSP | ( | c, | |
r ) |
#include <zephyr/bluetooth/audio/bap.h>
Macro used to initialise the object storing values of ASE Control Point notification.
c | Response Code field |
r | Reason field - bt_bap_ascs_reason or bt_audio_metadata_type (see notes in bt_bap_ascs_rsp). |
#define BT_BAP_BASS_MAX_SUBGROUPS 0 |
#include <zephyr/bluetooth/audio/bap.h>
#define BT_BAP_BASS_VALID_BIT_BITFIELD | ( | _bis_bitfield | ) |
#include <zephyr/bluetooth/audio/bap.h>
Check if a BAP BASS BIS_Sync bitfield is valid.
Valid options are eiter a bitmask of valid BIS indices, including none (0x00000000) or BT_BAP_BIS_SYNC_NO_PREF (0xFFFFFFFF).
_bis_bitfield | BIS_Sync bitfield (uint32) |
#define BT_BAP_BIS_SYNC_FAILED 0xFFFFFFFF |
#include <zephyr/bluetooth/audio/bap.h>
BIS sync value indicating that the BIG sync has failed for any reason.
#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
#define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU |
#include <zephyr/bluetooth/audio/bap.h>
An invalid Broadcast ID.
#define BT_BAP_PA_INTERVAL_UNKNOWN 0xFFFF |
#include <zephyr/bluetooth/audio/bap.h>
Value indicating that the periodic advertising interval is unknown.
#define BT_BAP_QOS_CFG | ( | _interval, | |
_framing, | |||
_phy, | |||
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd ) |
#include <zephyr/bluetooth/audio/bap.h>
Helper to declare elements of bt_bap_qos_cfg.
_interval | SDU interval (usec) |
_framing | Framing |
_phy | Target PHY |
_sdu | Maximum SDU Size |
_rtn | Retransmission number |
_latency | Maximum Transport Latency (msec) |
_pd | Presentation Delay (usec) |
#define BT_BAP_QOS_CFG_FRAMED | ( | _interval, | |
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd ) |
#include <zephyr/bluetooth/audio/bap.h>
Helper to declare Input Framed bt_bap_qos_cfg.
_interval | SDU interval (usec) |
_sdu | Maximum SDU Size |
_rtn | Retransmission number |
_latency | Maximum Transport Latency (msec) |
_pd | Presentation Delay (usec) |
#define BT_BAP_QOS_CFG_PREF | ( | _unframed_supported, | |
_phy, | |||
_rtn, | |||
_latency, | |||
_pd_min, | |||
_pd_max, | |||
_pref_pd_min, | |||
_pref_pd_max ) |
#include <zephyr/bluetooth/audio/bap.h>
Helper to declare elements of bt_bap_qos_cfg_pref.
_unframed_supported | Unframed PDUs supported |
_phy | Preferred Target PHY |
_rtn | Preferred Retransmission number |
_latency | Preferred Maximum Transport Latency (msec) |
_pd_min | Minimum Presentation Delay (usec) |
_pd_max | Maximum Presentation Delay (usec) |
_pref_pd_min | Preferred Minimum Presentation Delay (usec) |
_pref_pd_max | Preferred Maximum Presentation Delay (usec) |
#define BT_BAP_QOS_CFG_UNFRAMED | ( | _interval, | |
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd ) |
#include <zephyr/bluetooth/audio/bap.h>
Helper to declare Input Unframed bt_bap_qos_cfg.
_interval | SDU interval (usec) |
_sdu | Maximum SDU Size |
_rtn | Retransmission number |
_latency | Maximum Transport Latency (msec) |
_pd | Presentation Delay (usec) |
typedef void(* bt_bap_broadcast_assistant_write_cb) (struct bt_conn *conn, int err) |
#include <zephyr/bluetooth/audio/bap.h>
Callback function for writes.
conn | The connection to the peer device. |
err | Error value. 0 on success, GATT error on fail. |
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.
recv_state | The receive state. |
user_data | User data. |
true | to 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() |
false | to continue iterating |
anonymous enum |
#include <zephyr/bluetooth/audio/bap.h>
QoS Preferred PHY.
Enumerator | |
---|---|
BT_BAP_QOS_CFG_1M | LE 1M PHY. |
BT_BAP_QOS_CFG_2M | LE 2M PHY. |
BT_BAP_QOS_CFG_CODED | LE Coded PHY. |
enum 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.
enum 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.
enum 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. |
enum bt_bap_big_enc_state |
#include <zephyr/bluetooth/audio/bap.h>
Broadcast Isochronous Group encryption state reported by the Scan Delegator.
enum bt_bap_ep_state |
#include <zephyr/bluetooth/audio/bap.h>
Endpoint states.
enum bt_bap_pa_state |
#include <zephyr/bluetooth/audio/bap.h>
Periodic advertising state reported by the Scan Delegator.
#include <zephyr/bluetooth/audio/bap.h>
QoS Framing.
Enumerator | |
---|---|
BT_BAP_QOS_CFG_FRAMING_UNFRAMED | Packets may be framed or unframed. |
BT_BAP_QOS_CFG_FRAMING_FRAMED | Packets are always framed. |
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.
conn | Connection to the server. |
param | Parameter struct. |
0 | Success |
-EINVAL | conn is NULL or p conn has not done discovery or if param is invalid |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
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.
conn | The connection |
0 | Success |
-EINVAL | conn is NULL |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected GATT error |
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.
conn | Connection to the server. |
param | Parameter struct. |
0 | Success |
-EINVAL | conn is NULL or p conn has not done discovery or if param is invalid |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
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.
conn | Connection to the server. |
idx | The index of the receive start (0 up to the value from bt_bap_broadcast_assistant_discover_cb) |
0 | Success |
-EINVAL | conn is NULL or p conn has not done discovery or src_id is invalid |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
int 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.
cb | The callback structure. |
0 | on success |
-EINVAL | if cb is NULL |
-EALREADY | if cb was already registered |
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.
conn | Connection to the server. |
src_id | Source ID of the receive state. |
0 | Success |
-EINVAL | conn is NULL or p conn has not done discovery or src_id is invalid |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
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.
conn | Connection to the Broadcast Audio Scan Service server. Used to let the server know that we are scanning. |
start_scan | Start scanning if true. If false, the application should enable scan itself. |
0 | Success |
-EINVAL | conn is NULL of if conn has not done discovery |
-EBUSY | Another operation is already in progress for this conn |
-EAGAIN | Bluetooth has not been enabled. |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
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.
conn | Connection to the server. |
0 | Success |
-EINVAL | conn is NULL of if conn has not done discovery |
-EBUSY | Another operation is already in progress for this conn |
-EAGAIN | Bluetooth has not been enabled. |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
int bt_bap_broadcast_assistant_set_broadcast_code | ( | struct bt_conn * | conn, |
uint8_t | src_id, | ||
const uint8_t | broadcast_code[BT_ISO_BROADCAST_CODE_SIZE] ) |
#include <zephyr/bluetooth/audio/bap.h>
Set a broadcast code to the specified receive state.
conn | Connection to the server. |
src_id | Source ID of the receive state. |
broadcast_code | The broadcast code. |
0 | Success |
-EINVAL | conn is NULL or p conn has not done discovery or src_id is invalid |
-EBUSY | Another operation is already in progress for this conn |
-ENOTCONN | conn is not connected |
-ENOMEM | Could not allocated memory for the request |
-ENOEXEC | Unexpected scan or GATT error |
int bt_bap_broadcast_assistant_unregister_cb | ( | struct bt_bap_broadcast_assistant_cb * | cb | ) |
#include <zephyr/bluetooth/audio/bap.h>
Unregisters the callbacks used by the Broadcast Audio Scan Service client.
cb | The callback structure. |
0 | on success |
-EINVAL | if cb is NULL |
-EALREADY | if cb was not registered |
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.
ep | The audio stream endpoint object. |
info | The structure object to be filled with the info. |
0 | in case of success |
-EINVAL | if ep or info are NULL |
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.
param | The parameters for adding the new source |
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.
func | The compare callback function |
user_data | User specified data that sent to the callback function |
func
returned true, or NULL 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.
func | The callback function |
user_data | User specified data that sent to the callback function |
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 modified.
param | The parameters for adding the new source |
int bt_bap_scan_delegator_register | ( | struct bt_bap_scan_delegator_cb * | cb | ) |
#include <zephyr/bluetooth/audio/bap.h>
Register the Basic Audio Profile Scan Delegator and BASS.
Register the scan deligator and Broadcast Audio Scan Service (BASS) dynamically at runtime.
Only one set of callbacks can be registered at any one time, and calling this function multiple times will override any previously registered callbacks.
cb | Pointer to the callback struct |
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.
src_id | The source ID to remove |
#include <zephyr/bluetooth/audio/bap.h>
Set the sync state of a receive state in the server.
src_id | The source id used to identify the receive state. |
bis_synced | Array of bitfields to set the BIS sync state for each subgroup. |
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.
src_id | The source id used to identify the receive state. |
pa_state | The 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. |
int bt_bap_scan_delegator_unregister | ( | void | ) |
#include <zephyr/bluetooth/audio/bap.h>
unregister the Basic Audio Profile Scan Delegator and BASS.
Unregister the scan deligator and Broadcast Audio Scan Service (BASS) dynamically at runtime.
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.
stream | Stream object. |
ops | Stream operations structure. |
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.
conn | Connection object |
stream | Stream object being configured |
ep | Remote Audio Endpoint being configured |
codec_cfg | Codec configuration |
int bt_bap_stream_connect | ( | struct bt_bap_stream * | stream | ) |
#include <zephyr/bluetooth/audio/bap.h>
Connect unicast audio stream.
This procedure is used by a unicast client to connect the connected isochronous stream (CIS) associated with the audio stream. If two audio streams share a CIS, then this only needs to be done once for those streams. This can only be done for streams in the QoS configured or enabled states.
The bt_bap_stream_ops.connected() callback will be called on the streams once this has finished.
This shall only be called for unicast streams, and only as the unicast client (
CONFIG_BT_BAP_UNICAST_CLIENT
).
stream | Stream object |
0 | in case of success |
-EINVAL | if the stream, endpoint, ISO channel or connection is NULL |
-EBADMSG | if the stream or ISO channel is in an invalid state for connection |
-EOPNOTSUPP | if the role of the stream is not BT_HCI_ROLE_CENTRAL |
-EALREADY | if the ISO channel is already connecting or connected |
-EBUSY | if another ISO channel is connecting |
-ENOEXEC | if otherwise rejected by the ISO layer |
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.
stream | Stream object |
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.
stream | Stream object |
meta | Metadata |
meta_len | Metadata length |
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.
CONFIG_BT_AUDIO_TX.
[in] | stream | Stream object. |
[out] | info | Transmit info object. |
0 | on success |
-EINVAL | if the stream is invalid, if the stream is not configured for sending or if it is not connected with a isochronous stream |
Any | return value from bt_iso_chan_get_tx_sync() |
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.
stream | Stream object |
meta | Metadata |
meta_len | Metadata length |
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.
conn | Connection object |
group | Unicast group object |
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.
stream | Stream object being reconfigured |
codec_cfg | Codec configuration |
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().
stream | Stream object |
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.
CONFIG_BT_AUDIO_TX.
stream | Stream object. |
buf | Buffer containing data to be sent. |
seq_num | Packet Sequence number. This value shall be incremented for each call to this function and at least once per SDU interval for a specific channel. |
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.
CONFIG_BT_AUDIO_TX.
stream | Stream object. |
buf | Buffer containing data to be sent. |
seq_num | Packet Sequence number. This value shall be incremented for each call to this function and at least once per SDU interval for a specific channel. |
ts | Timestamp 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. |
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 send the receiver start ready command to the unicast server for BT_AUDIO_DIR_SOURCE ASEs. The CIS is required to be connected first by bt_bap_stream_connect() before the command can be sent.
For the unicast server, this will execute the receiver start ready command on the unicast server for BT_AUDIO_DIR_SINK ASEs. If the CIS is not connected yet, the stream will go into the streaming state as soon as the CIS is connected.
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().
stream | Stream object |
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().
stream | Stream object |
0 | Success |
-EINVAL | The stream does not have an endpoint or a connection, of the stream's connection's role is not BT_HCI_ROLE_CENTRAL |
-EBADMSG | The state of the stream endpoint is not BT_BAP_EP_STATE_DISABLING |
-EALREADY | The CIS state of the is not in a connected state, and thus is already stopping |
-EBUSY | The stream is busy with another operation |
-ENOTCONN | The stream ACL connection is not connected |
-ENOMEM | No memory to send request |
-ENOEXEC | The request was rejected by GATT |