Bluetooth: Audio: Rename bt_audio_unicast_server to bt_bap_...

Rename the bt_audio_audio_server API to bt_bap_unicast_server
and move API to bap.h.

This also adds the _bap_ infix for bt_unicast_server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-02-20 15:17:18 +01:00 committed by Carles Cufí
commit eeae1f096a
31 changed files with 699 additions and 300 deletions

View file

@ -9,6 +9,6 @@ API Reference
.. doxygengroup:: bt_audio
.. doxygengroup:: bt_audio_client
.. doxygengroup:: bt_audio_server
.. doxygengroup:: bt_bap_unicast_server
.. doxygengroup:: bt_audio_broadcast
.. doxygengroup:: bt_audio_codec_cfg

View file

@ -4,7 +4,7 @@
/*
* Copyright (c) 2020 Intel Corporation
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
* Copyright (c) 2020-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -17,7 +17,6 @@
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/iso.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/lc3.h>
/**
@ -39,6 +38,8 @@ extern "C" {
/** Maximum presentation delay in microseconds */
#define BT_AUDIO_PD_MAX 0xFFFFFFU
#define BT_AUDIO_BROADCAST_CODE_SIZE 16
/** Endpoint states */
enum bt_audio_state {
/** Audio Stream Endpoint Idle state */
@ -1464,139 +1465,6 @@ struct bt_audio_unicast_client_cb {
*/
int bt_audio_unicast_client_register_cb(const struct bt_audio_unicast_client_cb *cb);
/** Unicast Server callback structure */
struct bt_audio_unicast_server_cb {
/** @brief Endpoint config request callback
*
* Config callback is called whenever an endpoint is requested to be
* configured
*
* @param[in] conn Connection object.
* @param[in] ep Local Audio Endpoint being configured.
* @param[in] dir Direction of the endpoint.
* @param[in] codec Codec configuration.
* @param[out] stream Pointer to stream that will be configured for
* the endpoint.
* @param[out] pref Pointer to a QoS preference object that shall
* be populated with values. Invalid values will
* reject the codec configuration request.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*config)(struct bt_conn *conn,
const struct bt_audio_ep *ep,
enum bt_audio_dir dir,
const struct bt_codec *codec,
struct bt_audio_stream **stream,
struct bt_codec_qos_pref *const pref);
/** @brief Stream reconfig request callback
*
* Reconfig callback is called whenever an Audio Stream needs to be
* reconfigured with different codec configuration.
*
* @param[in] stream Stream object being reconfigured.
* @param[in] dir Direction of the endpoint.
* @param[in] codec Codec configuration.
* @param[out] pref Pointer to a QoS preference object that shall
* be populated with values. Invalid values will
* reject the codec configuration request.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*reconfig)(struct bt_audio_stream *stream,
enum bt_audio_dir dir,
const struct bt_codec *codec,
struct bt_codec_qos_pref *const pref);
/** @brief Stream QoS request callback
*
* QoS callback is called whenever an Audio Stream Quality of
* Service needs to be configured.
*
* @param stream Stream object being reconfigured.
* @param qos Quality of Service configuration.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*qos)(struct bt_audio_stream *stream,
const struct bt_codec_qos *qos);
/** @brief Stream Enable request callback
*
* Enable callback is called whenever an Audio Stream is requested to
* be enabled to stream.
*
* @param stream Stream object being enabled.
* @param meta Metadata entries
* @param meta_count Number of metadata entries
*
* @return 0 in case of success or negative value in case of error.
*/
int (*enable)(struct bt_audio_stream *stream,
const struct bt_codec_data *meta,
size_t meta_count);
/** @brief Stream Start request callback
*
* Start callback is called whenever an Audio Stream is requested to
* start streaming.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*start)(struct bt_audio_stream *stream);
/** @brief Stream Metadata update request callback
*
* Metadata callback is called whenever an Audio Stream is requested to
* update its metadata.
*
* @param stream Stream object.
* @param meta Metadata entries
* @param meta_count Number of metadata entries
*
* @return 0 in case of success or negative value in case of error.
*/
int (*metadata)(struct bt_audio_stream *stream,
const struct bt_codec_data *meta,
size_t meta_count);
/** @brief Stream Disable request callback
*
* Disable callback is called whenever an Audio Stream is requested to
* disable the stream.
*
* @param stream Stream object being disabled.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*disable)(struct bt_audio_stream *stream);
/** @brief Stream Stop callback
*
* Stop callback is called whenever an Audio Stream is requested to
* stop streaming.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*stop)(struct bt_audio_stream *stream);
/** @brief Stream release callback
*
* Release callback is called whenever a new Audio Stream needs to be
* released and thus deallocated.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*release)(struct bt_audio_stream *stream);
};
/** Broadcast Audio Sink callback structure */
struct bt_audio_broadcast_sink_cb {
/** @brief Scan receive callback
@ -1805,33 +1673,6 @@ struct bt_audio_stream_ops {
*/
void bt_audio_stream_cb_register(struct bt_audio_stream *stream,
struct bt_audio_stream_ops *ops);
/**
* @defgroup bt_audio_server Audio Server APIs
* @ingroup bt_audio
* @{
*/
/** @brief Register unicast server callbacks.
*
* Only one callback structure can be registered, and attempting to
* registering more than one will result in an error.
*
* @param cb Unicast server callback structure.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb *cb);
/** @brief Unregister unicast server callbacks.
*
* May only unregister a callback structure that has previously been
* registered by bt_audio_unicast_server_register_cb().
*
* @param cb Unicast server callback structure.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_cb *cb);
/** Structure holding information of audio stream endpoint */
struct bt_audio_ep_info {
@ -1855,39 +1696,6 @@ struct bt_audio_ep_info {
int bt_audio_ep_get_info(const struct bt_audio_ep *ep,
struct bt_audio_ep_info *info);
/** @typedef bt_audio_ep_func_t
* @brief The callback function called for each endpoint.
*
* @param ep The structure object with endpoint info.
* @param user_data Data to pass to the function.
*/
typedef void (*bt_audio_ep_func_t)(struct bt_audio_ep *ep, void *user_data);
/** @brief Iterate through all endpoints of the given connection.
*
* @param conn Connection object
* @param func Function to call for each endpoint.
* @param user_data Data to pass to the callback function.
*/
void bt_audio_unicast_server_foreach_ep(struct bt_conn *conn,
bt_audio_ep_func_t func,
void *user_data);
/** @brief Initialize and configure a new ASE.
*
* @param conn Connection object
* @param stream Configured stream object to be attached to the ASE
* @param codec Codec configuration
* @param qos_pref Audio Stream Quality of Service Preference
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_audio_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
struct bt_codec *codec,
const struct bt_codec_qos_pref *qos_pref);
/** @} */ /* End of group bt_audio_server */
/**
* @defgroup bt_audio_client Audio Client APIs
* @ingroup bt_audio
@ -2045,7 +1853,7 @@ int bt_audio_stream_disable(struct bt_audio_stream *stream);
* streaming state as soon as the CIS is connected.
* @ref 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 @ref bt_audio_unicast_server_cb.start() callback.
* the @ref 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
@ -2265,7 +2073,7 @@ struct bt_audio_broadcast_source_create_param {
* The string "Broadcast Code" shall be
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
*/
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
};
/** @brief Create audio broadcast source.

View file

@ -2,7 +2,7 @@
* @brief Header for Bluetooth BAP.
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -11,6 +11,14 @@
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_BAP_
#include <zephyr/types.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/audio.h>
/**
* @brief Bluetooth Basic Audio Profile (BAP)
* @defgroup bt_bap Bluetooth Basic Audio Profile
* @ingroup bluetooth
* @{
*/
#if defined(CONFIG_BT_BAP_SCAN_DELEGATOR)
#define BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN CONFIG_BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN
@ -20,8 +28,6 @@
#define BT_BAP_SCAN_DELEGATOR_MAX_SUBGROUPS 0
#endif
#define BT_BAP_BROADCAST_CODE_SIZE 16
#define BT_BAP_PA_STATE_NOT_SYNCED 0x00
#define BT_BAP_PA_STATE_INFO_REQ 0x01
#define BT_BAP_PA_STATE_SYNCED 0x02
@ -59,7 +65,7 @@ struct bt_bap_scan_delegator_recv_state {
uint8_t pa_sync_state;
uint8_t encrypt_state;
uint32_t broadcast_id; /* 24 bits */
uint8_t bad_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t bad_code[BT_AUDIO_BROADCAST_CODE_SIZE];
uint8_t num_subgroups;
struct bt_bap_scan_delegator_subgroup subgroups[BT_BAP_SCAN_DELEGATOR_MAX_SUBGROUPS];
};
@ -76,6 +82,196 @@ struct bt_bap_scan_delegator_cb {
const struct bt_iso_biginfo *biginfo);
};
/**
* @defgroup bt_bap_unicast_server BAP Unicast Server APIs
* @ingroup bt_bap
* @{
*/
/** Unicast Server callback structure */
struct bt_bap_unicast_server_cb {
/**
* @brief Endpoint config request callback
*
* Config callback is called whenever an endpoint is requested to be
* configured
*
* @param[in] conn Connection object.
* @param[in] ep Local Audio Endpoint being configured.
* @param[in] dir Direction of the endpoint.
* @param[in] codec Codec configuration.
* @param[out] stream Pointer to stream that will be configured for the endpoint.
* @param[out] pref Pointer to a QoS preference object that shall be populated with
* values. Invalid values will reject the codec configuration request.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*config)(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
const struct bt_codec *codec, struct bt_audio_stream **stream,
struct bt_codec_qos_pref *const pref);
/**
* @brief Stream reconfig request callback
*
* Reconfig callback is called whenever an Audio Stream needs to be
* reconfigured with different codec configuration.
*
* @param[in] stream Stream object being reconfigured.
* @param[in] dir Direction of the endpoint.
* @param[in] codec Codec configuration.
* @param[out] pref Pointer to a QoS preference object that shall be populated with
* values. Invalid values will reject the codec configuration request.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*reconfig)(struct bt_audio_stream *stream, enum bt_audio_dir dir,
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref);
/**
* @brief Stream QoS request callback
*
* QoS callback is called whenever an Audio Stream Quality of
* Service needs to be configured.
*
* @param stream Stream object being reconfigured.
* @param qos Quality of Service configuration.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*qos)(struct bt_audio_stream *stream, const struct bt_codec_qos *qos);
/**
* @brief Stream Enable request callback
*
* Enable callback is called whenever an Audio Stream is requested to be enabled to stream.
*
* @param stream Stream object being enabled.
* @param meta Metadata entries
* @param meta_count Number of metadata entries
*
* @return 0 in case of success or negative value in case of error.
*/
int (*enable)(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
size_t meta_count);
/**
* @brief Stream Start request callback
*
* Start callback is called whenever an Audio Stream is requested to start streaming.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*start)(struct bt_audio_stream *stream);
/**
* @brief Stream Metadata update request callback
*
* Metadata callback is called whenever an Audio Stream is requested to update its metadata.
*
* @param stream Stream object.
* @param meta Metadata entries
* @param meta_count Number of metadata entries
*
* @return 0 in case of success or negative value in case of error.
*/
int (*metadata)(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
size_t meta_count);
/**
* @brief Stream Disable request callback
*
* Disable callback is called whenever an Audio Stream is requested to disable the stream.
*
* @param stream Stream object being disabled.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*disable)(struct bt_audio_stream *stream);
/**
* @brief Stream Stop callback
*
* Stop callback is called whenever an Audio Stream is requested to stop streaming.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*stop)(struct bt_audio_stream *stream);
/**
* @brief Stream release callback
*
* Release callback is called whenever a new Audio Stream needs to be released and thus
* deallocated.
*
* @param stream Stream object.
*
* @return 0 in case of success or negative value in case of error.
*/
int (*release)(struct bt_audio_stream *stream);
};
/**
* @brief Register unicast server callbacks.
*
* Only one callback structure can be registered, and attempting to
* registering more than one will result in an error.
*
* @param cb Unicast server callback structure.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_bap_unicast_server_register_cb(const struct bt_bap_unicast_server_cb *cb);
/**
* @brief Unregister unicast server callbacks.
*
* May only unregister a callback structure that has previously been
* registered by bt_bap_unicast_server_register_cb().
*
* @param cb Unicast server callback structure.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_bap_unicast_server_unregister_cb(const struct bt_bap_unicast_server_cb *cb);
/**
* @typedef bt_bap_ep_func_t
* @brief The callback function called for each endpoint.
*
* @param ep The structure object with endpoint info.
* @param user_data Data to pass to the function.
*/
typedef void (*bt_bap_ep_func_t)(struct bt_audio_ep *ep, void *user_data);
/**
* @brief Iterate through all endpoints of the given connection.
*
* @param conn Connection object
* @param func Function to call for each endpoint.
* @param user_data Data to pass to the callback function.
*/
void bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data);
/**
* @brief Initialize and configure a new ASE.
*
* @param conn Connection object
* @param stream Configured stream object to be attached to the ASE
* @param codec Codec configuration
* @param qos_pref Audio Stream Quality of Service Preference
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
struct bt_codec *codec,
const struct bt_codec_qos_pref *qos_pref);
/** @} */ /* End of group bt_bap_unicast_server */
/**
* @brief Register the callbacks for the Basic Audio Profile Scan Delegator
*
@ -286,7 +482,7 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn,
*/
int bt_bap_broadcast_assistant_set_broadcast_code(
struct bt_conn *conn, uint8_t src_id,
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE]);
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]);
/** @brief Remove a source from the server.
*
@ -307,4 +503,7 @@ int bt_bap_broadcast_assistant_rem_src(struct bt_conn *conn, uint8_t src_id);
*/
int bt_bap_broadcast_assistant_read_recv_state(struct bt_conn *conn,
uint8_t idx);
/** @} */ /* end of bt_bap */
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_BAP_ */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -306,7 +306,7 @@ struct bt_cap_initiator_broadcast_create_param {
* The string "Broadcast Code" shall be
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
*/
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
};
/**

View file

@ -12,7 +12,7 @@ CONFIG_BT_DEVICE_NAME="Hearing Aid sample"
CONFIG_BT_DEVICE_APPEARANCE=2624
CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_BAP_UNICAST_SERVER=y
CONFIG_BT_ASCS_ASE_SNK_COUNT=1
CONFIG_BT_ASCS_ASE_SRC_COUNT=1
# Support an ISO channel per ASE

View file

@ -1,7 +1,7 @@
/** @file
* @brief Bluetooth Basic Audio Profile (BAP) Unicast Server role.
*
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
* Copyright (c) 2022 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
@ -14,6 +14,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/pacs.h>
NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_ASCS_ASE_SRC_COUNT,
@ -343,7 +344,7 @@ static int lc3_release(struct bt_audio_stream *stream)
return 0;
}
static const struct bt_audio_unicast_server_cb unicast_server_cb = {
static const struct bt_bap_unicast_server_cb unicast_server_cb = {
.config = lc3_config,
.reconfig = lc3_reconfig,
.qos = lc3_qos,
@ -421,7 +422,7 @@ static struct bt_pacs_cap cap_source = {
int bap_unicast_sr_init(void)
{
bt_audio_unicast_server_register_cb(&unicast_server_cb);
bt_bap_unicast_server_register_cb(&unicast_server_cb);
bt_pacs_cap_register(BT_AUDIO_DIR_SINK, &cap_sink);

View file

@ -2,7 +2,7 @@ CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_BAP_UNICAST_SERVER=y
CONFIG_BT_ASCS_ASE_SNK_COUNT=2
CONFIG_BT_ASCS_ASE_SRC_COUNT=1
# Support an ISO channel per ASE

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -13,6 +13,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/pacs.h>
#include <zephyr/sys/byteorder.h>
@ -460,7 +461,7 @@ static int lc3_release(struct bt_audio_stream *stream)
return 0;
}
static const struct bt_audio_unicast_server_cb unicast_server_cb = {
static const struct bt_bap_unicast_server_cb unicast_server_cb = {
.config = lc3_config,
.reconfig = lc3_reconfig,
.qos = lc3_qos,
@ -714,7 +715,7 @@ void main(void)
printk("Bluetooth initialized\n");
bt_audio_unicast_server_register_cb(&unicast_server_cb);
bt_bap_unicast_server_register_cb(&unicast_server_cb);
bt_pacs_cap_register(BT_AUDIO_DIR_SINK, &cap_sink);
bt_pacs_cap_register(BT_AUDIO_DIR_SOURCE, &cap_source);

View file

@ -48,7 +48,7 @@ zephyr_library_sources_ifdef(CONFIG_MCTL media_proxy.c)
zephyr_library_sources_ifdef(CONFIG_BT_ASCS ascs.c)
zephyr_library_sources_ifdef(CONFIG_BT_PACS pacs.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_STREAM bap_stream.c codec.c bap_iso.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_UNICAST_SERVER bap_unicast_server.c)
zephyr_library_sources_ifdef(CONFIG_BT_BAP_UNICAST_SERVER bap_unicast_server.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_UNICAST_CLIENT bap_unicast_client.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_BROADCAST_SOURCE bap_broadcast_source.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_BROADCAST_SINK bap_broadcast_sink.c)

View file

@ -0,0 +1,391 @@
# Bluetooth Audio - Basic Audio Profile configuration options
#
# Copyright (c) 2020 Intel Corporation
# Copyright (c) 2022-2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
config BT_AUDIO_UNICAST
bool
depends on BT_CONN
select BT_SMP
select BT_ISO_UNICAST
config BT_BAP_UNICAST_SERVER
bool "Bluetooth Unicast Audio Server Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_PERIPHERAL
select BT_AUDIO_UNICAST
select BT_ISO_PERIPHERAL
select BT_GATT_DYNAMIC_DB
select BT_GATT_CACHING
select BT_ASCS
help
This option enables support for Bluetooth Unicast Audio Server
using Isochronous channels.
config BT_BAP_UNICAST_CLIENT
bool "Bluetooth Unicast Audio Client Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_AUDIO_UNICAST
select BT_ISO_CENTRAL
select BT_CENTRAL
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select BT_GATT_AUTO_UPDATE_MTU
help
This option enables support for Bluetooth Unicast Audio Client
using Isochronous channels.
config BT_CODEC_MAX_DATA_COUNT
int "Codec Capabilities Data Count"
default 5
range 1 128
help
This option defines the maximum number of LTV entries a codec can
store.
config BT_CODEC_MAX_DATA_LEN
int "Codec Capabilities Data Length"
default 4
range 1 128
help
This option defines the maximum value length of an LTV entry a codec
can store.
config BT_CODEC_MAX_METADATA_COUNT
int "Codec Metadata Count"
default 2
range 1 128
help
This option defines the maximum number of LTV entries a metadata can
store.
config BT_CODEC_MAX_METADATA_LEN
int "Codec Metadata Length"
default 4
range 1 128
help
This option defines the maximum value length of an LTV entry a
metadata can store.
if BT_BAP_UNICAST_CLIENT
config BT_BAP_UNICAST_CLIENT_GROUP_COUNT
int "Basic Audio Unicast Group count"
depends on BT_AUDIO_UNICAST
default BT_ISO_MAX_CIG
range 1 BT_ISO_MAX_CIG
help
This option sets the number of connected audio groups to support as
the unicast client.
config BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT
int "Basic Audio Unicast Group Stream count"
depends on BT_BAP_UNICAST_CLIENT_GROUP_COUNT > 0
default 1
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
range 1 31
help
This option sets the maximum number of streams per unicast group
to support.
config BT_BAP_UNICAST_CLIENT_PAC_COUNT
int "Basic Audio Profile PAC count"
default 2
range 0 146
help
This option enables caching a number of Published Audio Capabilities
(PAC) for Basic Audio Profile on a per connection basis.
config BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT
int "Basic Audio Profile ASE Sink count"
default 2
range 0 255
help
This option enables caching a number of Audio Stream Endpoint Sink
instances for Basic Audio Profile on a per connection basis.
config BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT
int "Basic Audio Profile ASE Source count"
default 1
range 0 255
help
This option enables caching a number of Audio Stream Endpoint Source
instances for Basic Audio Profile on a per connection basis.
endif # BT_BAP_UNICAST_CLIENT
config BT_BAP_BROADCAST_SOURCE
bool "Bluetooth Broadcast Source Audio Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_ISO_BROADCASTER
help
This option enables support for Bluetooth Broadcast Source Audio using
Isochronous channels.
if BT_BAP_BROADCAST_SOURCE
config BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT
int "Basic Audio Broadcast Source subgroup count"
default 1
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
range 1 31
help
This option sets the maximum number of subgroups per broadcast source
to support.
config BT_BAP_BROADCAST_SRC_COUNT
int "Basic Audio Broadcaster source count"
default 1
range 1 BT_ISO_MAX_BIG
help
This option sets the number of broadcast sources to support.
One broadcast source can send multiple streams
(up to BT_BAP_BROADCAST_SRC_STREAM_COUNT per broadcast source).
config BT_BAP_BROADCAST_SRC_STREAM_COUNT
int "Basic Audio Broadcast Source Stream count"
default 1
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
range 1 31
help
This option sets the maximum number of streams per broadcast source
to support.
endif # BT_BAP_BROADCAST_SOURCE
config BT_BAP_BROADCAST_SINK
bool "Bluetooth Broadcast Sink Audio Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_ISO_SYNC_RECEIVER
depends on BT_PERIPHERAL
depends on BT_PAC_SNK
help
This option enables support for Bluetooth Broadcast Sink Audio using
Isochronous channels.
if BT_BAP_BROADCAST_SINK
config BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT
int "Basic Audio Profile Broadcast Sink subgroup count"
default 1
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
range 1 31
help
This option sets the maximum number of subgroups per broadcast sink
to support.
config BT_BAP_BROADCAST_SNK_COUNT
int "Basic Audio Broadcaster Sink count"
default 1
range 0 BT_ISO_MAX_BIG
help
This option sets the number of broadcast sinks to support.
One broadcast sink can receive multiple streams
(up to BT_BAP_BROADCAST_SNK_STREAM_COUNT per broadcast sink).
config BT_BAP_BROADCAST_SNK_STREAM_COUNT
int "Basic Audio Broadcast Sink Stream count"
depends on BT_BAP_BROADCAST_SNK_COUNT > 0
default 1
range 1 BT_ISO_MAX_CHAN
help
This option sets the maximum number of streams per broadcast sink
to support.
endif # BT_BAP_BROADCAST_SINK
config BT_BAP_SCAN_DELEGATOR
bool "Basic Audio Profile Scan Delegator role support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_OBSERVER
select BT_EXT_ADV
select BT_PER_ADV_SYNC
select BT_ISO_SYNC_RECEIVER
help
This option enables support for the Scan Delegator role and the
Broadcast Audio Scan Service (BASS).
if BT_BAP_SCAN_DELEGATOR
config BT_BAP_SCAN_DELEGATOR_RECV_STATE_COUNT
int "Scan Delegator Receive State Count"
default 1
range 1 3
help
Sets the number of receive state characteristics present on the
server. Each characteristic may hold information to sync to a
periodic advertise or a broadcast isochronous stream.
config BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN
int "Scan Delegator Maximum Metadata Length"
default 32
range 0 255
help
The maximum metadata length support by the BASS server.
config BT_BAP_SCAN_DELEGATOR_MAX_SUBGROUPS
int "Scan Delegator Maximum Number of Subgroups support"
default 1
range 0 31
help
The maximum number of BIS subgroups supported.
endif # BT_BAP_SCAN_DELEGATOR
config BT_BAP_BROADCAST_ASSISTANT
bool "Basic Audio Profile Broadcast Assistant role support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_OBSERVER
select BT_EXT_ADV
select BT_PER_ADV_SYNC
select BT_ISO_SYNC_RECEIVER
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select BT_GATT_AUTO_UPDATE_MTU
help
This option enables support for the Broadcast Assistant role.
if BT_BAP_BROADCAST_ASSISTANT
config BT_BAP_BROADCAST_ASSISTANT_RECV_STATE_COUNT
int "Broadcast Assistant Max Receive State Count"
default 1
range 1 255
help
Sets the number of maximum receive stat characteristics that will be
discovered and ready to use. Each characteristic may hold information
to sync to a periodic advertise or a broadcast isochronous stream.
endif # BT_BAP_BROADCAST_ASSISTANT
config BT_BAP_DEBUG_STREAM
bool "Basic Audio Profile Stream debug"
select DEPRECATED
depends on BT_BAP_STREAM
help
Use this option to enable Basic Audio Profile Stream debug logs.
module = BT_BAP_STREAM
legacy-debug-sym = BT_BAP_DEBUG_STREAM
module-str = "Bluetooth Audio Stream"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
parent-module = BT
module = BT_AUDIO_CODEC
module-str = "Bluetooth Audio Codec"
source "subsys/logging/Kconfig.template.log_config_inherit"
config BT_BAP_DEBUG_STREAM_DATA
bool "Bluetooth Audio Stream data debug"
depends on BT_BAP_STREAM_LOG_LEVEL_DBG
help
Use this option to enable Bluetooth Audio Stream data debug logs for
the Bluetooth Audio functionality. This will enable debug logs for all
audio data received and sent.
config BT_DEBUG_ASCS
bool "Audio Stream Control Service debug"
select DEPRECATED
depends on BT_ASCS
help
Use this option to enable Audio Stream Control Service debug logs for
the Bluetooth Audio functionality.
module = BT_ASCS
legacy-debug-sym = BT_DEBUG_ASCS
module-str = "Audio Stream Control Service"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_DEBUG_BAP_UNICAST_SERVER
bool "Bluetooth Audio Unicast Server debug"
select DEPRECATED
depends on BT_BAP_UNICAST_SERVER
help
Use this option to enable Bluetooth Audio Unicast Server debug logs
for the Bluetooth Audio functionality.
module = BT_BAP_UNICAST_SERVER
legacy-debug-sym = BT_DEBUG_BAP_UNICAST_SERVER
module-str = "Bluetooth Audio Unicast Server"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_AUDIO_DEBUG_UNICAST_CLIENT
bool "Basic Audio Profile debug"
select DEPRECATED
depends on BT_BAP_UNICAST_CLIENT
help
Use this option to enable Basic Audio Profile debug logs for the
Bluetooth Audio functionality.
module = BT_BAP_UNICAST_CLIENT
legacy-debug-sym = BT_AUDIO_DEBUG_UNICAST_CLIENT
module-str = "Basic Audio Profile"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_AUDIO_DEBUG_BROADCAST_SOURCE
bool "Bluetooth Audio Broadcast Source debug"
select DEPRECATED
depends on BT_BAP_BROADCAST_SOURCE
help
Use this option to enable Bluetooth Audio Broadcast Source debug logs
for the Bluetooth Audio functionality.
module = BT_BAP_BROADCAST_SOURCE
legacy-debug-sym = BT_AUDIO_DEBUG_BROADCAST_SOURCE
module-str = "Bluetooth Audio Broadcast Source"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_AUDIO_DEBUG_BROADCAST_SINK
bool "Bluetooth Audio Broadcast Sink debug"
select DEPRECATED
depends on BT_BAP_BROADCAST_SINK
help
Use this option to enable Bluetooth Audio Broadcast Sink debug logs
for the Bluetooth Audio functionality.
module = BT_BAP_BROADCAST_SINK
legacy-debug-sym = BT_AUDIO_DEBUG_BROADCAST_SINK
module-str = "Bluetooth Audio Broadcast Sink"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_DEBUG_BAP_SCAN_DELEGATOR
bool "Broadcast Audio Scan Service debug"
select DEPRECATED
depends on BT_BAP_SCAN_DELEGATOR
help
Use this option to enable Broadcast Audio Scan Service debug logs for
the Bluetooth Audio functionality.
module = BT_BAP_SCAN_DELEGATOR
legacy-debug-sym = BT_DEBUG_BAP_SCAN_DELEGATOR
module-str = "Broadcast Audio Scan Service"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_DEBUG_BAP_BROADCAST_ASSISTANT
bool "Broadcast Audio Scan Service client debug"
select DEPRECATED
depends on BT_BAP_BROADCAST_ASSISTANT
help
Use this option to enable Broadcast Audio Scan Service client
debug logs for the Bluetooth Audio functionality.
module = BT_BAP_BROADCAST_ASSISTANT
legacy-debug-sym = BT_DEBUG_BAP_BROADCAST_ASSISTANT
module-str = "Broadcast Audio Scan Service client debug"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_BAP_STREAM
# Virtual/hidden option
bool
default y if BT_ASCS || BT_BAP_UNICAST_CLIENT || \
BT_BAP_BROADCAST_SOURCE || BT_BAP_BROADCAST_SINK
parent-module = BT
module = BT_BAP_ISO
module-str = "Bluetooth Audio ISO"
source "subsys/logging/Kconfig.template.log_config_inherit"
rsource "Kconfig.pacs"
rsource "Kconfig.ascs"

View file

@ -12,7 +12,7 @@ config BT_AUDIO_UNICAST
select BT_SMP
select BT_ISO_UNICAST
config BT_AUDIO_UNICAST_SERVER
config BT_BAP_UNICAST_SERVER
bool "Bluetooth Unicast Audio Server Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_PERIPHERAL
@ -291,16 +291,16 @@ legacy-debug-sym = BT_DEBUG_ASCS
module-str = "Audio Stream Control Service"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
config BT_AUDIO_DEBUG_UNICAST_SERVER
config BT_DEBUG_BAP_UNICAST_SERVER
bool "Bluetooth Audio Unicast Server debug"
select DEPRECATED
depends on BT_AUDIO_UNICAST_SERVER
depends on BT_BAP_UNICAST_SERVER
help
Use this option to enable Bluetooth Audio Unicast Server debug logs
for the Bluetooth Audio functionality.
module = BT_AUDIO_UNICAST_SERVER
legacy-debug-sym = BT_AUDIO_DEBUG_UNICAST_SERVER
module = BT_BAP_UNICAST_SERVER
legacy-debug-sym = BT_DEBUG_BAP_UNICAST_SERVER
module-str = "Bluetooth Audio Unicast Server"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"

View file

@ -10,7 +10,7 @@ config BT_CAP
config BT_CAP_ACCEPTOR
bool "Common Audio Profile Acceptor Role Support [EXPERIMENTAL]"
depends on BT_AUDIO_UNICAST_SERVER || (BT_AUDIO_BROADCAST_SINK && BT_BAP_SCAN_DELEGATOR)
depends on BT_BAP_UNICAST_SERVER || (BT_AUDIO_BROADCAST_SINK && BT_BAP_SCAN_DELEGATOR)
select EXPERIMENTAL
help
Enabling this will enable the CAP Acceptor role. This instantiates the

View file

@ -8,7 +8,7 @@ menuconfig BT_HAS
bool "Hearing Access Service support [EXPERIMENTAL]"
select EXPERIMENTAL
select UTF8
depends on BT_AUDIO_UNICAST_SERVER
depends on BT_BAP_UNICAST_SERVER
help
This option enables support for Hearing Access Service.

View file

@ -47,7 +47,7 @@ BUILD_ASSERT(CONFIG_BT_ASCS_MAX_ACTIVE_ASES <= MAX(MAX_ASES_SESSIONS,
CONFIG_BT_ISO_MAX_CHAN),
"Max active ASEs are set to more than actual number of ASEs or ISOs");
#if defined(CONFIG_BT_AUDIO_UNICAST_SERVER)
#if defined(CONFIG_BT_BAP_UNICAST_SERVER)
#define ASE_ID(_ase) ase->ep.status.id
#define ASE_DIR(_id) \
@ -1666,7 +1666,7 @@ static ssize_t ascs_config(struct bt_ascs *ascs, struct net_buf_simple *buf)
return buf->size;
}
void bt_ascs_foreach_ep(struct bt_conn *conn, bt_audio_ep_func_t func, void *user_data)
void bt_ascs_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data)
{
sys_snode_t *ase_node;
struct bt_ascs *ascs = ascs_get(conn);
@ -2716,4 +2716,4 @@ static int control_point_notify(struct bt_conn *conn, const void *data, uint16_t
return bt_gatt_notify_uuid(conn, BT_UUID_ASCS_ASE_CP, ascs_svc.attrs, data, len);
}
#endif /* BT_AUDIO_UNICAST_SERVER */
#endif /* BT_BAP_UNICAST_SERVER */

View file

@ -2,7 +2,7 @@
* @brief Internal APIs for ASCS handling
* Copyright (c) 2020 Intel Corporation
* Copyright (c) 2022 Nordic Semiconductor ASA
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -365,4 +365,4 @@ void ascs_ep_set_state(struct bt_audio_ep *ep, uint8_t state);
int bt_ascs_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_codec *codec,
const struct bt_codec_qos_pref *qos_pref);
void bt_ascs_foreach_ep(struct bt_conn *conn, bt_audio_ep_func_t func, void *user_data);
void bt_ascs_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data);

View file

@ -2,7 +2,7 @@
/*
* Copyright (c) 2019 Bose Corporation
* Copyright (c) 2022 Nordic Semiconductor ASA
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -120,7 +120,7 @@ static int parse_recv_state(const void *data, uint16_t length,
}
broadcast_code = net_buf_simple_pull_mem(&buf,
BT_BAP_BROADCAST_CODE_SIZE);
BT_AUDIO_BROADCAST_CODE_SIZE);
(void)memcpy(recv_state->bad_code, broadcast_code,
sizeof(recv_state->bad_code));
}
@ -814,7 +814,7 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn,
int bt_bap_broadcast_assistant_set_broadcast_code(
struct bt_conn *conn, uint8_t src_id,
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE])
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE])
{
struct bt_bap_bass_cp_broadcase_code *cp;
@ -834,7 +834,7 @@ int bt_bap_broadcast_assistant_set_broadcast_code(
cp->src_id = src_id;
(void)memcpy(cp->broadcast_code, broadcast_code,
BT_BAP_BROADCAST_CODE_SIZE);
BT_AUDIO_BROADCAST_CODE_SIZE);
return bt_bap_broadcast_assistant_common_cp(conn, &cp_buf);
}

View file

@ -85,7 +85,7 @@ struct bt_audio_broadcast_source {
/* The codec specific configured data for each stream in the subgroup */
struct bt_audio_broadcast_stream_data stream_data[BROADCAST_STREAM_CNT];
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
/* The subgroups containing the streams used to create the broadcast source */
sys_slist_t subgroups;

View file

@ -2,7 +2,7 @@
/*
* Copyright (c) 2019 Bose Corporation
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -49,7 +49,7 @@ struct bass_recv_state_internal {
bool active;
uint8_t index;
struct bt_bap_scan_delegator_recv_state state;
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
uint16_t pa_interval;
bool broadcast_code_received;
struct bt_le_per_adv_sync *pa_sync;

View file

@ -463,9 +463,9 @@ int bt_audio_stream_reconfig(struct bt_audio_stream *stream,
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) &&
role == BT_HCI_ROLE_CENTRAL) {
err = bt_unicast_client_config(stream, codec);
} else if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) &&
} else if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) &&
role == BT_HCI_ROLE_PERIPHERAL) {
err = bt_unicast_server_reconfig(stream, codec);
err = bt_bap_unicast_server_reconfig(stream, codec);
} else {
err = -EOPNOTSUPP;
}
@ -506,9 +506,9 @@ int bt_audio_stream_start(struct bt_audio_stream *stream)
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) &&
role == BT_HCI_ROLE_CENTRAL) {
err = bt_unicast_client_start(stream);
} else if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) &&
} else if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) &&
role == BT_HCI_ROLE_PERIPHERAL) {
err = bt_unicast_server_start(stream);
err = bt_bap_unicast_server_start(stream);
} else {
err = -EOPNOTSUPP;
}
@ -558,9 +558,9 @@ int bt_audio_stream_metadata(struct bt_audio_stream *stream,
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) &&
role == BT_HCI_ROLE_CENTRAL) {
err = bt_unicast_client_metadata(stream, meta, meta_count);
} else if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) &&
} else if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) &&
role == BT_HCI_ROLE_PERIPHERAL) {
err = bt_unicast_server_metadata(stream, meta, meta_count);
err = bt_bap_unicast_server_metadata(stream, meta, meta_count);
} else {
err = -EOPNOTSUPP;
}
@ -602,9 +602,9 @@ int bt_audio_stream_disable(struct bt_audio_stream *stream)
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) &&
role == BT_HCI_ROLE_CENTRAL) {
err = bt_unicast_client_disable(stream);
} else if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) &&
} else if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) &&
role == BT_HCI_ROLE_PERIPHERAL) {
err = bt_unicast_server_disable(stream);
err = bt_bap_unicast_server_disable(stream);
} else {
err = -EOPNOTSUPP;
}
@ -652,9 +652,9 @@ int bt_audio_stream_release(struct bt_audio_stream *stream)
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) &&
role == BT_HCI_ROLE_CENTRAL) {
err = bt_unicast_client_release(stream);
} else if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) &&
} else if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) &&
role == BT_HCI_ROLE_PERIPHERAL) {
err = bt_unicast_server_release(stream);
err = bt_bap_unicast_server_release(stream);
} else {
err = -EOPNOTSUPP;
}

View file

@ -9,6 +9,7 @@
#include <zephyr/sys/check.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include "bap_iso.h"
#include "pacs_internal.h"
@ -16,11 +17,11 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_unicast_server, CONFIG_BT_AUDIO_UNICAST_SERVER_LOG_LEVEL);
LOG_MODULE_REGISTER(bt_bap_unicast_server, CONFIG_BT_BAP_UNICAST_SERVER_LOG_LEVEL);
const struct bt_audio_unicast_server_cb *unicast_server_cb;
const struct bt_bap_unicast_server_cb *unicast_server_cb;
int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb *cb)
int bt_bap_unicast_server_register_cb(const struct bt_bap_unicast_server_cb *cb)
{
CHECKIF(cb == NULL) {
LOG_DBG("cb is NULL");
@ -37,7 +38,7 @@ int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb
return 0;
}
int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_cb *cb)
int bt_bap_unicast_server_unregister_cb(const struct bt_bap_unicast_server_cb *cb)
{
CHECKIF(cb == NULL) {
LOG_DBG("cb is NULL");
@ -54,8 +55,7 @@ int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_c
return 0;
}
int bt_unicast_server_reconfig(struct bt_audio_stream *stream,
const struct bt_codec *codec)
int bt_bap_unicast_server_reconfig(struct bt_audio_stream *stream, const struct bt_codec *codec)
{
struct bt_audio_ep *ep;
int err;
@ -81,7 +81,7 @@ int bt_unicast_server_reconfig(struct bt_audio_stream *stream,
return 0;
}
int bt_unicast_server_start(struct bt_audio_stream *stream)
int bt_bap_unicast_server_start(struct bt_audio_stream *stream)
{
struct bt_audio_ep *ep = stream->ep;
@ -104,8 +104,7 @@ int bt_unicast_server_start(struct bt_audio_stream *stream)
return 0;
}
int bt_unicast_server_metadata(struct bt_audio_stream *stream,
struct bt_codec_data meta[],
int bt_bap_unicast_server_metadata(struct bt_audio_stream *stream, struct bt_codec_data meta[],
size_t meta_count)
{
struct bt_audio_ep *ep;
@ -134,7 +133,7 @@ int bt_unicast_server_metadata(struct bt_audio_stream *stream,
return 0;
}
int bt_unicast_server_disable(struct bt_audio_stream *stream)
int bt_bap_unicast_server_disable(struct bt_audio_stream *stream)
{
struct bt_audio_ep *ep;
int err;
@ -163,7 +162,7 @@ int bt_unicast_server_disable(struct bt_audio_stream *stream)
return 0;
}
int bt_unicast_server_release(struct bt_audio_stream *stream)
int bt_bap_unicast_server_release(struct bt_audio_stream *stream)
{
int err;
@ -185,15 +184,14 @@ int bt_unicast_server_release(struct bt_audio_stream *stream)
return 0;
}
int bt_audio_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
struct bt_codec *codec,
const struct bt_codec_qos_pref *qos_pref)
{
return bt_ascs_config_ase(conn, stream, codec, qos_pref);
}
void bt_audio_unicast_server_foreach_ep(struct bt_conn *conn, bt_audio_ep_func_t func,
void *user_data)
void bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data)
{
bt_ascs_foreach_ep(conn, func, user_data);
}

View file

@ -7,14 +7,13 @@
*/
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
extern const struct bt_audio_unicast_server_cb *unicast_server_cb;
extern const struct bt_bap_unicast_server_cb *unicast_server_cb;
int bt_unicast_server_reconfig(struct bt_audio_stream *stream,
const struct bt_codec *codec);
int bt_unicast_server_start(struct bt_audio_stream *stream);
int bt_unicast_server_metadata(struct bt_audio_stream *stream,
struct bt_codec_data meta[],
int bt_bap_unicast_server_reconfig(struct bt_audio_stream *stream, const struct bt_codec *codec);
int bt_bap_unicast_server_start(struct bt_audio_stream *stream);
int bt_bap_unicast_server_metadata(struct bt_audio_stream *stream, struct bt_codec_data meta[],
size_t meta_count);
int bt_unicast_server_disable(struct bt_audio_stream *stream);
int bt_unicast_server_release(struct bt_audio_stream *stream);
int bt_bap_unicast_server_disable(struct bt_audio_stream *stream);
int bt_bap_unicast_server_release(struct bt_audio_stream *stream);

View file

@ -32,7 +32,7 @@ config BT_L2CAP_TX_MTU
default 253 if BT_BREDR
default 69 if BT_MESH_GATT
default 65 if BT_SMP
default 64 if BT_AUDIO_UNICAST_SERVER || \
default 64 if BT_BAP_UNICAST_SERVER || \
BT_AUDIO_UNICAST_CLIENT || \
BT_AUDIO_BROADCAST_SINK || \
BT_BAP_SCAN_DELEGATOR || \

View file

@ -5,7 +5,7 @@
/*
* Copyright (c) 2020 Intel Corporation
* Copyright (c) 2022 Nordic Semiconductor ASA
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -21,6 +21,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/pacs.h>
#include "bt.h"
@ -773,7 +774,7 @@ static struct bt_codec lc3_codec = BT_CODEC_LC3(BT_CODEC_LC3_FREQ_ANY,
(BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL |
BT_AUDIO_CONTEXT_TYPE_MEDIA));
static const struct bt_audio_unicast_server_cb unicast_server_cb = {
static const struct bt_bap_unicast_server_cb unicast_server_cb = {
.config = lc3_config,
.reconfig = lc3_reconfig,
.qos = lc3_qos,
@ -2136,16 +2137,16 @@ static int cmd_init(const struct shell *sh, size_t argc, char *argv[])
return -ENOEXEC;
}
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER)) {
bt_audio_unicast_server_register_cb(&unicast_server_cb);
if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER)) {
bt_bap_unicast_server_register_cb(&unicast_server_cb);
}
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER) ||
if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) ||
IS_ENABLED(CONFIG_BT_AUDIO_BROADCAST_SINK)) {
bt_pacs_cap_register(BT_AUDIO_DIR_SINK, &cap_sink);
}
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER)) {
if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER)) {
bt_pacs_cap_register(BT_AUDIO_DIR_SOURCE, &cap_source);
}
@ -2322,7 +2323,7 @@ static int cmd_stop_sine(const struct shell *sh, size_t argc, char *argv[])
}
#endif /* CONFIG_LIBLC3 */
#if defined(CONFIG_BT_AUDIO_UNICAST_SERVER)
#if defined(CONFIG_BT_BAP_UNICAST_SERVER)
static void print_ase_info(struct bt_audio_ep *ep, void *user_data)
{
struct bt_audio_ep_info info;
@ -2339,11 +2340,11 @@ static int cmd_print_ase_info(const struct shell *sh, size_t argc, char *argv[])
return -ENOEXEC;
}
bt_audio_unicast_server_foreach_ep(default_conn, print_ase_info, NULL);
bt_bap_unicast_server_foreach_ep(default_conn, print_ase_info, NULL);
return 0;
}
#endif /* CONFIG_BT_AUDIO_UNICAST_SERVER */
#endif /* CONFIG_BT_BAP_UNICAST_SERVER */
SHELL_STATIC_SUBCMD_SET_CREATE(audio_cmds,
SHELL_CMD_ARG(init, NULL, NULL, cmd_init, 1, 0),
@ -2384,10 +2385,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(audio_cmds,
SHELL_CMD_ARG(enable, NULL, NULL, cmd_enable, 1, 1),
SHELL_CMD_ARG(stop, NULL, NULL, cmd_stop, 1, 0),
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
#if defined(CONFIG_BT_AUDIO_UNICAST_SERVER)
#if defined(CONFIG_BT_BAP_UNICAST_SERVER)
SHELL_CMD_ARG(print_ase_info, NULL, "Print ASE info for default connection",
cmd_print_ase_info, 0, 0),
#endif /* CONFIG_BT_AUDIO_UNICAST_SERVER */
#endif /* CONFIG_BT_BAP_UNICAST_SERVER */
SHELL_CMD_ARG(preset, NULL, "dir [preset]", cmd_preset, 2, 1),
SHELL_CMD_ARG(metadata, NULL, "[context]", cmd_metadata, 1, 1),
SHELL_CMD_ARG(start, NULL, NULL, cmd_start, 1, 0),

View file

@ -2,7 +2,7 @@
* @file
* @brief Shell APIs for Bluetooth BASS client
*
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
* Copyright (c) 2020-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -75,7 +75,7 @@ static void bap_broadcast_assistant_recv_state_cb(
}
bt_addr_le_to_str(&state->addr, le_addr, sizeof(le_addr));
bin2hex(state->bad_code, BT_BAP_BROADCAST_CODE_SIZE,
bin2hex(state->bad_code, BT_AUDIO_BROADCAST_CODE_SIZE,
bad_code, sizeof(bad_code));
is_bad_code = state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE;
@ -533,7 +533,7 @@ static int cmd_bap_broadcast_assistant_mod_src(const struct shell *sh,
static int cmd_bap_broadcast_assistant_broadcast_code(const struct shell *sh,
size_t argc, char **argv)
{
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE] = { 0 };
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE] = { 0 };
size_t broadcast_code_len;
unsigned long src_id;
int result = 0;

View file

@ -18,7 +18,7 @@ CONFIG_BT_SMP=y
CONFIG_BT_EXT_ADV_LEGACY_SUPPORT=y
CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_BAP_UNICAST_SERVER=y
CONFIG_BT_AUDIO_UNICAST_CLIENT=y
CONFIG_BT_AUDIO_UNICAST_CLIENT_GROUP_STREAM_COUNT=2
CONFIG_BT_AUDIO_BROADCAST_SOURCE=y
@ -133,7 +133,7 @@ CONFIG_BT_CSIP_SET_MEMBER_LOG_LEVEL_DBG=y
CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL_DBG=y
CONFIG_BT_CSIP_SET_MEMBER_CRYPTO_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_UNICAST_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_UNICAST_SERVER_LOG_LEVEL_DBG=y
CONFIG_BT_BAP_UNICAST_SERVER_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_BROADCAST_SINK_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
CONFIG_BT_ASCS_LOG_LEVEL_DBG=y

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -100,7 +100,7 @@ static void bap_broadcast_assistant_recv_state_cb(
}
bt_addr_le_to_str(&state->addr, le_addr, sizeof(le_addr));
(void)bin2hex(state->bad_code, BT_BAP_BROADCAST_CODE_SIZE, bad_code,
(void)bin2hex(state->bad_code, BT_AUDIO_BROADCAST_CODE_SIZE, bad_code,
sizeof(bad_code));
printk("BASS recv state: src_id %u, addr %s, sid %u, sync_state %u, "
"encrypt_state %u%s%s\n", state->src_id, le_addr, state->adv_sid,
@ -418,7 +418,7 @@ static void test_bass_mod_source(void)
static void test_bass_broadcast_code(void)
{
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE];
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
int err;
for (int i = 0; i < ARRAY_SIZE(broadcast_code); i++) {

View file

@ -4,10 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_BT_AUDIO_UNICAST_SERVER)
#if defined(CONFIG_BT_BAP_UNICAST_SERVER)
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/pacs.h>
#include "common.h"
#include "bap_unicast_common.h"
@ -72,7 +73,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum b
printk("ASE Codec Config stream %p\n", *stream);
bt_audio_unicast_server_foreach_ep(conn, print_ase_info, NULL);
bt_bap_unicast_server_foreach_ep(conn, print_ase_info, NULL);
SET_FLAG(flag_stream_configured);
@ -197,7 +198,7 @@ static int lc3_release(struct bt_audio_stream *stream)
return 0;
}
static const struct bt_audio_unicast_server_cb unicast_server_cb = {
static const struct bt_bap_unicast_server_cb unicast_server_cb = {
.config = lc3_config,
.reconfig = lc3_reconfig,
.qos = lc3_qos,
@ -279,7 +280,7 @@ static void init(void)
printk("Bluetooth initialized\n");
bt_audio_unicast_server_register_cb(&unicast_server_cb);
bt_bap_unicast_server_register_cb(&unicast_server_cb);
err = bt_pacs_cap_register(BT_AUDIO_DIR_SINK, &cap);
if (err != 0) {
@ -385,11 +386,11 @@ struct bst_test_list *test_unicast_server_install(struct bst_test_list *tests)
return bst_add_tests(tests, test_unicast_server);
}
#else /* !(CONFIG_BT_AUDIO_UNICAST_SERVER) */
#else /* !(CONFIG_BT_BAP_UNICAST_SERVER) */
struct bst_test_list *test_unicast_server_install(struct bst_test_list *tests)
{
return tests;
}
#endif /* CONFIG_BT_AUDIO_UNICAST_SERVER */
#endif /* CONFIG_BT_BAP_UNICAST_SERVER */

View file

@ -250,7 +250,7 @@ static void init(void)
}
}
if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_SERVER)) {
if (IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER)) {
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, cap_acceptor_ad,
ARRAY_SIZE(cap_acceptor_ad), NULL, 0);
if (err != 0) {

View file

@ -47,7 +47,7 @@ CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y
CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y
CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_BAP_UNICAST_SERVER=y
CONFIG_BT_ASCS_ASE_SNK_COUNT=2
CONFIG_BT_ASCS_ASE_SRC_COUNT=2
# Support an ISO channel per ASE
@ -150,7 +150,7 @@ CONFIG_BT_OTS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_MCTL_LOG_LEVEL_DBG=y
CONFIG_BT_ASCS_LOG_LEVEL_DBG=y
CONFIG_BT_PACS_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_UNICAST_SERVER_LOG_LEVEL_DBG=y
CONFIG_BT_BAP_UNICAST_SERVER_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_UNICAST_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
CONFIG_BT_AUDIO_BROADCAST_SINK_LOG_LEVEL_DBG=y

View file

@ -199,7 +199,7 @@ tests:
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_AUDIO_UNICAST_SERVER=n
- CONFIG_BT_BAP_UNICAST_SERVER=n
- CONFIG_BT_HAS=n
bluetooth.audio_shell.no_server_ase_snk:
extra_args: CONF_FILE="audio.conf"

View file

@ -62,7 +62,7 @@ CONFIG_UART_CONSOLE=n
# LE Audio Section
CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_BAP_UNICAST_SERVER=y
# PACS
CONFIG_BT_PAC_SNK_LOC_WRITEABLE=y