Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
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. | |
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_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_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. | |
Bluetooth Basic Audio Profile (BAP)
#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.
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_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_PA_INTERVAL_UNKNOWN 0xFFFF |
#include <zephyr/bluetooth/audio/bap.h>
Value indicating that the periodic advertising interval is unknown.
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 |
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.
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. |
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 |
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. |
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) |
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. |
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. |
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. |
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.
conn | Connection to the server. |
src_id | Source ID of the receive state. |
broadcast_code | The broadcast code. |
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 modifed.
param | The parameters for adding the new source |
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.
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 |
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.
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. |
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_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 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().
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 |