Zephyr API 3.6.99
Loading...
Searching...
No Matches
bap.h File Reference

Header for Bluetooth BAP. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/iso.h>
#include <zephyr/net_buf.h>
#include <zephyr/sys/slist.h>

Go to the source code of this file.

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 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_unicast_server_cb
 Unicast Server callback structure. More...
 
struct  bt_bap_unicast_group_stream_param
 Parameter struct for each stream in the unicast group. More...
 
struct  bt_bap_unicast_group_stream_pair_param
 Parameter struct for the unicast group functions. More...
 
struct  bt_bap_unicast_group_param
 Parameters for the creating unicast groups with bt_bap_unicast_group_create() More...
 
struct  bt_bap_unicast_client_cb
 Unicast Client callback structure. More...
 
struct  bt_bap_base_codec_id
 Codec ID structure for a Broadcast Audio Source Endpoint (BASE) More...
 
struct  bt_bap_base_subgroup_bis
 BIS structure for each BIS in a Broadcast Audio Source Endpoint (BASE) subgroup. More...
 
struct  bt_bap_broadcast_source_stream_param
 Broadcast Source stream parameters. More...
 
struct  bt_bap_broadcast_source_subgroup_param
 Broadcast Source subgroup parameters. More...
 
struct  bt_bap_broadcast_source_param
 Broadcast Source create parameters. More...
 
struct  bt_bap_broadcast_sink_cb
 Broadcast Audio Sink callback structure. 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_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)
 Macro used to initialise the object storing values of ASE Control Point notification.
 

Typedefs

typedef void(* bt_bap_ep_func_t) (struct bt_bap_ep *ep, void *user_data)
 The callback function called for each endpoint.
 
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_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_unicast_server_register (const struct bt_bap_unicast_server_register_param *param)
 Register the Unicast Server.
 
int bt_bap_unicast_server_unregister (void)
 Unregister the Unicast Server.
 
int bt_bap_unicast_server_register_cb (const struct bt_bap_unicast_server_cb *cb)
 Register unicast server callbacks.
 
int bt_bap_unicast_server_unregister_cb (const struct bt_bap_unicast_server_cb *cb)
 Unregister unicast server callbacks.
 
void bt_bap_unicast_server_foreach_ep (struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data)
 Iterate through all endpoints of the given connection.
 
int bt_bap_unicast_server_config_ase (struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, const struct bt_audio_codec_qos_pref *qos_pref)
 Initialize and configure a new ASE.
 
int bt_bap_unicast_group_create (struct bt_bap_unicast_group_param *param, struct bt_bap_unicast_group **unicast_group)
 Create unicast group.
 
int bt_bap_unicast_group_reconfig (struct bt_bap_unicast_group *unicast_group, const struct bt_bap_unicast_group_param *param)
 Reconfigure unicast group.
 
int bt_bap_unicast_group_add_streams (struct bt_bap_unicast_group *unicast_group, struct bt_bap_unicast_group_stream_pair_param params[], size_t num_param)
 Add streams to a unicast group as a unicast client.
 
int bt_bap_unicast_group_delete (struct bt_bap_unicast_group *unicast_group)
 Delete audio unicast group.
 
int bt_bap_unicast_client_register_cb (const struct bt_bap_unicast_client_cb *cb)
 Register unicast client callbacks.
 
int bt_bap_unicast_client_discover (struct bt_conn *conn, enum bt_audio_dir dir)
 Discover remote capabilities and endpoints.
 
const struct bt_bap_base * bt_bap_base_get_base_from_ad (const struct bt_data *ad)
 Generate a pointer to a BASE from periodic advertising data.
 
int bt_bap_base_get_size (const struct bt_bap_base *base)
 Get the size of a BASE.
 
int bt_bap_base_get_pres_delay (const struct bt_bap_base *base)
 Get the presentation delay value of a BASE.
 
int bt_bap_base_get_subgroup_count (const struct bt_bap_base *base)
 Get the subgroup count of a BASE.
 
int bt_bap_base_get_bis_indexes (const struct bt_bap_base *base, uint32_t *bis_indexes)
 Get all BIS indexes of a BASE.
 
int bt_bap_base_foreach_subgroup (const struct bt_bap_base *base, bool(*func)(const struct bt_bap_base_subgroup *subgroup, void *user_data), void *user_data)
 Iterate on all subgroups in the BASE.
 
int bt_bap_base_get_subgroup_codec_id (const struct bt_bap_base_subgroup *subgroup, struct bt_bap_base_codec_id *codec_id)
 Get the codec ID of a subgroup.
 
int bt_bap_base_get_subgroup_codec_data (const struct bt_bap_base_subgroup *subgroup, uint8_t **data)
 Get the codec configuration data of a subgroup.
 
int bt_bap_base_get_subgroup_codec_meta (const struct bt_bap_base_subgroup *subgroup, uint8_t **meta)
 Get the codec metadata of a subgroup.
 
int bt_bap_base_subgroup_codec_to_codec_cfg (const struct bt_bap_base_subgroup *subgroup, struct bt_audio_codec_cfg *codec_cfg)
 Store subgroup codec data in a Codec config parsing APIs.
 
int bt_bap_base_get_subgroup_bis_count (const struct bt_bap_base_subgroup *subgroup)
 Get the BIS count of a subgroup.
 
int bt_bap_base_subgroup_get_bis_indexes (const struct bt_bap_base_subgroup *subgroup, uint32_t *bis_indexes)
 Get all BIS indexes of a subgroup.
 
int bt_bap_base_subgroup_foreach_bis (const struct bt_bap_base_subgroup *subgroup, bool(*func)(const struct bt_bap_base_subgroup_bis *bis, void *user_data), void *user_data)
 Iterate on all BIS in the subgroup.
 
int bt_bap_base_subgroup_bis_codec_to_codec_cfg (const struct bt_bap_base_subgroup_bis *bis, struct bt_audio_codec_cfg *codec_cfg)
 Store BIS codec configuration data in a Codec config parsing APIs.
 
int bt_bap_broadcast_source_create (struct bt_bap_broadcast_source_param *param, struct bt_bap_broadcast_source **source)
 Create audio broadcast source.
 
int bt_bap_broadcast_source_reconfig (struct bt_bap_broadcast_source *source, struct bt_bap_broadcast_source_param *param)
 Reconfigure audio broadcast source.
 
int bt_bap_broadcast_source_update_metadata (struct bt_bap_broadcast_source *source, const uint8_t meta[], size_t meta_len)
 Modify the metadata of an audio broadcast source.
 
int bt_bap_broadcast_source_start (struct bt_bap_broadcast_source *source, struct bt_le_ext_adv *adv)
 Start audio broadcast source.
 
int bt_bap_broadcast_source_stop (struct bt_bap_broadcast_source *source)
 Stop audio broadcast source.
 
int bt_bap_broadcast_source_delete (struct bt_bap_broadcast_source *source)
 Delete audio broadcast source.
 
int bt_bap_broadcast_source_get_id (struct bt_bap_broadcast_source *source, uint32_t *const broadcast_id)
 Get the broadcast ID of a broadcast source.
 
int bt_bap_broadcast_source_get_base (struct bt_bap_broadcast_source *source, struct net_buf_simple *base_buf)
 Get the Broadcast Audio Stream Endpoint of a broadcast source.
 
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.
 
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.
 
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[16])
 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

Header for Bluetooth BAP.

Copyright (c) 2020 Bose Corporation Copyright (c) 2021-2024 Nordic Semiconductor ASA

SPDX-License-Identifier: Apache-2.0