Zephyr Project API  3.4.0
A Scalable Open Source RTOS
bap.h File Reference

Header for Bluetooth BAP. More...

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_scan_delegator_subgroup
 
struct  bt_bap_scan_delegator_recv_state
 
struct  bt_bap_scan_delegator_cb
 
struct  bt_bap_ep_info
 
struct  bt_bap_stream
 Basic Audio Profile stream structure. More...
 
struct  bt_bap_stream_ops
 Stream operation. More...
 
struct  bt_bap_unicast_server_cb
 
struct  bt_bap_unicast_group_stream_param
 
struct  bt_bap_unicast_group_stream_pair_param
 Parameter struct for the unicast group functions. More...
 
struct  bt_bap_unicast_group_param
 
struct  bt_bap_unicast_client_cb
 
struct  bt_bap_base_bis_data
 
struct  bt_bap_base_subgroup
 
struct  bt_bap_base
 
struct  bt_bap_broadcast_source_stream_param
 
struct  bt_bap_broadcast_source_subgroup_param
 
struct  bt_bap_broadcast_source_create_param
 
struct  bt_bap_broadcast_sink_cb
 
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
 
struct  bt_bap_broadcast_assistant_mod_src_param
 

Macros

#define BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN   0
 
#define BT_BAP_SCAN_DELEGATOR_MAX_SUBGROUPS   0
 
#define BT_BAP_BASE_MIN_SIZE   16
 
#define BT_BAP_BASE_BIS_DATA_MIN_SIZE   2 /* index and length */
 
#define BT_BAP_PA_INTERVAL_UNKNOWN   0xFFFF
 
#define BT_BAP_BIS_SYNC_NO_PREF   0xFFFFFFFF
 Broadcast Assistant no BIS sync preference. More...
 
#define BROADCAST_SNK_STREAM_CNT   0
 
#define BROADCAST_SNK_SUBGROUP_CNT   0
 
#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. More...
 

Typedefs

typedef void(* bt_bap_ep_func_t) (struct bt_bap_ep *ep, void *user_data)
 The callback function called for each endpoint. More...
 
typedef enum bt_bap_scan_delegator_iter(* bt_bap_scan_delegator_state_func_t) (const struct bt_bap_scan_delegator_recv_state *recv_state, void *user_data)
 
typedef void(* bt_bap_broadcast_assistant_write_cb) (struct bt_conn *conn, int err)
 Callback function for writes. More...
 

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
}
 
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 }
 
enum  bt_bap_bass_att_err { BT_BAP_BASS_ERR_OPCODE_NOT_SUPPORTED = 0x80 , BT_BAP_BASS_ERR_INVALID_SRC_ID = 0x81 }
 
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
}
 
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...
 
enum  bt_bap_scan_delegator_iter { BT_BAP_SCAN_DELEGATOR_ITER_STOP = 0 , BT_BAP_SCAN_DELEGATOR_ITER_CONTINUE }
 

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. More...
 
void bt_bap_stream_cb_register (struct bt_bap_stream *stream, struct bt_bap_stream_ops *ops)
 Register Audio callbacks for a stream. More...
 
int bt_bap_stream_config (struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep, struct bt_codec *codec)
 Configure Audio Stream. More...
 
int bt_bap_stream_reconfig (struct bt_bap_stream *stream, struct bt_codec *codec)
 Reconfigure Audio Stream. More...
 
int bt_bap_stream_qos (struct bt_conn *conn, struct bt_bap_unicast_group *group)
 Configure Audio Stream QoS. More...
 
int bt_bap_stream_enable (struct bt_bap_stream *stream, struct bt_codec_data *meta, size_t meta_count)
 Enable Audio Stream. More...
 
int bt_bap_stream_metadata (struct bt_bap_stream *stream, struct bt_codec_data *meta, size_t meta_count)
 Change Audio Stream Metadata. More...
 
int bt_bap_stream_disable (struct bt_bap_stream *stream)
 Disable Audio Stream. More...
 
int bt_bap_stream_start (struct bt_bap_stream *stream)
 Start Audio Stream. More...
 
int bt_bap_stream_stop (struct bt_bap_stream *stream)
 Stop Audio Stream. More...
 
int bt_bap_stream_release (struct bt_bap_stream *stream)
 Release Audio Stream. More...
 
int bt_bap_stream_send (struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
 Send data to Audio stream. More...
 
int bt_bap_unicast_server_register_cb (const struct bt_bap_unicast_server_cb *cb)
 Register unicast server callbacks. More...
 
int bt_bap_unicast_server_unregister_cb (const struct bt_bap_unicast_server_cb *cb)
 Unregister unicast server callbacks. More...
 
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. More...
 
int bt_bap_unicast_server_config_ase (struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_codec *codec, const struct bt_codec_qos_pref *qos_pref)
 Initialize and configure a new ASE. More...
 
int bt_bap_unicast_group_create (struct bt_bap_unicast_group_param *param, struct bt_bap_unicast_group **unicast_group)
 Create audio unicast group. More...
 
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. More...
 
int bt_bap_unicast_group_delete (struct bt_bap_unicast_group *unicast_group)
 Delete audio unicast group. More...
 
int bt_bap_unicast_client_register_cb (const struct bt_bap_unicast_client_cb *cb)
 Register unicast client callbacks. More...
 
int bt_bap_unicast_client_discover (struct bt_conn *conn, enum bt_audio_dir dir)
 Discover remote capabilities and endpoints. More...
 
int bt_bap_decode_base (struct bt_data *data, struct bt_bap_base *base)
 Decode a Broadcast Audio Source Endpoint (BASE) from advertising data. More...
 
int bt_bap_broadcast_source_create (struct bt_bap_broadcast_source_create_param *param, struct bt_bap_broadcast_source **source)
 Create audio broadcast source. More...
 
int bt_bap_broadcast_source_reconfig (struct bt_bap_broadcast_source *source, struct bt_codec *codec, struct bt_codec_qos *qos)
 Reconfigure audio broadcast source. More...
 
int bt_bap_broadcast_source_update_metadata (struct bt_bap_broadcast_source *source, const struct bt_codec_data meta[], size_t meta_count)
 Modify the metadata of an audio broadcast source. More...
 
int bt_bap_broadcast_source_start (struct bt_bap_broadcast_source *source, struct bt_le_ext_adv *adv)
 Start audio broadcast source. More...
 
int bt_bap_broadcast_source_stop (struct bt_bap_broadcast_source *source)
 Stop audio broadcast source. More...
 
int bt_bap_broadcast_source_delete (struct bt_bap_broadcast_source *source)
 Delete audio broadcast source. More...
 
int bt_bap_broadcast_source_get_id (const struct bt_bap_broadcast_source *source, uint32_t *const broadcast_id)
 Get the broadcast ID of a broadcast source. More...
 
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. More...
 
int bt_bap_broadcast_sink_register_cb (struct bt_bap_broadcast_sink_cb *cb)
 Register Broadcast sink callbacks *. More...
 
int bt_bap_broadcast_sink_scan_start (const struct bt_le_scan_param *param)
 Start scan for broadcast sources. More...
 
int bt_bap_broadcast_sink_scan_stop (void)
 Stop scan for broadcast sources. More...
 
int bt_bap_broadcast_sink_create (struct bt_le_per_adv_sync *pa_sync, uint32_t broadcast_id)
 Create a Broadcast Sink from a periodic advertising sync. More...
 
int bt_bap_broadcast_sink_sync (struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_bap_stream *streams[], const uint8_t broadcast_code[16])
 Sync to a broadcaster's audio. More...
 
int bt_bap_broadcast_sink_stop (struct bt_bap_broadcast_sink *sink)
 Stop audio broadcast sink. More...
 
int bt_bap_broadcast_sink_delete (struct bt_bap_broadcast_sink *sink)
 Release a broadcast sink. More...
 
void bt_bap_scan_delegator_register_cb (struct bt_bap_scan_delegator_cb *cb)
 Register the callbacks for the Basic Audio Profile Scan Delegator. More...
 
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. More...
 
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. More...
 
int bt_bap_scan_delegator_add_src (const struct bt_bap_scan_delegator_add_src_param *param)
 Add a receive state source locally. More...
 
int bt_bap_scan_delegator_mod_src (const struct bt_bap_scan_delegator_mod_src_param *param)
 Add a receive state source locally. More...
 
int bt_bap_scan_delegator_rem_src (uint8_t src_id)
 Remove a receive state source. More...
 
void bt_bap_scan_delegator_foreach_state (bt_bap_scan_delegator_state_func_t func, void *user_data)
 Iterate through all existing receive states. More...
 
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. More...
 
int bt_bap_broadcast_assistant_discover (struct bt_conn *conn)
 Discover Broadcast Audio Scan Service on the server. More...
 
int bt_bap_broadcast_assistant_scan_start (struct bt_conn *conn, bool start_scan)
 Scan start for BISes for a remote server. More...
 
int bt_bap_broadcast_assistant_scan_stop (struct bt_conn *conn)
 Stop remote scanning for BISes for a server. More...
 
void bt_bap_broadcast_assistant_register_cb (struct bt_bap_broadcast_assistant_cb *cb)
 Registers the callbacks used by Broadcast Audio Scan Service client. More...
 
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. More...
 
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. More...
 
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. More...
 
int bt_bap_broadcast_assistant_rem_src (struct bt_conn *conn, uint8_t src_id)
 Remove a source from the server. More...
 
int bt_bap_broadcast_assistant_read_recv_state (struct bt_conn *conn, uint8_t idx)
 Read the specified receive state from the server. More...
 

Detailed Description

Header for Bluetooth BAP.

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

SPDX-License-Identifier: Apache-2.0