host: refactor BLE Audio
This patch refactors BLE Audio library to conform to new directory tree
introduced in a9795706bea035d84d1577680e0814ceedc9dc58.
LE Audio related files present in host/include, host/src and
host/services were moved to corelated folders in host/audio.
Experimental system config BLE_AUDIO enabling LE Audio feature was introduced.
Naming convention for BLE Audio functions, structures and files was
unified - replaced `bcst` shorthand with `broadcast`. For example,
ble_audio_pub_bcst_announcement_feat was renamed to
ble_audio_pub_broadcast_announcement_feat.
Contents of host/include/ble_audio_common.h was incorporated into
host/audio/include/audio/ble_audio.h.
Apps and Auracast service were adjusted to new config and include paths.
BLE_MAX_BIG and BLE_MAX_BIS renamed to BLE_ISO_MAX_BIGS and
BLE_ISO_MAX_BISES, respectevaly.
diff --git a/.github/test_build_apps_syscfg.yml b/.github/test_build_apps_syscfg.yml
index faafa8a..aabcc29 100644
--- a/.github/test_build_apps_syscfg.yml
+++ b/.github/test_build_apps_syscfg.yml
@@ -27,6 +27,7 @@
BLE_PERIODIC_ADV_SYNC_BIGINFO_REPORTS: 1
BLE_ISO: 1
BLE_ISO_TEST: 1
+ BLE_AUDIO: 1
BLE_ISO_BROADCAST_SOURCE: 1
BLE_HCI_VS: 1
BLE_POWER_CONTROL: 1
diff --git a/apps/auracast/pkg.yml b/apps/auracast/pkg.yml
index 54eb3be..fa33aa3 100644
--- a/apps/auracast/pkg.yml
+++ b/apps/auracast/pkg.yml
@@ -30,10 +30,10 @@
- nimble/host/util
- nimble/host/services/gap
- nimble/host/store/config
+ - nimble/host/audio/services/auracast
- "@apache-mynewt-core/kernel/os"
- "@apache-mynewt-core/sys/console"
- "@apache-mynewt-core/sys/log"
- "@apache-mynewt-core/sys/stats"
- "@apache-mynewt-core/sys/sysinit"
- "@apache-mynewt-core/sys/id"
- - "@apache-mynewt-nimble/nimble/host/services/auracast"
diff --git a/apps/auracast/src/main.c b/apps/auracast/src/main.c
index 3e7349e..977d643 100644
--- a/apps/auracast/src/main.c
+++ b/apps/auracast/src/main.c
@@ -51,7 +51,7 @@
static struct os_mempool bis_pool;
static os_membuf_t codec_spec_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS) * 2, 19)
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19)
];
static struct os_mempool codec_spec_pool;
@@ -156,7 +156,7 @@
assert(rc == 0);
rc = os_mempool_init(&codec_spec_pool,
- MYNEWT_VAL(BLE_MAX_BIS) * 2, 19,
+ MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19,
codec_spec_mem, "codec_spec_pool");
assert(rc == 0);
}
diff --git a/apps/auracast/syscfg.yml b/apps/auracast/syscfg.yml
index e67af5a..f22b92d 100644
--- a/apps/auracast/syscfg.yml
+++ b/apps/auracast/syscfg.yml
@@ -56,7 +56,7 @@
BLE_VERSION: 54
BLE_ISO: 1
BLE_ISO_BROADCAST_SOURCE: 1
- BLE_MAX_BIG: 1
- BLE_MAX_BIS: 2
+ BLE_ISO_MAX_BIGS: 1
+ BLE_ISO_MAX_BISES: 2
- BLE_PHY_NRF52_HEADERMASK_WORKAROUND: 1
\ No newline at end of file
+ BLE_AUDIO: 1
diff --git a/apps/btshell/src/btshell.h b/apps/btshell/src/btshell.h
index c457fd7..c2a2eb3 100644
--- a/apps/btshell/src/btshell.h
+++ b/apps/btshell/src/btshell.h
@@ -29,7 +29,7 @@
#include "host/ble_gatt.h"
#include "host/ble_gap.h"
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
-#include "host/ble_audio_broadcast_source.h"
+#include "audio/ble_audio_broadcast_source.h"
#endif
#ifdef __cplusplus
diff --git a/apps/btshell/src/cmd_iso.c b/apps/btshell/src/cmd_iso.c
index 8d0ef34..284f021 100644
--- a/apps/btshell/src/cmd_iso.c
+++ b/apps/btshell/src/cmd_iso.c
@@ -34,7 +34,7 @@
uint64_t valid_cnt;
uint64_t error_cnt;
uint64_t lost_cnt;
-} rx_stats_pool[MYNEWT_VAL(BLE_MAX_BIS)];
+} rx_stats_pool[MYNEWT_VAL(BLE_ISO_MAX_BISES)];
static void
iso_rx_stats_update(uint16_t conn_handle, const struct ble_iso_rx_data_info *info,
@@ -305,9 +305,9 @@
int
cmd_iso_big_sync_create(int argc, char **argv)
{
- struct ble_iso_bis_params bis_params[MYNEWT_VAL(BLE_MAX_BIS)];
+ struct ble_iso_bis_params bis_params[MYNEWT_VAL(BLE_ISO_MAX_BISES)];
struct ble_iso_big_sync_create_params params = { 0 };
- uint8_t bis_idxs[MYNEWT_VAL(BLE_MAX_BIS)];
+ uint8_t bis_idxs[MYNEWT_VAL(BLE_ISO_MAX_BISES)];
uint8_t big_handle;
int rc;
diff --git a/apps/btshell/src/cmd_leaudio.c b/apps/btshell/src/cmd_leaudio.c
index fc4fcd1..2f31246 100644
--- a/apps/btshell/src/cmd_leaudio.c
+++ b/apps/btshell/src/cmd_leaudio.c
@@ -17,13 +17,13 @@
* under the License.
*/
-#include "host/ble_audio_broadcast_source.h"
#include "cmd_leaudio.h"
#include "btshell.h"
#include "console/console.h"
#include "errno.h"
-#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
+#if (MYNEWT_VAL(BLE_AUDIO))
+#include "audio/ble_audio_broadcast_source.h"
int
cmd_leaudio_base_add(int argc, char **argv)
{
diff --git a/apps/btshell/src/main.c b/apps/btshell/src/main.c
index 6424bf6..0ba90ff 100644
--- a/apps/btshell/src/main.c
+++ b/apps/btshell/src/main.c
@@ -41,8 +41,10 @@
#include "host/ble_gatt.h"
#include "host/ble_store.h"
#include "host/ble_sm.h"
-#include "host/ble_audio_common.h"
-#include "host/ble_audio_broadcast_source.h"
+#if MYNEWT_VAL(BLE_AUDIO)
+#include "audio/ble_audio_broadcast_source.h"
+#include "audio/ble_audio.h"
+#endif
#include "host/util/util.h"
/* Mandatory services. */
@@ -132,35 +134,35 @@
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
static struct {struct ble_audio_base *base; uint8_t adv_instance;}
-btshell_base_list[MYNEWT_VAL(BLE_MAX_BIG)];
+btshell_base_list[MYNEWT_VAL(BLE_ISO_MAX_BIGS)];
static os_membuf_t btshell_base_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_audio_base))
];
static struct os_mempool btshell_base_pool;
static os_membuf_t btshell_big_params_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_iso_big_params))
];
static struct os_mempool btshell_big_params_pool;
/** Mempool size: in worst case every BIS is in separate subgroup */
static os_membuf_t btshell_big_sub_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES),
sizeof(struct ble_audio_big_subgroup))
];
static struct os_mempool btshell_big_sub_pool;
static os_membuf_t btshell_bis_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES),
sizeof(struct ble_audio_bis))
];
static struct os_mempool btshell_bis_pool;
static os_membuf_t btshell_metadata_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES),
MYNEWT_VAL(BLE_EXT_ADV_MAX_SIZE) - 27)
];
static struct os_mempool btshell_metadata_pool;
@@ -171,12 +173,12 @@
* has one. This is inefficient but possible and should not cause error if
* used that way */
static os_membuf_t btshell_codec_spec_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS) * 2, 9)
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 9)
];
static struct os_mempool btshell_codec_spec_pool;
static os_membuf_t btshell_big_params_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG), sizeof(struct ble_iso_big_params))
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BIGS), sizeof(struct ble_iso_big_params))
];
static struct os_mempool btshell_big_params_pool;
#endif
@@ -2767,7 +2769,7 @@
btshell_base_find_free(void)
{
int i;
- for (i = 0; i < MYNEWT_VAL(BLE_MAX_BIG); i++) {
+ for (i = 0; i < MYNEWT_VAL(BLE_ISO_MAX_BIGS); i++) {
if (btshell_base_list[i].base == NULL) {
return i;
}
@@ -2780,7 +2782,7 @@
btshell_base_find(uint8_t adv_instance)
{
int i;
- for (i = 0; i < MYNEWT_VAL(BLE_MAX_BIG); i++) {
+ for (i = 0; i < MYNEWT_VAL(BLE_ISO_MAX_BIGS); i++) {
if (btshell_base_list[i].adv_instance == adv_instance) {
return btshell_base_list[i].base;
}
@@ -3082,38 +3084,38 @@
assert(rc == 0);
#endif
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
- rc = os_mempool_init(&btshell_base_pool, MYNEWT_VAL(BLE_MAX_BIG),
+ rc = os_mempool_init(&btshell_base_pool, MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_audio_base),
btshell_base_mem,
"btshell_base_pool");
assert(rc == 0);
- rc = os_mempool_init(&btshell_big_params_pool, MYNEWT_VAL(BLE_MAX_BIG),
+ rc = os_mempool_init(&btshell_big_params_pool, MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_iso_big_params),
btshell_big_params_mem,
"btshell_big_params_pool");
assert(rc == 0);
- rc = os_mempool_init(&btshell_big_sub_pool, MYNEWT_VAL(BLE_MAX_BIS),
+ rc = os_mempool_init(&btshell_big_sub_pool, MYNEWT_VAL(BLE_ISO_MAX_BISES),
sizeof(struct ble_audio_big_subgroup),
btshell_big_sub_mem,
"btshell_big_sub_pool");
assert(rc == 0);
- rc = os_mempool_init(&btshell_bis_pool, MYNEWT_VAL(BLE_MAX_BIS),
+ rc = os_mempool_init(&btshell_bis_pool, MYNEWT_VAL(BLE_ISO_MAX_BISES),
sizeof(struct ble_audio_bis), btshell_bis_mem,
"btshell_bis_pool");
assert(rc == 0);
- rc = os_mempool_init(&btshell_metadata_pool, MYNEWT_VAL(BLE_MAX_BIS),
+ rc = os_mempool_init(&btshell_metadata_pool, MYNEWT_VAL(BLE_ISO_MAX_BISES),
MYNEWT_VAL(BLE_EXT_ADV_MAX_SIZE) - 27,
btshell_metadata_mem, "btshell_metadata_pool");
assert(rc == 0);
rc = os_mempool_init(&btshell_codec_spec_pool,
- MYNEWT_VAL(BLE_MAX_BIS) * 2, 19,
+ MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19,
btshell_codec_spec_mem, "btshell_codec_spec_pool");
assert(rc == 0);
rc = os_mempool_init(&btshell_big_params_pool,
- MYNEWT_VAL(BLE_MAX_BIG),
+ MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_iso_big_params),
btshell_big_params_mem, "btshell_big_params_pool");
assert(rc == 0);
diff --git a/apps/leaudio_broadcaster/pkg.yml b/apps/leaudio_broadcaster/pkg.yml
index 0955da9..9543928 100644
--- a/apps/leaudio_broadcaster/pkg.yml
+++ b/apps/leaudio_broadcaster/pkg.yml
@@ -30,6 +30,7 @@
- nimble/host/util
- nimble/host/services/gap
- nimble/host/store/config
+ - nimble/host/audio
- "@apache-mynewt-core/kernel/os"
- "@apache-mynewt-core/sys/console"
- "@apache-mynewt-core/sys/log"
diff --git a/apps/leaudio_broadcaster/src/main.c b/apps/leaudio_broadcaster/src/main.c
index a4e7bf9..5203325 100644
--- a/apps/leaudio_broadcaster/src/main.c
+++ b/apps/leaudio_broadcaster/src/main.c
@@ -24,8 +24,8 @@
#include "host/ble_hs.h"
#include "host/util/util.h"
-#include "host/ble_audio_broadcast_source.h"
-#include "host/ble_audio_common.h"
+#include "audio/ble_audio_broadcast_source.h"
+#include "audio/ble_audio.h"
#include "host/ble_iso.h"
#include "hal/hal_gpio.h"
@@ -53,7 +53,7 @@
static struct os_mempool bis_pool;
static os_membuf_t codec_spec_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS) * 2, 19)
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19)
];
static struct os_mempool codec_spec_pool;
@@ -182,7 +182,7 @@
assert(rc == 0);
rc = os_mempool_init(&codec_spec_pool,
- MYNEWT_VAL(BLE_MAX_BIS) * 2, 19,
+ MYNEWT_VAL(BLE_ISO_MAX_BISES) * 2, 19,
codec_spec_mem, "codec_spec_pool");
assert(rc == 0);
}
diff --git a/apps/leaudio_broadcaster/syscfg.yml b/apps/leaudio_broadcaster/syscfg.yml
index bed16f0..cffb828 100644
--- a/apps/leaudio_broadcaster/syscfg.yml
+++ b/apps/leaudio_broadcaster/syscfg.yml
@@ -52,10 +52,11 @@
MSYS_1_BLOCK_COUNT: 32
BLE_VERSION: 54
+ BLE_AUDIO: 1
BLE_ISO: 1
BLE_ISO_BROADCAST_SOURCE: 1
- BLE_MAX_BIG: 1
- BLE_MAX_BIS: 2
+ BLE_ISO_MAX_BIGS: 1
+ BLE_ISO_MAX_BISES: 2
syscfg.vals.BSP_NRF5340:
MCU_MPU_ENABLE: 1
diff --git a/nimble/host/audio/include/audio/ble_audio.h b/nimble/host/audio/include/audio/ble_audio.h
new file mode 100644
index 0000000..c1ce1dc
--- /dev/null
+++ b/nimble/host/audio/include/audio/ble_audio.h
@@ -0,0 +1,591 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_AUDIO_
+#define H_BLE_AUDIO_
+
+#include <stdint.h>
+#include <sys/queue.h>
+
+/**
+ * @cond
+ * Helper macros for BLE_AUDIO_BUILD_CODEC_CONFIG
+ * @private @{
+ */
+#define FIELD_LEN_2(_len, _type, _field) _len, _type, _field,
+#define FIELD_LEN_5(_len, _type, _field) _len, _type, _field, \
+ _field >> 8, _field >> 16, \
+ _field >> 24,
+
+#define FIELD_TESTED_0(_len, _type, _field)
+#define FIELD_TESTED_1(_len, _type, _field) FIELD_LEN_ ## _len(_len, \
+ _type, \
+ _field)
+#define EMPTY() FIELD_TESTED_0
+#define PRESENT(X) FIELD_TESTED_1
+#define TEST(x, A, FUNC, ...) FUNC
+#define TEST_FIELD(...) TEST(, ## __VA_ARGS__, \
+ PRESENT(__VA_ARGS__), \
+ EMPTY(__VA_ARGS__))
+#define FIELD_TESTED(_test, _len, _type, _field) _test(_len, _type, _field)
+#define OPTIONAL_FIELD(_len, _type, ...) FIELD_TESTED(TEST_FIELD \
+ (__VA_ARGS__), \
+ _len, \
+ _type, \
+ __VA_ARGS__)
+
+/**
+ * @}
+ * @endcond
+ */
+
+/** Broadcast Audio Announcement Service UUID. */
+#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
+
+/** Public Broadcast Announcement Service UUID. */
+#define BLE_BROADCAST_PUB_ANNOUNCEMENT_SVC_UUID 0x1856
+
+/**
+ * @defgroup ble_audio_sampling_rates Bluetooth Low Energy Audio Sampling Rates
+ * @{
+ */
+
+/** LE Audio Sampling Rate: 8000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_8000_HZ 0x01
+
+/** LE Audio Sampling Rate: 11025 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_11025_HZ 0x02
+
+/** LE Audio Sampling Rate: 16000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_16000_HZ 0x03
+
+/** LE Audio Sampling Rate: 22050 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_22050_HZ 0x04
+
+/** LE Audio Sampling Rate: 24000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_24000_HZ 0x05
+
+/** LE Audio Sampling Rate: 32000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_32000_HZ 0x06
+
+/** LE Audio Sampling Rate: 44100 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_44100_HZ 0x07
+
+/** LE Audio Sampling Rate: 48000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_48000_HZ 0x08
+
+/** LE Audio Sampling Rate: 88200 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_88200_HZ 0x09
+
+/** LE Audio Sampling Rate: 96000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_96000_HZ 0x0A
+
+/** LE Audio Sampling Rate: 176400 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_176400_HZ 0x0B
+
+/** LE Audio Sampling Rate: 192000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_192000_HZ 0x0C
+
+/** LE Audio Sampling Rate: 384000 Hz. */
+#define BLE_AUDIO_SAMPLING_RATE_384000_HZ 0x0D
+
+/** @} */
+
+/**
+ * @defgroup ble_audio_frame_durations Bluetooth Low Energy Audio Frame Durations
+ * @{
+ */
+
+/** LE Audio Frame Duration: 7.5 ms. */
+#define BLE_AUDIO_SELECTED_FRAME_DURATION_7_5_MS 0x00
+
+/** LE Audio Frame Duration: 10 ms. */
+#define BLE_AUDIO_SELECTED_FRAME_DURATION_10_MS 0x01
+
+/** @} */
+
+/**
+ * @defgroup ble_audio_locations Bluetooth Low Energy Audio Locations
+ * @{
+ */
+
+/** LE Audio Location: Front Left. */
+#define BLE_AUDIO_LOCATION_FRONT_LEFT (1ULL)
+
+/** LE Audio Location: Front Right. */
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT (1ULL << 1)
+
+/** LE Audio Location: Front Center. */
+#define BLE_AUDIO_LOCATION_FRONT_CENTER (1ULL << 2)
+
+/** LE Audio Location: Low Frequency Effects 1. */
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 (1ULL << 3)
+
+/** LE Audio Location: Back Left. */
+#define BLE_AUDIO_LOCATION_BACK_LEFT (1ULL << 4)
+
+/** LE Audio Location: Front Left Center. */
+#define BLE_AUDIO_LOCATION_FRONT_LEFT_CENTER (1ULL << 5)
+
+/** LE Audio Location: Front Right Center. */
+#define BLE_AUDIO_LOCATION_FRONT_RIGHT_CENTER (1ULL << 6)
+
+/** LE Audio Location: Back Center. */
+#define BLE_AUDIO_LOCATION_BACK_CENTER (1ULL << 7)
+
+/** LE Audio Location: Low Frequency Effects 2. */
+#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 (1ULL << 8)
+
+/** LE Audio Location: Side Left. */
+#define BLE_AUDIO_LOCATION_SIDE_LEFT (1ULL << 9)
+
+/** LE Audio Location: Side Right. */
+#define BLE_AUDIO_LOCATION_SIDE_RIGHT (1ULL << 10)
+
+/** LE Audio Location: Top Front Left. */
+#define BLE_AUDIO_LOCATION_TOP_FRONT_LEFT (1ULL << 11)
+
+/** LE Audio Location: Top Front Right. */
+#define BLE_AUDIO_LOCATION_TOP_FRONT_RIGHT (1ULL << 12)
+
+/** LE Audio Location: Top Front Center. */
+#define BLE_AUDIO_LOCATION_TOP_FRONT_CENTER (1ULL << 13)
+
+/** LE Audio Location: Top Center. */
+#define BLE_AUDIO_LOCATION_TOP_CENTER (1ULL << 14)
+
+/** LE Audio Location: Top Back Left. */
+#define BLE_AUDIO_LOCATION_TOP_BACK_LEFT (1ULL << 15)
+
+/** LE Audio Location: Top Back Right. */
+#define BLE_AUDIO_LOCATION_TOP_BACK_RIGHT (1ULL << 16)
+
+/** LE Audio Location: Top Side Left. */
+#define BLE_AUDIO_LOCATION_TOP_SIDE_LEFT (1ULL << 17)
+
+/** LE Audio Location: Top Side Right. */
+#define BLE_AUDIO_LOCATION_TOP_SIDE_RIGHT (1ULL << 18)
+
+/** LE Audio Location: Top Back Center. */
+#define BLE_AUDIO_LOCATION_TOP_BACK_CENTER (1ULL << 19)
+
+/** LE Audio Location: Bottom Front Center. */
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_CENTER (1ULL << 20)
+
+/** LE Audio Location: Bottom Front Left. */
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_LEFT (1ULL << 21)
+
+/** LE Audio Location: Bottom Front Right. */
+#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT (1ULL << 22)
+
+/** LE Audio Location: Left Surround. */
+#define BLE_AUDIO_LOCATION_LEFT_SURROUND (1ULL << 23)
+
+/** LE Audio Location: Right Surround. */
+#define BLE_AUDIO_LOCATION_RIGHT_SURROUND (1ULL << 24)
+
+/** @} */
+
+/**
+ * @defgroup ble_audio_codec_config Bluetooth Low Energy Audio Codec Specific Config
+ * @{
+ */
+
+/** LE Audio Codec Config Type: Sampling Frequency. */
+#define BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE 0x01
+
+/** LE Audio Codec Config Type: Frame Duration. */
+#define BLE_AUDIO_CODEC_FRAME_DURATION_TYPE 0x02
+
+/** LE Audio Codec Config Type: Channel Allocation. */
+#define BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE 0x03
+
+/** LE Audio Codec Config Type: Octets Per Codec Frame. */
+#define BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE 0x04
+
+/** LE Audio Codec Config Type: Frame Blocks Per SDU. */
+#define BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE 0x05
+
+/** @} */
+
+/**
+ * @brief Helper macro used to build LTV array of Codec_Specific_Configuration.
+ *
+ * @param _sampling_freq Sampling_Frequency - single octet value
+ * @param _frame_duration Frame_Duration - single octet value
+ * @param _audio_channel_alloc Audio_Channel_Allocation -
+ * four octet value
+ * @param _octets_per_codec_frame Octets_Per_Codec_Frame -
+ * two octet value
+ * @param _codec_frame_blocks_per_sdu Codec_Frame_Blocks_Per_SDU -
+ * single octet value
+ *
+ * @return Pointer to a `ble_uuid16_t` structure.
+ */
+#define BLE_AUDIO_BUILD_CODEC_CONFIG(_sampling_freq, \
+ _frame_duration, \
+ _audio_channel_alloc, \
+ _octets_per_codec_frame, \
+ _codec_frame_blocks_per_sdu) \
+ { \
+ 2, BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE, _sampling_freq, \
+ 2, BLE_AUDIO_CODEC_FRAME_DURATION_TYPE, _frame_duration, \
+ OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE, \
+ _audio_channel_alloc) \
+ 3, BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE, \
+ (_octets_per_codec_frame), ((_octets_per_codec_frame) >> 8), \
+ OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE, \
+ _codec_frame_blocks_per_sdu) \
+ }
+
+/** Codec Information */
+struct ble_audio_codec_id {
+ /** Coding Format */
+ uint8_t format;
+
+ /** Company ID */
+ uint16_t company_id;
+
+ /** Vendor Specific Codec ID */
+ uint16_t vendor_specific;
+};
+
+/** @brief Public Broadcast Announcement features bits */
+enum ble_audio_pub_broadcast_announcement_feat {
+ /** Broadcast Stream Encryption */
+ BLE_AUDIO_PUB_BROADCAST_ANNOUNCEMENT_FEAT_ENCRYPTION = 1 << 0,
+
+ /** Standard Quality Public Broadcast Audio */
+ BLE_AUDIO_PUB_BROADCAST_ANNOUNCEMENT_FEAT_SQ = 1 << 1,
+
+ /** High Quality Public Broadcast Audio */
+ BLE_AUDIO_PUB_BROADCAST_ANNOUNCEMENT_FEAT_HQ = 1 << 2,
+};
+
+/** @brief Public Broadcast Announcement structure */
+struct ble_audio_pub_broadcast_announcement {
+ /** Public Broadcast Announcement features bitfield */
+ enum ble_audio_pub_broadcast_announcement_feat features;
+
+ /** Metadata length */
+ uint8_t metadata_len;
+
+ /** Metadata */
+ const uint8_t *metadata;
+};
+
+struct ble_audio_broadcast_name {
+ /** Broadcast Name length */
+ uint8_t name_len;
+
+ /** Broadcast Name */
+ const char *name;
+};
+
+/**
+ * @defgroup ble_audio_events Bluetooth Low Energy Audio Events
+ * @{
+ */
+
+/** BLE Audio event: Broadcast Announcement */
+#define BLE_AUDIO_EVENT_BROADCAST_ANNOUNCEMENT 0
+
+/** @} */
+
+/** @brief Broadcast Announcement */
+struct ble_audio_event_broadcast_announcement {
+ /** Extended advertising report */
+ const struct ble_gap_ext_disc_desc *ext_disc;
+
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Additional service data included in Broadcast Audio Announcement */
+ const uint8_t *svc_data;
+
+ /** Additional service data length */
+ uint16_t svc_data_len;
+
+ /** Optional Public Broadcast Announcement data */
+ struct ble_audio_pub_broadcast_announcement *pub_announcement_data;
+
+ /** Optional Broadcast Name */
+ struct ble_audio_broadcast_name *name;
+};
+
+/**
+ * Represents a BLE Audio related event. When such an event occurs, the host
+ * notifies the application by passing an instance of this structure to an
+ * application-specified callback.
+ */
+struct ble_audio_event {
+ /**
+ * Indicates the type of BLE Audio event that occurred. This is one of the
+ * BLE_AUDIO_EVENT codes.
+ */
+ uint8_t type;
+
+ /**
+ * A discriminated union containing additional details concerning the event.
+ * The 'type' field indicates which member of the union is valid.
+ */
+ union {
+ /**
+ * @ref BLE_AUDIO_EVENT_BROADCAST_ANNOUNCEMENT
+ *
+ * Represents a received Broadcast Announcement.
+ */
+ struct ble_audio_event_broadcast_announcement broadcast_announcement;
+ };
+};
+
+/** Callback function type for handling BLE Audio events. */
+typedef int ble_audio_event_fn(struct ble_audio_event *event, void *arg);
+
+/**
+ * Event listener structure
+ *
+ * This should be used as an opaque structure and not modified manually.
+ */
+struct ble_audio_event_listener {
+ /** The function to call when a BLE Audio event occurs. */
+ ble_audio_event_fn *fn;
+
+ /** An optional argument to pass to the event handler function. */
+ void *arg;
+
+ /** Singly-linked list entry. */
+ SLIST_ENTRY(ble_audio_event_listener) next;
+};
+
+/**
+ * Registers listener for BLE Audio events
+ *
+ * On success listener structure will be initialized automatically and does not
+ * need to be initialized prior to calling this function. To change callback
+ * and/or argument unregister listener first and register it again.
+ *
+ * @param[in] listener Listener structure
+ * @param[in] event_mask Optional event mask
+ * @param[in] fn Callback function
+ * @param[in] arg Optional callback argument
+ *
+ * @return 0 on success
+ * BLE_HS_EINVAL if no callback is specified
+ * BLE_HS_EALREADY if listener is already registered
+ */
+int ble_audio_event_listener_register(struct ble_audio_event_listener *listener,
+ ble_audio_event_fn *fn, void *arg);
+
+/**
+ * Unregisters listener for BLE Audio events
+ *
+ * @param[in] listener Listener structure
+ *
+ * @return 0 on success
+ * BLE_HS_ENOENT if listener was not registered
+ */
+int ble_audio_event_listener_unregister(struct ble_audio_event_listener *listener);
+
+/**
+ * BASE iterator
+ *
+ * The iterator structure used by @ref ble_audio_base_subgroup_iter and
+ * @ble_audio_base_bis_iter functions to iterate the BASE Level 2 and 3 elements
+ * (Subgroups and BISes).
+ * This should be used as an opaque structure and not modified manually.
+ *
+ * Example:
+ * @code{.c}
+ * struct ble_audio_base_iter subgroup_iter;
+ * struct ble_audio_base_iter bis_iter;
+ * struct ble_audio_base_group group;
+ * struct ble_audio_base_subgroup subgroup;
+ * struct ble_audio_base_bis bis;
+ *
+ * rc = ble_audio_base_parse(data, data_size, &group, &subgroup_iter);
+ * if (rc == 0) {
+ * for (uint8_t i = 0; i < group->num_subgroups; i++) {
+ * rc = ble_audio_base_subgroup_iter(&subgroup_iter, &subgroup, &bis_iter);
+ * if (rc == 0) {
+ * for (uint8_t j = 0; j < subgroup->num_bis; j++) {
+ * rc = ble_audio_base_bis_iter(&bis_iter, &bis);
+ * if (rc == 0) {
+ * foo(&group, &subgroup, &bis);
+ * }
+ * }
+ * }
+ * }
+ * }
+ * @endcode
+ */
+struct ble_audio_base_iter {
+ /** Data pointer */
+ const uint8_t *data;
+
+ /** Base length */
+ uint8_t buf_len;
+
+ /** Original BASE pointer */
+ const uint8_t *buf;
+
+ /** Remaining number of elements */
+ uint8_t num_elements;
+};
+
+/** @brief Broadcast Audio Source Endpoint Group structure */
+struct ble_audio_base_group {
+ /** Presentation Delay */
+ uint32_t presentation_delay;
+
+ /** Number of subgroups */
+ uint8_t num_subgroups;
+};
+
+/**
+ * Parse the BASE received from Basic Audio Announcement data.
+ *
+ * @param[in] data Pointer to the BASE data buffer to parse.
+ * @param[in] data_len Length of the BASE data buffer.
+ * @param[out] group Group object.
+ * @param[out] subgroup_iter Subgroup iterator object.
+ *
+ * @return 0 on success; nonzero on failure.
+ */
+int ble_audio_base_parse(const uint8_t *data, uint8_t data_len,
+ struct ble_audio_base_group *group,
+ struct ble_audio_base_iter *subgroup_iter);
+
+/** @brief Broadcast Audio Source Endpoint Subgroup structure */
+struct ble_audio_base_subgroup {
+ /** Codec information for the subgroup */
+ struct ble_audio_codec_id codec_id;
+
+ /** Length of the Codec Specific Configuration for the subgroup */
+ uint8_t codec_spec_config_len;
+
+ /** Codec Specific Configuration for the subgroup */
+ const uint8_t *codec_spec_config;
+
+ /** Length of the Metadata for the subgroup */
+ uint8_t metadata_len;
+
+ /** Series of LTV structures containing Metadata */
+ const uint8_t *metadata;
+
+ /** Number of BISes in the subgroup */
+ uint8_t num_bis;
+};
+
+/**
+ * @brief Basic Audio Announcement Subgroup information
+ *
+ * @param[in] subgroup_iter Subgroup iterator object.
+ * @param[out] subgroup Subgroup object.
+ * @param[out] bis_iter BIS iterator object.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_base_subgroup_iter(struct ble_audio_base_iter *subgroup_iter,
+ struct ble_audio_base_subgroup *subgroup,
+ struct ble_audio_base_iter *bis_iter);
+
+/** @brief Broadcast Audio Source Endpoint BIS structure */
+struct ble_audio_base_bis {
+ /** BIS_index value for the BIS */
+ uint8_t index;
+
+ /** Length of the Codec Specific Configuration for the BIS */
+ uint8_t codec_spec_config_len;
+
+ /** Codec Specific Configuration for the BIS */
+ const uint8_t *codec_spec_config;
+};
+
+/**
+ * @brief Basic Audio Announcement Subgroup information
+ *
+ * @param[in] bis_iter BIS iterator object.
+ * @param[out] bis BIS object.
+ *
+ * @return 0 on success;
+ * A non-zero value on failure.
+ */
+int ble_audio_base_bis_iter(struct ble_audio_base_iter *bis_iter,
+ struct ble_audio_base_bis *bis);
+
+/** Broadcast Isochronous Streams (BIS) */
+struct ble_audio_bis {
+ /** Pointer to next BIS in subgroup */
+ STAILQ_ENTRY(ble_audio_bis) next;
+
+ /** BIS index */
+ uint8_t idx;
+
+ /** BIS level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** BIS level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+};
+
+/** Broadcast Isochronous Group (BIG) Subgroup */
+struct ble_audio_big_subgroup {
+ /** Pointer to next subgroup in BIG */
+ STAILQ_ENTRY(ble_audio_big_subgroup) next;
+
+ /** Number of BISes in subgroup */
+ uint8_t bis_cnt;
+
+ /** Codec ID */
+ struct ble_audio_codec_id codec_id;
+
+ /** Subgroup level Codec Specific Configuration */
+ uint8_t *codec_spec_config;
+
+ /** Subgroup level Codec Specific Configuration length */
+ uint8_t codec_spec_config_len;
+
+ /** Subgroup Metadata */
+ uint8_t *metadata;
+
+ /** Subgroup Metadata length*/
+ uint8_t metadata_len;
+
+ /** Link list of BISes */
+ STAILQ_HEAD(, ble_audio_bis) bises;
+};
+
+/** Broadcast Audio Source Endpoint */
+struct ble_audio_base {
+ /** Broadcast ID */
+ uint32_t broadcast_id;
+
+ /** Presentation Delay */
+ uint32_t presentation_delay;
+
+ /** Number of subgroups in BIG */
+ uint8_t num_subgroups;
+
+ /** Link list of subgroups */
+ STAILQ_HEAD(, ble_audio_big_subgroup) subs;
+};
+
+#endif /* H_BLE_AUDIO_ */
diff --git a/nimble/host/include/host/ble_audio_broadcast_source.h b/nimble/host/audio/include/audio/ble_audio_broadcast_source.h
similarity index 99%
rename from nimble/host/include/host/ble_audio_broadcast_source.h
rename to nimble/host/audio/include/audio/ble_audio_broadcast_source.h
index 605aa5b..839449c 100644
--- a/nimble/host/include/host/ble_audio_broadcast_source.h
+++ b/nimble/host/audio/include/audio/ble_audio_broadcast_source.h
@@ -33,7 +33,7 @@
#include <stdint.h>
#include "host/ble_gap.h"
#include "host/ble_iso.h"
-#include "host/ble_audio_common.h"
+#include "ble_audio.h"
/** Parameters used for creating BASE configuration. */
struct ble_broadcast_create_params {
diff --git a/nimble/host/audio/include/host/audio/ble_audio.h b/nimble/host/audio/include/host/audio/ble_audio.h
deleted file mode 100644
index 7d4200b..0000000
--- a/nimble/host/audio/include/host/audio/ble_audio.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_AUDIO_
-#define H_BLE_AUDIO_
-
-#include <stdint.h>
-#include <sys/queue.h>
-
-#include "host/ble_audio_common.h"
-
-/** @brief Public Broadcast Announcement features bits */
-enum ble_audio_pub_bcst_announcement_feat {
- /** Broadcast Stream Encryption */
- BLE_AUDIO_PUB_BCST_ANNOUNCEMENT_FEAT_ENCRYPTION = 1 << 0,
-
- /** Standard Quality Public Broadcast Audio */
- BLE_AUDIO_PUB_BCST_ANNOUNCEMENT_FEAT_SQ = 1 << 1,
-
- /** High Quality Public Broadcast Audio */
- BLE_AUDIO_PUB_BCST_ANNOUNCEMENT_FEAT_HQ = 1 << 2,
-};
-
-/** @brief Public Broadcast Announcement structure */
-struct ble_audio_pub_bcst_announcement {
- /** Public Broadcast Announcement features bitfield */
- enum ble_audio_pub_bcst_announcement_feat features;
-
- /** Metadata length */
- uint8_t metadata_len;
-
- /** Metadata */
- const uint8_t *metadata;
-};
-
-struct ble_audio_bcst_name {
- /** Broadcast Name length */
- uint8_t name_len;
-
- /** Broadcast Name */
- const char *name;
-};
-
-/**
- * @defgroup ble_audio_events Bluetooth Low Energy Audio Events
- * @{
- */
-
-/** BLE Audio event: Broadcast Announcement */
-#define BLE_AUDIO_EVENT_BCST_ANNOUNCEMENT 0
-
-/** @} */
-
-/** @brief Broadcast Announcement */
-struct ble_audio_event_bcst_announcement {
- /** Extended advertising report */
- const struct ble_gap_ext_disc_desc *ext_disc;
-
- /** Broadcast ID */
- uint32_t broadcast_id;
-
- /** Additional service data included in Broadcast Audio Announcement */
- const uint8_t *svc_data;
-
- /** Additional service data length */
- uint16_t svc_data_len;
-
- /** Optional Public Broadcast Announcement data */
- struct ble_audio_pub_bcst_announcement *pub_announcement_data;
-
- /** Optional Broadcast Name */
- struct ble_audio_bcst_name *name;
-};
-
-/**
- * Represents a BLE Audio related event. When such an event occurs, the host
- * notifies the application by passing an instance of this structure to an
- * application-specified callback.
- */
-struct ble_audio_event {
- /**
- * Indicates the type of BLE Audio event that occurred. This is one of the
- * BLE_AUDIO_EVENT codes.
- */
- uint8_t type;
-
- /**
- * A discriminated union containing additional details concerning the event.
- * The 'type' field indicates which member of the union is valid.
- */
- union {
- /**
- * @ref BLE_AUDIO_EVENT_BCST_ANNOUNCEMENT
- *
- * Represents a received Broadcast Announcement.
- */
- struct ble_audio_event_bcst_announcement bcst_announcement;
- };
-};
-
-/** Callback function type for handling BLE Audio events. */
-typedef int ble_audio_event_fn(struct ble_audio_event *event, void *arg);
-
-/**
- * Event listener structure
- *
- * This should be used as an opaque structure and not modified manually.
- */
-struct ble_audio_event_listener {
- /** The function to call when a BLE Audio event occurs. */
- ble_audio_event_fn *fn;
-
- /** An optional argument to pass to the event handler function. */
- void *arg;
-
- /** Singly-linked list entry. */
- SLIST_ENTRY(ble_audio_event_listener) next;
-};
-
-/**
- * Registers listener for BLE Audio events
- *
- * On success listener structure will be initialized automatically and does not
- * need to be initialized prior to calling this function. To change callback
- * and/or argument unregister listener first and register it again.
- *
- * @param[in] listener Listener structure
- * @param[in] event_mask Optional event mask
- * @param[in] fn Callback function
- * @param[in] arg Optional callback argument
- *
- * @return 0 on success
- * BLE_HS_EINVAL if no callback is specified
- * BLE_HS_EALREADY if listener is already registered
- */
-int ble_audio_event_listener_register(struct ble_audio_event_listener *listener,
- ble_audio_event_fn *fn, void *arg);
-
-/**
- * Unregisters listener for BLE Audio events
- *
- * @param[in] listener Listener structure
- *
- * @return 0 on success
- * BLE_HS_ENOENT if listener was not registered
- */
-int ble_audio_event_listener_unregister(struct ble_audio_event_listener *listener);
-
-/**
- * BASE iterator
- *
- * The iterator structure used by @ref ble_audio_base_subgroup_iter and
- * @ble_audio_base_bis_iter functions to iterate the BASE Level 2 and 3 elements
- * (Subgroups and BISes).
- * This should be used as an opaque structure and not modified manually.
- *
- * Example:
- * @code{.c}
- * struct ble_audio_base_iter subgroup_iter;
- * struct ble_audio_base_iter bis_iter;
- * struct ble_audio_base_group group;
- * struct ble_audio_base_subgroup subgroup;
- * struct ble_audio_base_bis bis;
- *
- * rc = ble_audio_base_parse(data, data_size, &group, &subgroup_iter);
- * if (rc == 0) {
- * for (uint8_t i = 0; i < group->num_subgroups; i++) {
- * rc = ble_audio_base_subgroup_iter(&subgroup_iter, &subgroup, &bis_iter);
- * if (rc == 0) {
- * for (uint8_t j = 0; j < subgroup->num_bis; j++) {
- * rc = ble_audio_base_bis_iter(&bis_iter, &bis);
- * if (rc == 0) {
- * foo(&group, &subgroup, &bis);
- * }
- * }
- * }
- * }
- * }
- * @endcode
- */
-struct ble_audio_base_iter {
- /** Data pointer */
- const uint8_t *data;
-
- /** Base length */
- uint8_t buf_len;
-
- /** Original BASE pointer */
- const uint8_t *buf;
-
- /** Remaining number of elements */
- uint8_t num_elements;
-};
-
-/** @brief Broadcast Audio Source Endpoint Group structure */
-struct ble_audio_base_group {
- /** Presentation Delay */
- uint32_t presentation_delay;
-
- /** Number of subgroups */
- uint8_t num_subgroups;
-};
-
-/**
- * Parse the BASE received from Basic Audio Announcement data.
- *
- * @param[in] data Pointer to the BASE data buffer to parse.
- * @param[in] data_len Length of the BASE data buffer.
- * @param[out] group Group object.
- * @param[out] subgroup_iter Subgroup iterator object.
- *
- * @return 0 on success; nonzero on failure.
- */
-int ble_audio_base_parse(const uint8_t *data, uint8_t data_len,
- struct ble_audio_base_group *group,
- struct ble_audio_base_iter *subgroup_iter);
-
-/** @brief Broadcast Audio Source Endpoint Subgroup structure */
-struct ble_audio_base_subgroup {
- /** Codec information for the subgroup */
- struct ble_audio_codec_id codec_id;
-
- /** Length of the Codec Specific Configuration for the subgroup */
- uint8_t codec_spec_config_len;
-
- /** Codec Specific Configuration for the subgroup */
- const uint8_t *codec_spec_config;
-
- /** Length of the Metadata for the subgroup */
- uint8_t metadata_len;
-
- /** Series of LTV structures containing Metadata */
- const uint8_t *metadata;
-
- /** Number of BISes in the subgroup */
- uint8_t num_bis;
-};
-
-/**
- * @brief Basic Audio Announcement Subgroup information
- *
- * @param[in] subgroup_iter Subgroup iterator object.
- * @param[out] subgroup Subgroup object.
- * @param[out] bis_iter BIS iterator object.
- *
- * @return 0 on success;
- * A non-zero value on failure.
- */
-int ble_audio_base_subgroup_iter(struct ble_audio_base_iter *subgroup_iter,
- struct ble_audio_base_subgroup *subgroup,
- struct ble_audio_base_iter *bis_iter);
-
-/** @brief Broadcast Audio Source Endpoint BIS structure */
-struct ble_audio_base_bis {
- /** BIS_index value for the BIS */
- uint8_t index;
-
- /** Length of the Codec Specific Configuration for the BIS */
- uint8_t codec_spec_config_len;
-
- /** Codec Specific Configuration for the BIS */
- const uint8_t *codec_spec_config;
-};
-
-/**
- * @brief Basic Audio Announcement Subgroup information
- *
- * @param[in] bis_iter BIS iterator object.
- * @param[out] bis BIS object.
- *
- * @return 0 on success;
- * A non-zero value on failure.
- */
-int ble_audio_base_bis_iter(struct ble_audio_base_iter *bis_iter,
- struct ble_audio_base_bis *bis);
-
-#endif /* H_BLE_AUDIO_ */
diff --git a/nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h b/nimble/host/audio/services/auracast/include/services/auracast/ble_svc_auracast.h
similarity index 98%
rename from nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h
rename to nimble/host/audio/services/auracast/include/services/auracast/ble_svc_auracast.h
index 560adb8..900b6fd 100644
--- a/nimble/host/services/auracast/include/services/auracast/ble_svc_auracast.h
+++ b/nimble/host/audio/services/auracast/include/services/auracast/ble_svc_auracast.h
@@ -19,8 +19,8 @@
#include <stdint.h>
#include "host/ble_gap.h"
-#include "host/ble_audio_common.h"
-#include "host/ble_audio_broadcast_source.h"
+#include "audio/ble_audio.h"
+#include "audio/ble_audio_broadcast_source.h"
struct ble_svc_auracast_create_params {
/** Broadcast Audio Source Endpoint */
diff --git a/nimble/host/services/auracast/pkg.yml b/nimble/host/audio/services/auracast/pkg.yml
similarity index 93%
rename from nimble/host/services/auracast/pkg.yml
rename to nimble/host/audio/services/auracast/pkg.yml
index a4d0013..a2533b2 100644
--- a/nimble/host/services/auracast/pkg.yml
+++ b/nimble/host/audio/services/auracast/pkg.yml
@@ -16,7 +16,7 @@
# under the License.
#
-pkg.name: nimble/host/services/auracast
+pkg.name: nimble/host/audio/services/auracast
pkg.description: Implements Auracast service
pkg.author: "Apache Mynewt <dev@mynewt.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
@@ -28,3 +28,4 @@
pkg.deps:
- nimble/host
+ - nimble/host/audio
diff --git a/nimble/host/services/auracast/src/ble_svc_auracast.c b/nimble/host/audio/services/auracast/src/ble_svc_auracast.c
similarity index 98%
rename from nimble/host/services/auracast/src/ble_svc_auracast.c
rename to nimble/host/audio/services/auracast/src/ble_svc_auracast.c
index 7bd9112..b323e64 100644
--- a/nimble/host/services/auracast/src/ble_svc_auracast.c
+++ b/nimble/host/audio/services/auracast/src/ble_svc_auracast.c
@@ -21,7 +21,7 @@
#include "host/ble_gap.h"
#include "host/ble_hs.h"
-#include "host/ble_audio_broadcast_source.h"
+#include "audio/ble_audio_broadcast_source.h"
#include "services/auracast/ble_svc_auracast.h"
int
diff --git a/nimble/host/audio/src/ble_audio.c b/nimble/host/audio/src/ble_audio.c
index 61c42e4..f7597aa 100644
--- a/nimble/host/audio/src/ble_audio.c
+++ b/nimble/host/audio/src/ble_audio.c
@@ -21,7 +21,7 @@
#include <stddef.h>
#include "host/ble_hs.h"
-#include "host/audio/ble_audio.h"
+#include "audio/ble_audio.h"
#include "ble_audio_priv.h"
@@ -29,24 +29,23 @@
static SLIST_HEAD(, ble_audio_event_listener) ble_audio_event_listener_list =
SLIST_HEAD_INITIALIZER(ble_audio_event_listener_list);
-struct ble_audio_adv_parse_bcst_announcement_data {
+struct ble_audio_adv_parse_broadcast_announcement_data {
struct ble_audio_event event;
- struct ble_audio_pub_bcst_announcement pub;
- struct ble_audio_bcst_name name;
+ struct ble_audio_pub_broadcast_announcement pub;
+ struct ble_audio_broadcast_name name;
bool success;
};
static int
-ble_audio_adv_parse_bcst_announcement(const struct ble_hs_adv_field *field,
- void *user_data)
+ble_audio_adv_parse_broadcast_announcement(const struct ble_hs_adv_field *field, void *user_data)
{
- struct ble_audio_adv_parse_bcst_announcement_data *data = user_data;
- struct ble_audio_event_bcst_announcement *event;
+ struct ble_audio_adv_parse_broadcast_announcement_data *data = user_data;
+ struct ble_audio_event_broadcast_announcement *event;
const uint8_t value_len = field->length - sizeof(field->length);
ble_uuid16_t uuid16 = BLE_UUID16_INIT(0);
uint8_t offset = 0;
- event = &data->event.bcst_announcement;
+ event = &data->event.broadcast_announcement;
data->success = false;
@@ -139,15 +138,15 @@
{
switch (gap_event->type) {
case BLE_GAP_EVENT_EXT_DISC: {
- struct ble_audio_adv_parse_bcst_announcement_data data = { 0 };
+ struct ble_audio_adv_parse_broadcast_announcement_data data = { 0 };
int rc;
rc = ble_hs_adv_parse(gap_event->ext_disc.data,
gap_event->ext_disc.length_data,
- ble_audio_adv_parse_bcst_announcement, &data);
+ ble_audio_adv_parse_broadcast_announcement, &data);
if (rc == 0 && data.success) {
- data.event.type = BLE_AUDIO_EVENT_BCST_ANNOUNCEMENT;
- data.event.bcst_announcement.ext_disc = &gap_event->ext_disc;
+ data.event.type = BLE_AUDIO_EVENT_BROADCAST_ANNOUNCEMENT;
+ data.event.broadcast_announcement.ext_disc = &gap_event->ext_disc;
(void)ble_audio_event_listener_call(&data.event);
}
diff --git a/nimble/host/src/ble_audio_broadcast_source.c b/nimble/host/audio/src/ble_audio_broadcast_source.c
similarity index 98%
rename from nimble/host/src/ble_audio_broadcast_source.c
rename to nimble/host/audio/src/ble_audio_broadcast_source.c
index 2891658..d243a5f 100644
--- a/nimble/host/src/ble_audio_broadcast_source.c
+++ b/nimble/host/audio/src/ble_audio_broadcast_source.c
@@ -18,7 +18,7 @@
*/
#include "host/ble_uuid.h"
-#include "host/ble_audio_broadcast_source.h"
+#include "audio/ble_audio_broadcast_source.h"
#include "os/util.h"
@@ -35,7 +35,7 @@
static SLIST_HEAD(, ble_audio_broadcast) ble_audio_broadcasts;
static struct os_mempool ble_audio_broadcast_pool;
static os_membuf_t ble_audio_broadcast_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG),
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_audio_broadcast))];
static bool
@@ -483,7 +483,7 @@
SLIST_INIT(&ble_audio_broadcasts);
rc = os_mempool_init(&ble_audio_broadcast_pool,
- MYNEWT_VAL(BLE_MAX_BIG),
+ MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof(struct ble_audio_broadcast),
ble_audio_broadcast_mem, "ble_audio_broadcast_pool");
SYSINIT_PANIC_ASSERT(rc == 0);
diff --git a/nimble/host/audio/src/ble_audio_priv.h b/nimble/host/audio/src/ble_audio_priv.h
index bedbdaf..10f0109 100644
--- a/nimble/host/audio/src/ble_audio_priv.h
+++ b/nimble/host/audio/src/ble_audio_priv.h
@@ -20,7 +20,7 @@
#ifndef H_BLE_AUDIO_PRIV_
#define H_BLE_AUDIO_PRIV_
-#include "host/audio/ble_audio.h"
+#include "audio/ble_audio.h"
int ble_audio_event_listener_call(struct ble_audio_event *event);
diff --git a/nimble/host/audio/targets/btshell_native/syscfg.yml b/nimble/host/audio/targets/btshell_native/syscfg.yml
index d631ea7..e9db007 100644
--- a/nimble/host/audio/targets/btshell_native/syscfg.yml
+++ b/nimble/host/audio/targets/btshell_native/syscfg.yml
@@ -61,8 +61,8 @@
BLE_VERSION: 54
BLE_ISO_BROADCAST_SINK: 1
BLE_ISO_BROADCAST_SOURCE: 1
- BLE_MAX_BIG: 1
- BLE_MAX_BIS: 2
+ BLE_ISO_MAX_BIGS: 1
+ BLE_ISO_MAX_BISES: 2
CONSOLE_UART: 1
CONSOLE_UART_BAUD: 1000000
diff --git a/nimble/host/audio/test/src/testcases/ble_audio_base_parse_test.c b/nimble/host/audio/test/src/testcases/ble_audio_base_parse_test.c
index 2398d62..3231b85 100644
--- a/nimble/host/audio/test/src/testcases/ble_audio_base_parse_test.c
+++ b/nimble/host/audio/test/src/testcases/ble_audio_base_parse_test.c
@@ -20,7 +20,7 @@
#include "testutil/testutil.h"
#include "host/ble_hs.h"
-#include "host/audio/ble_audio.h"
+#include "audio/ble_audio.h"
/**
* BAP_v1.0.1 Table 3.16
diff --git a/nimble/host/audio/test/src/testcases/ble_audio_listener_register_test.c b/nimble/host/audio/test/src/testcases/ble_audio_listener_register_test.c
index f55b51a..363632e 100644
--- a/nimble/host/audio/test/src/testcases/ble_audio_listener_register_test.c
+++ b/nimble/host/audio/test/src/testcases/ble_audio_listener_register_test.c
@@ -20,7 +20,7 @@
#include "testutil/testutil.h"
#include "host/ble_hs.h"
-#include "host/audio/ble_audio.h"
+#include "audio/ble_audio.h"
static struct ble_audio_event_listener event_listener;
diff --git a/nimble/host/include/host/ble_audio_common.h b/nimble/host/include/host/ble_audio_common.h
deleted file mode 100644
index 05780c0..0000000
--- a/nimble/host/include/host/ble_audio_common.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_AUDIO_COMMON_
-#define H_BLE_AUDIO_COMMON_
-
-/**
- * @file ble_audio_common.h
- *
- * @brief Bluetooth Low Energy Audio Common API
- *
- * @defgroup bt_le_audio_common Bluetooth LE Audio Common
- * @ingroup bt_host
- * @{
- */
-
-#include "stdint.h"
-#include "os/queue.h"
-
-/**
- * @cond
- * Helper macros for BLE_AUDIO_BUILD_CODEC_CONFIG
- * @{
- */
-#define FIELD_LEN_2(_len, _type, _field) _len, _type, _field,
-#define FIELD_LEN_5(_len, _type, _field) _len, _type, _field, \
- _field >> 8, _field >> 16, \
- _field >> 24,
-
-#define FIELD_TESTED_0(_len, _type, _field)
-#define FIELD_TESTED_1(_len, _type, _field) FIELD_LEN_ ## _len(_len, \
- _type, \
- _field)
-#define EMPTY() FIELD_TESTED_0
-#define PRESENT(X) FIELD_TESTED_1
-#define TEST(x, A, FUNC, ...) FUNC
-#define TEST_FIELD(...) TEST(, ## __VA_ARGS__, \
- PRESENT(__VA_ARGS__), \
- EMPTY(__VA_ARGS__))
-#define FIELD_TESTED(_test, _len, _type, _field) _test(_len, _type, _field)
-#define OPTIONAL_FIELD(_len, _type, ...) FIELD_TESTED(TEST_FIELD \
- (__VA_ARGS__), \
- _len, \
- _type, \
- __VA_ARGS__)
-
-/**
- * @}
- * @endcond
- */
-
-/** Broadcast Audio Announcement Service UUID. */
-#define BLE_BROADCAST_AUDIO_ANNOUNCEMENT_SVC_UUID 0x1852
-
-/** Public Broadcast Announcement Service UUID. */
-#define BLE_BROADCAST_PUB_ANNOUNCEMENT_SVC_UUID 0x1856
-
-/**
- * @defgroup ble_audio_sampling_rates Bluetooth Low Energy Audio Sampling Rates
- * @{
- */
-
-/** LE Audio Sampling Rate: 8000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_8000_HZ 0x01
-
-/** LE Audio Sampling Rate: 11025 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_11025_HZ 0x02
-
-/** LE Audio Sampling Rate: 16000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_16000_HZ 0x03
-
-/** LE Audio Sampling Rate: 22050 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_22050_HZ 0x04
-
-/** LE Audio Sampling Rate: 24000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_24000_HZ 0x05
-
-/** LE Audio Sampling Rate: 32000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_32000_HZ 0x06
-
-/** LE Audio Sampling Rate: 44100 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_44100_HZ 0x07
-
-/** LE Audio Sampling Rate: 48000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_48000_HZ 0x08
-
-/** LE Audio Sampling Rate: 88200 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_88200_HZ 0x09
-
-/** LE Audio Sampling Rate: 96000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_96000_HZ 0x0A
-
-/** LE Audio Sampling Rate: 176400 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_176400_HZ 0x0B
-
-/** LE Audio Sampling Rate: 192000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_192000_HZ 0x0C
-
-/** LE Audio Sampling Rate: 384000 Hz. */
-#define BLE_AUDIO_SAMPLING_RATE_384000_HZ 0x0D
-
-/** @} */
-
-/**
- * @defgroup ble_audio_frame_durations Bluetooth Low Energy Audio Frame Durations
- * @{
- */
-
-/** LE Audio Frame Duration: 7.5 ms. */
-#define BLE_AUDIO_SELECTED_FRAME_DURATION_7_5_MS 0x00
-
-/** LE Audio Frame Duration: 10 ms. */
-#define BLE_AUDIO_SELECTED_FRAME_DURATION_10_MS 0x01
-
-/** @} */
-
-/**
- * @defgroup ble_audio_locations Bluetooth Low Energy Audio Locations
- * @{
- */
-
-/** LE Audio Location: Front Left. */
-#define BLE_AUDIO_LOCATION_FRONT_LEFT (1ULL)
-
-/** LE Audio Location: Front Right. */
-#define BLE_AUDIO_LOCATION_FRONT_RIGHT (1ULL << 1)
-
-/** LE Audio Location: Front Center. */
-#define BLE_AUDIO_LOCATION_FRONT_CENTER (1ULL << 2)
-
-/** LE Audio Location: Low Frequency Effects 1. */
-#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 (1ULL << 3)
-
-/** LE Audio Location: Back Left. */
-#define BLE_AUDIO_LOCATION_BACK_LEFT (1ULL << 4)
-
-/** LE Audio Location: Front Left Center. */
-#define BLE_AUDIO_LOCATION_FRONT_LEFT_CENTER (1ULL << 5)
-
-/** LE Audio Location: Front Right Center. */
-#define BLE_AUDIO_LOCATION_FRONT_RIGHT_CENTER (1ULL << 6)
-
-/** LE Audio Location: Back Center. */
-#define BLE_AUDIO_LOCATION_BACK_CENTER (1ULL << 7)
-
-/** LE Audio Location: Low Frequency Effects 2. */
-#define BLE_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 (1ULL << 8)
-
-/** LE Audio Location: Side Left. */
-#define BLE_AUDIO_LOCATION_SIDE_LEFT (1ULL << 9)
-
-/** LE Audio Location: Side Right. */
-#define BLE_AUDIO_LOCATION_SIDE_RIGHT (1ULL << 10)
-
-/** LE Audio Location: Top Front Left. */
-#define BLE_AUDIO_LOCATION_TOP_FRONT_LEFT (1ULL << 11)
-
-/** LE Audio Location: Top Front Right. */
-#define BLE_AUDIO_LOCATION_TOP_FRONT_RIGHT (1ULL << 12)
-
-/** LE Audio Location: Top Front Center. */
-#define BLE_AUDIO_LOCATION_TOP_FRONT_CENTER (1ULL << 13)
-
-/** LE Audio Location: Top Center. */
-#define BLE_AUDIO_LOCATION_TOP_CENTER (1ULL << 14)
-
-/** LE Audio Location: Top Back Left. */
-#define BLE_AUDIO_LOCATION_TOP_BACK_LEFT (1ULL << 15)
-
-/** LE Audio Location: Top Back Right. */
-#define BLE_AUDIO_LOCATION_TOP_BACK_RIGHT (1ULL << 16)
-
-/** LE Audio Location: Top Side Left. */
-#define BLE_AUDIO_LOCATION_TOP_SIDE_LEFT (1ULL << 17)
-
-/** LE Audio Location: Top Side Right. */
-#define BLE_AUDIO_LOCATION_TOP_SIDE_RIGHT (1ULL << 18)
-
-/** LE Audio Location: Top Back Center. */
-#define BLE_AUDIO_LOCATION_TOP_BACK_CENTER (1ULL << 19)
-
-/** LE Audio Location: Bottom Front Center. */
-#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_CENTER (1ULL << 20)
-
-/** LE Audio Location: Bottom Front Left. */
-#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_LEFT (1ULL << 21)
-
-/** LE Audio Location: Bottom Front Right. */
-#define BLE_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT (1ULL << 22)
-
-/** LE Audio Location: Left Surround. */
-#define BLE_AUDIO_LOCATION_LEFT_SURROUND (1ULL << 23)
-
-/** LE Audio Location: Right Surround. */
-#define BLE_AUDIO_LOCATION_RIGHT_SURROUND (1ULL << 24)
-
-/** @} */
-
-/**
- * @defgroup ble_audio_codec_config Bluetooth Low Energy Audio Codec Specific Config
- * @{
- */
-
-/** LE Audio Codec Config Type: Sampling Frequency. */
-#define BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE 0x01
-
-/** LE Audio Codec Config Type: Frame Duration. */
-#define BLE_AUDIO_CODEC_FRAME_DURATION_TYPE 0x02
-
-/** LE Audio Codec Config Type: Channel Allocation. */
-#define BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE 0x03
-
-/** LE Audio Codec Config Type: Octets Per Codec Frame. */
-#define BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE 0x04
-
-/** LE Audio Codec Config Type: Frame Blocks Per SDU. */
-#define BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE 0x05
-
-/** @} */
-
-/**
- * @brief Helper macro used to build LTV array of Codec_Specific_Configuration.
- *
- * @param _sampling_freq Sampling_Frequency - single octet value
- * @param _frame_duration Frame_Duration - single octet value
- * @param _audio_channel_alloc Audio_Channel_Allocation -
- * four octet value
- * @param _octets_per_codec_frame Octets_Per_Codec_Frame -
- * two octet value
- * @param _codec_frame_blocks_per_sdu Codec_Frame_Blocks_Per_SDU -
- * single octet value
- *
- * @return Pointer to a `ble_uuid16_t` structure.
- */
-#define BLE_AUDIO_BUILD_CODEC_CONFIG(_sampling_freq, \
- _frame_duration, \
- _audio_channel_alloc, \
- _octets_per_codec_frame, \
- _codec_frame_blocks_per_sdu) \
- { \
- 2, BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE, _sampling_freq, \
- 2, BLE_AUDIO_CODEC_FRAME_DURATION_TYPE, _frame_duration, \
- OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE, \
- _audio_channel_alloc) \
- 3, BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE, \
- (_octets_per_codec_frame), ((_octets_per_codec_frame) >> 8), \
- OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE, \
- _codec_frame_blocks_per_sdu) \
- }
-
-/** Codec Information */
-struct ble_audio_codec_id {
- /** Coding Format */
- uint8_t format;
-
- /** Company ID */
- uint16_t company_id;
-
- /** Vendor Specific Codec ID */
- uint16_t vendor_specific;
-};
-
-/** Broadcast Isochronous Streams (BIS) */
-struct ble_audio_bis {
- /** Pointer to next BIS in subgroup */
- STAILQ_ENTRY(ble_audio_bis) next;
-
- /** BIS index */
- uint8_t idx;
-
- /** BIS level Codec Specific Configuration length */
- uint8_t codec_spec_config_len;
-
- /** BIS level Codec Specific Configuration */
- uint8_t *codec_spec_config;
-};
-
-/** Broadcast Isochronous Group (BIG) Subgroup */
-struct ble_audio_big_subgroup {
- /** Pointer to next subgroup in BIG */
- STAILQ_ENTRY(ble_audio_big_subgroup) next;
-
- /** Number of BISes in subgroup */
- uint8_t bis_cnt;
-
- /** Codec ID */
- struct ble_audio_codec_id codec_id;
-
- /** Subgroup level Codec Specific Configuration */
- uint8_t *codec_spec_config;
-
- /** Subgroup level Codec Specific Configuration length */
- uint8_t codec_spec_config_len;
-
- /** Subgroup Metadata */
- uint8_t *metadata;
-
- /** Subgroup Metadata length*/
- uint8_t metadata_len;
-
- /** Link list of BISes */
- STAILQ_HEAD(, ble_audio_bis) bises;
-};
-
-/** Broadcast Audio Source Endpoint */
-struct ble_audio_base {
- /** Broadcast ID */
- uint32_t broadcast_id;
-
- /** Presentation Delay */
- uint32_t presentation_delay;
-
- /** Number of subgroups in BIG */
- uint8_t num_subgroups;
-
- /** Link list of subgroups */
- STAILQ_HEAD(, ble_audio_big_subgroup) subs;
-};
-
-/**
- * @}
- */
-
-#endif /* H_BLE_AUDIO_COMMON_ */
diff --git a/nimble/host/include/host/ble_iso.h b/nimble/host/include/host/ble_iso.h
index cdd3df8..1bae336 100644
--- a/nimble/host/include/host/ble_iso.h
+++ b/nimble/host/include/host/ble_iso.h
@@ -109,7 +109,7 @@
uint8_t num_bis;
/** The connection handles of all the BIS in the BIG. */
- uint16_t conn_handle[MYNEWT_VAL(BLE_MAX_BIS)];
+ uint16_t conn_handle[MYNEWT_VAL(BLE_ISO_MAX_BISES)];
};
/** @brief Received ISO Data status possible values */
diff --git a/nimble/host/pkg.yml b/nimble/host/pkg.yml
index cab496c..b4df8f8 100644
--- a/nimble/host/pkg.yml
+++ b/nimble/host/pkg.yml
@@ -32,6 +32,9 @@
- nimble
- nimble/transport
+pkg.deps.BLE_AUDIO:
+ - nimble/host/audio
+
pkg.deps.BLE_SM_LEGACY:
- "@apache-mynewt-core/crypto/tinycrypt"
diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index d084c04..147837d 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -24,7 +24,9 @@
#include "syscfg/syscfg.h"
#include "stats/stats.h"
#include "host/ble_hs.h"
-#include "host/ble_audio_broadcast_source.h"
+#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
+#include "audio/ble_audio_broadcast_source.h"
+#endif
#include "ble_hs_priv.h"
#include "ble_iso_priv.h"
#include "nimble/nimble_npl.h"
diff --git a/nimble/host/src/ble_iso.c b/nimble/host/src/ble_iso.c
index 90bd613..503cdd0 100644
--- a/nimble/host/src/ble_iso.c
+++ b/nimble/host/src/ble_iso.c
@@ -87,10 +87,10 @@
static SLIST_HEAD(, ble_iso_conn) ble_iso_conns;
static struct os_mempool ble_iso_big_pool;
static os_membuf_t ble_iso_big_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIG), sizeof (struct ble_iso_big))];
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BIGS), sizeof (struct ble_iso_big))];
static struct os_mempool ble_iso_bis_pool;
static os_membuf_t ble_iso_bis_mem[
- OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_BIS), sizeof (struct ble_iso_bis))];
+ OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_ISO_MAX_BISES), sizeof (struct ble_iso_bis))];
static void
ble_iso_conn_append(struct ble_iso_conn *conn)
@@ -234,7 +234,7 @@
struct ble_iso_big *big;
cp.adv_handle = create_params->adv_handle;
- if (create_params->bis_cnt > MYNEWT_VAL(BLE_MAX_BIS)) {
+ if (create_params->bis_cnt > MYNEWT_VAL(BLE_ISO_MAX_BISES)) {
return BLE_HS_EINVAL;
}
@@ -498,7 +498,7 @@
uint8_t *big_handle)
{
struct ble_hci_le_big_create_sync_cp *cp;
- uint8_t buf[sizeof(*cp) + MYNEWT_VAL(BLE_MAX_BIS)];
+ uint8_t buf[sizeof(*cp) + MYNEWT_VAL(BLE_ISO_MAX_BISES)];
struct ble_iso_big *big;
int rc;
@@ -922,13 +922,13 @@
SLIST_INIT(&ble_iso_bigs);
rc = os_mempool_init(&ble_iso_big_pool,
- MYNEWT_VAL(BLE_MAX_BIG),
+ MYNEWT_VAL(BLE_ISO_MAX_BIGS),
sizeof (struct ble_iso_big),
ble_iso_big_mem, "ble_iso_big_pool");
SYSINIT_PANIC_ASSERT(rc == 0);
rc = os_mempool_init(&ble_iso_bis_pool,
- MYNEWT_VAL(BLE_MAX_BIS),
+ MYNEWT_VAL(BLE_ISO_MAX_BISES),
sizeof (struct ble_iso_bis),
ble_iso_bis_mem, "ble_iso_bis_pool");
SYSINIT_PANIC_ASSERT(rc == 0);
diff --git a/nimble/host/syscfg.yml b/nimble/host/syscfg.yml
index faaaa00..2848b64 100644
--- a/nimble/host/syscfg.yml
+++ b/nimble/host/syscfg.yml
@@ -440,6 +440,11 @@
that have been enabled in the stack, such as GATT support.
value: 0
+ BLE_AUDIO:
+ description: 'This option enables Bluetooth LE Audio support'
+ value: 0
+ experimental: 1
+
# Flow control settings.
BLE_HS_FLOW_CTRL:
description: >
@@ -493,20 +498,6 @@
supported by host.
value: 0
- BLE_MAX_BIG:
- desciptrion: >
- Number of available BIGs
- value: 'MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES'
- restrictions:
- - 'BLE_ISO_BROADCAST_SOURCE if 0'
-
- BLE_MAX_BIS:
- description: >
- Number of supported BISes
- value: 4
- restrictions:
- - 'BLE_ISO_BROADCAST_SOURCE if 0'
-
### Log settings.
BLE_HS_LOG_MOD:
@@ -523,6 +514,20 @@
description: 'Minimum level for the BLE EATT log.'
value: 1
+ BLE_ISO_MAX_BIGS:
+ desciptrion: >
+ Number of available BIGs
+ value: 'MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES'
+ restrictions:
+ - 'BLE_ISO_BROADCAST_SOURCE if 0'
+
+ BLE_ISO_MAX_BISES:
+ description: >
+ Number of supported BISes
+ value: 4
+ restrictions:
+ - 'BLE_ISO_BROADCAST_SOURCE if 0'
+
syscfg.logs:
BLE_HS_LOG:
module: MYNEWT_VAL(BLE_HS_LOG_MOD)
diff --git a/porting/examples/linux/include/syscfg/syscfg.h b/porting/examples/linux/include/syscfg/syscfg.h
index 86da373..6571329 100644
--- a/porting/examples/linux/include/syscfg/syscfg.h
+++ b/porting/examples/linux/include/syscfg/syscfg.h
@@ -803,12 +803,12 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIG
-#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BIGS
+#define MYNEWT_VAL_BLE_ISO_MAX_BIGS (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIS
-#define MYNEWT_VAL_BLE_MAX_BIS (4)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BISES
+#define MYNEWT_VAL_BLE_ISO_MAX_BISES (4)
#endif
#ifndef MYNEWT_VAL_BLE_MESH
diff --git a/porting/examples/linux_blemesh/include/syscfg/syscfg.h b/porting/examples/linux_blemesh/include/syscfg/syscfg.h
index c44af9c..8321199 100644
--- a/porting/examples/linux_blemesh/include/syscfg/syscfg.h
+++ b/porting/examples/linux_blemesh/include/syscfg/syscfg.h
@@ -804,12 +804,12 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIG
-#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BIGS
+#define MYNEWT_VAL_BLE_ISO_MAX_BIGS (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIS
-#define MYNEWT_VAL_BLE_MAX_BIS (4)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BISES
+#define MYNEWT_VAL_BLE_ISO_MAX_BISES (4)
#endif
/* Overridden by @apache-mynewt-nimble/porting/targets/linux_blemesh (defined by @apache-mynewt-nimble/nimble/host) */
diff --git a/porting/examples/nuttx/include/syscfg/syscfg.h b/porting/examples/nuttx/include/syscfg/syscfg.h
index d087c57..af7f799 100644
--- a/porting/examples/nuttx/include/syscfg/syscfg.h
+++ b/porting/examples/nuttx/include/syscfg/syscfg.h
@@ -803,12 +803,12 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIG
-#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BIGS
+#define MYNEWT_VAL_BLE_ISO_MAX_BIGS (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIS
-#define MYNEWT_VAL_BLE_MAX_BIS (4)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BISES
+#define MYNEWT_VAL_BLE_ISO_MAX_BISES (4)
#endif
#ifndef MYNEWT_VAL_BLE_MESH
diff --git a/porting/nimble/include/syscfg/syscfg.h b/porting/nimble/include/syscfg/syscfg.h
index 4910e54..c62bb02 100644
--- a/porting/nimble/include/syscfg/syscfg.h
+++ b/porting/nimble/include/syscfg/syscfg.h
@@ -802,12 +802,12 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIG
-#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BIGS
+#define MYNEWT_VAL_BLE_ISO_MAX_BIGS (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIS
-#define MYNEWT_VAL_BLE_MAX_BIS (4)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BISES
+#define MYNEWT_VAL_BLE_ISO_MAX_BISES (4)
#endif
#ifndef MYNEWT_VAL_BLE_MESH
diff --git a/porting/npl/riot/include/syscfg/syscfg.h b/porting/npl/riot/include/syscfg/syscfg.h
index b70ba2b..27047fe 100644
--- a/porting/npl/riot/include/syscfg/syscfg.h
+++ b/porting/npl/riot/include/syscfg/syscfg.h
@@ -1719,12 +1719,12 @@
#define MYNEWT_VAL_BLE_L2CAP_SIG_MAX_PROCS (1)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIG
-#define MYNEWT_VAL_BLE_MAX_BIG (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BIGS
+#define MYNEWT_VAL_BLE_ISO_MAX_BIGS (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES)
#endif
-#ifndef MYNEWT_VAL_BLE_MAX_BIS
-#define MYNEWT_VAL_BLE_MAX_BIS (4)
+#ifndef MYNEWT_VAL_BLE_ISO_MAX_BISES
+#define MYNEWT_VAL_BLE_ISO_MAX_BISES (4)
#endif
#ifndef MYNEWT_VAL_BLE_MESH
diff --git a/targets/nordic_pca10095_net-blehci_broadcaster/syscfg.yml b/targets/nordic_pca10095_net-blehci_broadcaster/syscfg.yml
index d3255ff..b86d588 100644
--- a/targets/nordic_pca10095_net-blehci_broadcaster/syscfg.yml
+++ b/targets/nordic_pca10095_net-blehci_broadcaster/syscfg.yml
@@ -43,5 +43,5 @@
BLE_VERSION: 54
BLE_ISO: 1
BLE_ISO_BROADCAST_SOURCE: 1
- BLE_MAX_BIG: 1
- BLE_MAX_BIS: 2
+ BLE_ISO_MAX_BIGS: 1
+ BLE_ISO_MAX_BISES: 2