Bluetooth: ascs: Add dynamic ASE registration
Added option to set the ASE count through the bap API, making ASE configuration runtime available. The upper limit of ASEs are still bound by the Kconfig options set for ASEs. Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This commit is contained in:
parent
442a0686fc
commit
c9da274eb2
39 changed files with 1017 additions and 175 deletions
|
@ -28,8 +28,8 @@ CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=4
|
|||
CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2
|
||||
CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2
|
||||
CONFIG_BT_ASCS=y
|
||||
CONFIG_BT_ASCS_ASE_SNK_COUNT=2
|
||||
CONFIG_BT_ASCS_ASE_SRC_COUNT=2
|
||||
CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2
|
||||
CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=2
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_BAP_BROADCAST_SINK=y
|
||||
CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=196
|
||||
|
|
|
@ -68,7 +68,7 @@ static const struct bt_audio_codec_cap lc3_codec_cap = {
|
|||
};
|
||||
|
||||
static struct audio_test_stream
|
||||
test_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
test_streams[CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT + CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT];
|
||||
|
||||
static const struct bt_audio_codec_qos_pref qos_pref =
|
||||
BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000);
|
||||
|
@ -225,6 +225,11 @@ static int lc3_release(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct bt_bap_unicast_server_register_param param = {
|
||||
CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT,
|
||||
CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT
|
||||
};
|
||||
|
||||
static const struct bt_bap_unicast_server_cb unicast_server_cb = {
|
||||
.config = lc3_config,
|
||||
.reconfig = lc3_reconfig,
|
||||
|
@ -487,6 +492,13 @@ static void init(void)
|
|||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
||||
err = bt_bap_unicast_server_register(¶m);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to register unicast server (err %d)\n", err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bt_bap_unicast_server_register_cb(&unicast_server_cb);
|
||||
|
||||
err = bt_pacs_cap_register(BT_AUDIO_DIR_SINK, &cap);
|
||||
|
|
|
@ -76,8 +76,8 @@ static uint32_t bis_index_bitfield;
|
|||
|
||||
#define UNICAST_CHANNEL_COUNT_1 BIT(0)
|
||||
|
||||
static struct bt_cap_stream unicast_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT +
|
||||
CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
static struct bt_cap_stream unicast_streams[CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT +
|
||||
CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT];
|
||||
|
||||
static bool subgroup_data_func_cb(struct bt_data *data, void *user_data)
|
||||
{
|
||||
|
@ -560,6 +560,11 @@ static int unicast_server_release(struct bt_bap_stream *stream, struct bt_bap_as
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct bt_bap_unicast_server_register_param param = {
|
||||
CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT,
|
||||
CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT
|
||||
};
|
||||
|
||||
static struct bt_bap_unicast_server_cb unicast_server_cbs = {
|
||||
.config = unicast_server_config,
|
||||
.reconfig = unicast_server_reconfig,
|
||||
|
@ -728,6 +733,13 @@ static void init(void)
|
|||
return;
|
||||
}
|
||||
|
||||
err = bt_bap_unicast_server_register(¶m);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to register unicast server (err %d)\n", err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
err = bt_bap_unicast_server_register_cb(&unicast_server_cbs);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to register unicast server callbacks (err %d)\n",
|
||||
|
|
|
@ -48,7 +48,7 @@ static const struct bt_audio_codec_qos_pref unicast_qos_pref =
|
|||
#define UNICAST_CHANNEL_COUNT_1 BIT(0)
|
||||
|
||||
static struct bt_cap_stream
|
||||
unicast_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
unicast_streams[CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT + CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT];
|
||||
|
||||
CREATE_FLAG(flag_unicast_stream_started);
|
||||
CREATE_FLAG(flag_gmap_discovered);
|
||||
|
@ -219,6 +219,11 @@ static int unicast_server_release(struct bt_bap_stream *stream, struct bt_bap_as
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct bt_bap_unicast_server_register_param param = {
|
||||
CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT,
|
||||
CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT
|
||||
};
|
||||
|
||||
static struct bt_bap_unicast_server_cb unicast_server_cbs = {
|
||||
.config = unicast_server_config,
|
||||
.reconfig = unicast_server_reconfig,
|
||||
|
@ -404,6 +409,13 @@ static void test_main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
err = bt_bap_unicast_server_register(¶m);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to register unicast server (err %d)\n", err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
err = bt_bap_unicast_server_register_cb(&unicast_server_cbs);
|
||||
if (err != 0) {
|
||||
FAIL("Failed to register unicast server callbacks (err %d)\n", err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue