fix(ble_audio): Miscellaneous fixes for ISO & LE Audio examples

This commit is contained in:
Liu Linyan
2026-05-06 09:31:07 +08:00
parent 92288a2d84
commit 325b08e023
108 changed files with 3051 additions and 1269 deletions
+2 -2
View File
@@ -67,8 +67,8 @@ if(CONFIG_BT_ISO)
list(APPEND ble_audio_include_dirs
"${CMAKE_CURRENT_LIST_DIR}/api/iso/include"
"${CMAKE_CURRENT_LIST_DIR}/host"
"${CMAKE_CURRENT_LIST_DIR}/host/adapter"
"${CMAKE_CURRENT_LIST_DIR}/host/common/include"
"${CMAKE_CURRENT_LIST_DIR}/host/adapter/nimble/include"
"${CMAKE_CURRENT_LIST_DIR}/include/subsys/bluetooth"
"${CMAKE_CURRENT_LIST_DIR}/include/subsys/bluetooth/host"
"${CMAKE_CURRENT_LIST_DIR}/include"
@@ -57,6 +57,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 8_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -71,6 +72,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 8_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -85,6 +87,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 16_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -99,6 +102,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 16_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -113,6 +117,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 24_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -129,6 +134,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
*
* Mandatory to support as unicast server.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -143,6 +149,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 32_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -157,6 +164,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 32_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -171,6 +179,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 441_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -185,6 +194,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 441_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -199,6 +209,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -213,6 +224,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -227,6 +239,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_3_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -241,6 +254,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_4_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -255,6 +269,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_5_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -269,6 +284,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_6_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -283,6 +299,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 8_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -297,6 +314,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 8_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -311,6 +329,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 16_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -325,6 +344,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 16_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -339,6 +359,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 24_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -353,6 +374,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 24_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -367,6 +389,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 32_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -381,6 +404,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 32_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -395,6 +419,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 441_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -409,6 +434,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 441_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -423,6 +449,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -437,6 +464,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -451,6 +479,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_3_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -465,6 +494,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_4_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -479,6 +509,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_5_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -493,6 +524,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Unicast 48_6_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -507,6 +539,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 8_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -521,6 +554,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 8_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -535,6 +569,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 16_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -551,6 +586,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
*
* Mandatory to support as both broadcast source and sink.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -565,6 +601,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 24_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -581,6 +618,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
*
* Mandatory to support as broadcast sink.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -595,6 +633,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 32_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -609,6 +648,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 32_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -623,6 +663,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 441_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -637,6 +678,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 441_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -651,6 +693,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_1_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -665,6 +708,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_2_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -679,6 +723,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_3_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -693,6 +738,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_4_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -707,6 +753,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_5_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -721,6 +768,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_6_1 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -735,6 +783,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 8_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -749,6 +798,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 8_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -763,6 +813,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 16_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -779,6 +830,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
*
* Mandatory to support as both broadcast source and sink.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -793,6 +845,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 24_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -809,6 +862,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
*
* Mandatory to support as broadcast sink.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -823,6 +877,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 32_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -837,6 +892,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 32_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -851,6 +907,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 441_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -865,6 +922,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 441_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -879,6 +937,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_1_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -893,6 +952,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_2_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -907,6 +967,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_3_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -921,6 +982,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_4_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -935,6 +997,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_5_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -949,6 +1012,7 @@ typedef struct bt_bap_lc3_preset esp_ble_audio_bap_lc3_preset_t;
/**
* @brief Helper to declare LC3 Broadcast 48_6_2 codec configuration.
*
* @param _name Preset configuration name.
* @param _loc Audio channel location bitfield.
* @param _stream_context Stream context.
*/
@@ -257,6 +257,8 @@ extern "C" {
/**
* Check if an Object ID is valid for MCS.
* This differs from BT_OTS_VALID_OBJ_ID as MCS does not use the directory list object.
*
* @param id Object ID to validate.
*/
#define ESP_BLE_AUDIO_MCS_VALID_OBJ_ID(id) \
(IN_RANGE((id), BT_OTS_OBJ_ID_MIN, BT_OTS_OBJ_ID_MAX))
@@ -37,6 +37,8 @@ extern "C" {
* BIT(0) that represents index 0x01. To synchronize to e.g. BIS
* indexes 0x01 and 0x02, the bitfield value should be BIT(0) | BIT(1).
* As a general notation, to sync to BIS index N use BIT(N - 1).
*
* @param x BIS index (1-based).
*/
#define ESP_BLE_ISO_BIS_INDEX_BIT(x) BT_ISO_BIS_INDEX_BIT(x)
@@ -17,16 +17,66 @@
#include <../host/iso_internal.h>
#include "host/ble_gap.h"
#include "host/ble_store.h"
#include "services/gap/ble_svc_gap.h"
#include "common/host.h"
#include "common/app/gap.h"
#include "nimble/hs_error.h"
/* Map a NimBLE connection's security state to Zephyr bt_security_t.
*
* To reach L3/L4 the app must configure NimBLE for authenticated pairing:
* ble_hs_cfg.sm_mitm = 1;
* ble_hs_cfg.sm_io_cap = <non-NO_IO cap matching the peer>;
* (e.g. DISP_ONLY + KEYBOARD_ONLY -> Passkey Entry,
* DISP_YES_NO on both sides -> Numeric Compare)
* L4 additionally requires ble_hs_cfg.sm_sc = 1 (LE Secure Connections).
*
* ble_gap_sec_state does not expose an SC flag; without it we cannot tell
* legacy authenticated pairing apart from SC. Look up the peer's LTK record
* to read the persisted sc bit. If the lookup fails (not bonded, store
* unavailable) downgrade to L3 conservatively.
*/
static uint8_t nimble_desc_to_sec_level(const struct ble_gap_conn_desc *desc)
{
const struct ble_gap_sec_state *sec_state = &desc->sec_state;
struct ble_store_value_sec value = {0};
struct ble_store_key_sec key = {0};
int rc;
/* L1: !encrypted */
if (!sec_state->encrypted) {
return BT_SECURITY_L1;
}
/* L2: encrypted, unauthenticated (Just Works) */
if (!sec_state->authenticated) {
return BT_SECURITY_L2;
}
/* L3: encrypted, authenticated, key_size < 16 */
if (sec_state->key_size < 16) {
return BT_SECURITY_L3;
}
key.peer_addr = desc->peer_id_addr;
rc = ble_store_read_peer_sec(&key, &value);
if (rc != 0 || !value.sc) {
/* Cannot confirm SC -> conservatively L3 */
return BT_SECURITY_L3;
}
/* L4: encrypted, authenticated, 128-bit key, LE Secure Connections */
return BT_SECURITY_L4;
}
void bt_le_nimble_gap_post_event(void *param)
{
struct bt_le_gap_app_param *qev;
struct ble_gap_conn_desc desc;
struct ble_gap_event *ev;
struct bt_le_gap_app_param *qev = NULL;
struct ble_gap_conn_desc desc = {0};
struct ble_gap_event *ev = NULL;
int err;
qev = calloc(1, sizeof(*qev));
@@ -139,7 +189,8 @@ void bt_le_nimble_gap_post_event(void *param)
qev->security_change.conn_handle = ev->enc_change.conn_handle;
qev->security_change.role = desc.role;
qev->security_change.sec_level = BT_SECURITY_L3;
qev->security_change.sec_level = nimble_desc_to_sec_level(&desc);
qev->security_change.bonded = desc.sec_state.bonded;
qev->security_change.dst.type = desc.peer_id_addr.type;
memcpy(qev->security_change.dst.val, desc.peer_id_addr.val, BT_ADDR_SIZE);
}
@@ -191,15 +242,16 @@ int bt_le_nimble_scan_start(const struct bt_le_scan_param *param, ble_gap_event_
scan_param.passive = !param->type;
scan_param.filter_duplicates = 0;
return ble_gap_disc(BLE_OWN_ADDR_PUBLIC, BLE_HS_FOREVER, &scan_param, cb, NULL);
return nimble_err_to_errno(ble_gap_disc(BLE_OWN_ADDR_PUBLIC, BLE_HS_FOREVER,
&scan_param, cb, NULL));
}
int bt_le_nimble_scan_stop(void)
{
return ble_gap_disc_cancel();
return nimble_err_to_errno(ble_gap_disc_cancel());
}
int bt_le_nimble_iso_disconnect(uint16_t conn_handle, uint8_t reason)
{
return ble_gap_iso_disconnect(conn_handle, reason);
return nimble_err_to_errno(ble_gap_iso_disconnect(conn_handle, reason));
}
@@ -23,6 +23,8 @@
#include "host/ble_hs_mbuf.h"
#include "common/host.h"
#include "nimble/hs_error.h"
#include "common/app/gatt.h"
void bt_le_nimble_gatt_post_event(void *param)
@@ -418,7 +420,7 @@ int bt_le_nimble_gatts_notify(struct bt_conn *conn, struct bt_gatt_notify_params
{
LOG_DBG("[N]GattsNtf[%u]", conn ? conn->handle : UINT16_MAX);
return gatts_notify(conn, params);
return nimble_err_to_errno(gatts_notify(conn, params));
}
int bt_le_nimble_gatts_indicate(struct bt_conn *conn, struct bt_gatt_indicate_params *params)
@@ -514,7 +516,7 @@ int bt_le_nimble_gattc_write_without_rsp(struct bt_conn *conn, uint16_t handle,
{
LOG_DBG("[N]GattcWrCmd[%u][%u][%u]", conn->handle, handle, length);
return ble_gattc_write_no_rsp_flat(conn->handle, handle, data, length);
return nimble_err_to_errno(ble_gattc_write_no_rsp_flat(conn->handle, handle, data, length));
}
int bt_le_nimble_gattc_write_ccc(struct bt_conn *conn, struct bt_gatt_subscribe_params *params)
@@ -662,18 +662,33 @@ static int gattc_db_find_inc_svcs_cb_safe(uint16_t conn_handle,
if (error->status) {
if (error->status == BLE_HS_EDONE ||
error->status == BLE_HS_EINVAL) {
/* If a service of the remote GATT server:
* - Has an included service;
* - Only have 2 attributes, i.e. Service declaration and
* Include declaration;
* - Not the last service within the remote GATT database;
/* BLE_HS_EINVAL here is benign noise from NimBLE iteration,
* not a real failure. Root cause:
*
* These will cause BLE_HS_EINVAL returned while finding
* included services, mark the included service discovery
* as completed to prevent the discovery state machine from
* stalling.
* In ble_gattc_find_inc_svcs_rx_complete (ble_gattc.c), the
* end-of-procedure check is `prev_handle == 0xffff` only. If
* the last include attribute lands on the parent service's
* end_handle (e.g. a service with just decl + include), then
* prev_handle is bumped to end_handle and the resume path
* calls ble_att_clt_tx_read_type with [end+1, end] -- which
* fails its `start > end` guard with BLE_HS_EINVAL and prints
* E NimBLE: ble_att_clt_tx_read_type rc=3 <end+1> <end>
*
* Mark the included service discovery as completed.
* The proper upstream fix would be in ble_gattc.c:
*
* - if (proc->find_inc_svcs.prev_handle == 0xffff) {
* + if (proc->find_inc_svcs.prev_handle == 0xffff ||
* + proc->find_inc_svcs.prev_handle >=
* + proc->find_inc_svcs.end_handle) {
* // Procedure complete.
* ble_gattc_find_inc_svcs_cb(proc, BLE_HS_EDONE, 0, NULL);
* return BLE_HS_EDONE;
* }
*
* We keep NimBLE untouched and absorb the EINVAL here.
*
* Mark the included service discovery as completed so the
* state machine moves on instead of stalling.
*/
asvc->inc_svc_disc = 1;
@@ -1432,7 +1447,10 @@ void bt_le_nimble_gattc_db_remove(uint16_t conn_handle)
adb = gattc_db_find(conn_handle);
if (adb == NULL) {
LOG_WRN("[N]GattcDbNotFoundToRemove[%u]", conn_handle);
/* Legitimate when the conn never ran auto-disc (e.g. pairing failed
* or the app doesn't use GATT). Idempotent remove, not an error.
*/
LOG_DBG("[N]GattcDbNotFoundToRemove[%u]", conn_handle);
return;
}
@@ -24,6 +24,8 @@
#include "common/host.h"
#include "nimble/hs_error.h"
struct gatt_nrp_node {
uint8_t type;
@@ -703,7 +705,9 @@ static int gatt_nrp_insert(struct bt_conn *conn, uint8_t type, void *params)
LOG_DBG("[N]GattNrpAppend[%p]", nrp_node);
sys_slist_append(&nrp->list, &nrp_node->node);
} else {
LOG_ERR("[N]GattNrpInsertFail[%d]", rc);
if (rc != BLE_HS_ENOTCONN) {
LOG_ERR("[N]GattNrpInsertFail[%d]", rc);
}
free(nrp_node);
}
@@ -746,7 +750,8 @@ int bt_le_nimble_gatt_nrp_insert(struct bt_conn *conn, uint8_t type, void *param
} else {
rc = gatt_nrp_insert(conn, type, params);
}
return rc;
return nimble_err_to_errno(rc);
}
int bt_le_nimble_gatt_nrp_remove(struct bt_conn *conn, uint8_t type, void *params)
@@ -0,0 +1,74 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <errno.h>
#include "host/ble_hs.h"
/**
* Translate a NimBLE host error code (positive BLE_HS_* value from
* host/ble_hs.h) into a standard negative POSIX errno.
*
* Used at the adapter boundary to keep NimBLE-specific error codes out of
* common/ and lib code, which use standard Zephyr/POSIX errno conventions.
*
* Pass-through rules:
* - rc == 0: success, returned as-is
* - rc < 0: already in negative-errno form, returned as-is
* - rc >= 0x100: protocol-level error (ATT / HCI / L2CAP base) whose
* encoded class the caller may extract — returned as-is so
* the semantic information is preserved
* - 1..31: known NimBLE host codes, translated below
* - other: unknown NimBLE code, mapped to -EIO so it is not
* confused with a known POSIX errno
*/
static inline int nimble_err_to_errno(int rc)
{
if (rc <= 0) {
return rc;
}
if (rc >= 0x100) {
return rc;
}
switch (rc) {
case BLE_HS_EAGAIN: return -EAGAIN;
case BLE_HS_EALREADY: return -EALREADY;
case BLE_HS_EINVAL: return -EINVAL;
case BLE_HS_EMSGSIZE: return -EMSGSIZE;
case BLE_HS_ENOENT: return -ENOENT;
case BLE_HS_ENOMEM: return -ENOMEM;
case BLE_HS_ENOTCONN: return -ENOTCONN;
case BLE_HS_ENOTSUP: return -ENOTSUP;
case BLE_HS_EAPP: return -EPROTO;
case BLE_HS_EBADDATA: return -EBADMSG;
case BLE_HS_EOS: return -EIO;
case BLE_HS_ECONTROLLER: return -EIO;
case BLE_HS_ETIMEOUT: return -ETIMEDOUT;
case BLE_HS_EDONE: return -EALREADY;
case BLE_HS_EBUSY: return -EBUSY;
case BLE_HS_EREJECT: return -EACCES;
case BLE_HS_EUNKNOWN: return -EIO;
case BLE_HS_EROLE: return -EPERM;
case BLE_HS_ETIMEOUT_HCI: return -ETIMEDOUT;
case BLE_HS_ENOMEM_EVT: return -ENOMEM;
case BLE_HS_ENOADDR: return -EADDRNOTAVAIL;
case BLE_HS_ENOTSYNCED: return -EAGAIN;
case BLE_HS_EAUTHEN: return -EPERM;
case BLE_HS_EAUTHOR: return -EACCES;
case BLE_HS_EENCRYPT: return -EPERM;
case BLE_HS_EENCRYPT_KEY_SZ: return -EINVAL;
case BLE_HS_ESTORE_CAP: return -ENOSPC;
case BLE_HS_ESTORE_FAIL: return -EIO;
case BLE_HS_EPREEMPTED: return -EINTR;
case BLE_HS_EDISABLED: return -EPERM;
case BLE_HS_ESTALLED: return -EAGAIN; /* flow-control stall */
default: return -EIO;
}
}
@@ -19,6 +19,8 @@
#include "common/host.h"
#include "nimble/hs_error.h"
extern int ble_hs_iso_evt_rx_cb_set(void *cb);
#if CONFIG_BT_ISO_RX
extern int ble_hs_iso_pkt_rx_cb_set(ble_hs_iso_pkt_rx_fn cb);
@@ -705,54 +707,72 @@ int bt_le_nimble_iso_cmd_send_sync(uint16_t opcode,
struct net_buf *buf,
struct net_buf **rsp)
{
int rc;
switch (opcode) {
case BT_HCI_OP_LE_READ_ISO_TX_SYNC:
return hci_cmd_read_iso_tx_sync(buf, rsp);
rc = hci_cmd_read_iso_tx_sync(buf, rsp);
break;
case BT_HCI_OP_LE_SET_CIG_PARAMS:
return hci_cmd_set_cig_params(buf, rsp);
rc = hci_cmd_set_cig_params(buf, rsp);
break;
case BT_HCI_OP_LE_SET_CIG_PARAMS_TEST:
return hci_cmd_set_cig_params_test(buf, rsp);
rc = hci_cmd_set_cig_params_test(buf, rsp);
break;
case BT_HCI_OP_LE_CREATE_CIS:
return hci_cmd_create_cis(buf, rsp);
rc = hci_cmd_create_cis(buf, rsp);
break;
case BT_HCI_OP_LE_REMOVE_CIG:
return hci_cmd_remove_cig(buf, rsp);
rc = hci_cmd_remove_cig(buf, rsp);
break;
case BT_HCI_OP_LE_ACCEPT_CIS:
return hci_cmd_accept_cis_req(buf, rsp);
rc = hci_cmd_accept_cis_req(buf, rsp);
break;
case BT_HCI_OP_LE_REJECT_CIS:
return hci_cmd_reject_cis_req(buf, rsp);
rc = hci_cmd_reject_cis_req(buf, rsp);
break;
case BT_HCI_OP_LE_CREATE_BIG:
return hci_cmd_create_big(buf, rsp);
rc = hci_cmd_create_big(buf, rsp);
break;
case BT_HCI_OP_LE_CREATE_BIG_TEST:
return hci_cmd_create_big_test(buf, rsp);
rc = hci_cmd_create_big_test(buf, rsp);
break;
case BT_HCI_OP_LE_TERMINATE_BIG:
return hci_cmd_terminate_big(buf, rsp);
rc = hci_cmd_terminate_big(buf, rsp);
break;
case BT_HCI_OP_LE_BIG_CREATE_SYNC:
return hci_cmd_big_create_sync(buf, rsp);
rc = hci_cmd_big_create_sync(buf, rsp);
break;
case BT_HCI_OP_LE_BIG_TERMINATE_SYNC:
return hci_cmd_big_terminate_sync(buf, rsp);
rc = hci_cmd_big_terminate_sync(buf, rsp);
break;
case BT_HCI_OP_LE_SETUP_ISO_PATH:
return hci_cmd_setup_iso_data_path(buf, rsp);
rc = hci_cmd_setup_iso_data_path(buf, rsp);
break;
case BT_HCI_OP_LE_REMOVE_ISO_PATH:
return hci_cmd_remove_iso_data_path(buf, rsp);
rc = hci_cmd_remove_iso_data_path(buf, rsp);
break;
default:
LOG_ERR("[N]IsoCmdNotSupp[%04x]", opcode);
net_buf_unref(buf);
return -ENOTSUP;
}
return nimble_err_to_errno(rc);
}
static void iso_evt_rx(uint8_t event, const void *data,
@@ -23,6 +23,8 @@
#include "common/host.h"
#include "nimble/hs_error.h"
_Static_assert(CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM && "At least one L2CAP coc shall be supported");
#define OTS_L2CAP_BUF_COUNT (3 * CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM)
@@ -206,7 +208,7 @@ int bt_le_nimble_l2cap_chan_connect(uint16_t conn_handle)
LOG_ERR("[N]L2capConnectFail[%d]", rc);
os_mbuf_free_chain(sdu_rx);
return rc;
return nimble_err_to_errno(rc);
}
return 0;
@@ -230,7 +232,7 @@ int bt_le_nimble_l2cap_chan_disconnect(struct bt_l2cap_chan *chan)
rc = ble_l2cap_disconnect(ots_chan);
if (rc) {
LOG_ERR("[N]L2capDisconnectFail[%d]", rc);
return rc;
return nimble_err_to_errno(rc);
}
return 0;
@@ -268,16 +270,20 @@ int bt_le_nimble_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf
rc = ble_l2cap_send(ots_chan, sdu_tx);
if (rc) {
if (rc == BLE_HS_ESTALLED) {
/* TODO:
* Wait for the BLE_L2CAP_EVENT_COC_TX_UNSTALLED event and continue.
/* sdu is queued in tx->sdus[0]; NimBLE will continue on
* BLE_L2CAP_EVENT_COC_TX_UNSTALLED. Do NOT free here.
*/
LOG_WRN("[N]MoreCreditsForL2capSend");
} else if (rc == BLE_HS_EBADDATA || rc == BLE_HS_EBUSY) {
/* sdu was rejected before being queued; caller still owns it. */
LOG_ERR("[N]L2capSendFail[%d]", rc);
os_mbuf_free_chain(sdu_tx);
} else {
/* Internal error inside continue_tx; NimBLE already freed sdu. */
LOG_ERR("[N]L2capSendFail[%d]", rc);
}
os_mbuf_free_chain(sdu_tx);
return rc;
return nimble_err_to_errno(rc);
}
return 0;
@@ -275,7 +275,7 @@ struct bt_conn *bt_conn_new(struct bt_conn *conns, size_t size)
for (size_t i = 0; i < size; i++) {
struct bt_conn *conn = &conns[i];
if (conn->type == 0) {
if (conn->type == BT_CONN_TYPE_NONE) {
(void)memset(conn, 0, sizeof(struct bt_conn));
return conn;
}
@@ -460,12 +460,6 @@ static void iso_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
case BT_CONN_INITIATING:
break;
case BT_CONN_DISCONNECT_COMPLETE:
conn->type = 0;
/* Note:
* The bt_iso_disconnected is not called here, the ISO
* disconnected callback will be called by the ISO layer.
*/
/* bt_iso_disconnected(conn); */
break;
default:
break;
+85 -21
View File
@@ -279,7 +279,15 @@ static void foreach_attr_type_dyndb(uint16_t start_handle,
SYS_SLIST_FOR_EACH_CONTAINER(&gatt_db, svc, node) {
#if 0
/* Note: this check is not suitable for our Hosts */
/* Upstream Zephyr's "skip current service if next->attrs[0].handle
* <= start_handle" optimization assumes gatt_db is sorted by
* handle ascending. bt_gatt_service_register() here uses
* sys_slist_append() (registration order, not handle order), and
* NimBLE assigns handles internally, so that invariant doesn't
* hold -- this optimization would skip services that should be
* searched. Re-enable only after switching service registration
* to insert by handle.
*/
struct bt_gatt_service *next;
next = SYS_SLIST_PEEK_NEXT_CONTAINER(svc, node);
@@ -1029,6 +1037,35 @@ static struct gattc_sub *gattc_sub_add(struct bt_conn *conn)
return sub;
}
static void gattc_sub_clear(struct bt_conn *conn)
{
struct bt_gatt_subscribe_params *tmp = NULL;
struct gattc_sub *sub = NULL;
sub = gattc_sub_find(conn);
if (sub == NULL) {
return;
}
LOG_DBG("GattcSubClear[%s]", bt_addr_le_str(&sub->peer));
/* Reset each entry's handles and NOTIFY/INDICATE value so any state read
* from the params struct after disconnect reflects "not subscribed / no
* valid handles", then drop the nodes from the list. Dropping the nodes
* is what actually unblocks resubscription: bt_gatt_subscribe() rejects
* a params pointer that's still linked (tmp == params → -EALREADY), so
* without the list reset the CCCD write would never be reissued to the
* peer.
*/
SYS_SLIST_FOR_EACH_CONTAINER(&sub->list, tmp, node) {
tmp->value_handle = 0;
tmp->ccc_handle = 0;
tmp->end_handle = 0;
tmp->value = 0;
}
sys_slist_init(&sub->list);
}
_IDF_ONLY
struct gattc_sub *bt_gattc_sub_find(struct bt_conn *conn)
{
@@ -1109,34 +1146,33 @@ int bt_gatt_subscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *par
assert(params->ccc_handle == BT_GATT_AUTO_DISCOVER_CCC_HANDLE ||
(params->end_handle && params->disc_params));
LOG_DBG("GattcSub[%04x][%u][%u][%u]",
params->value, params->value_handle, params->ccc_handle, params->end_handle);
LOG_DBG("GattcSub[%u][%u][%u][%04x]",
params->value_handle, params->ccc_handle, params->end_handle, params->value);
/* Failures that return before sys_slist_append() reset
* params->value_handle, mirroring gattc_sub_clear() on
* disconnect, so callers gating retries on `value_handle == 0`
* can resubscribe.
*/
if (conn->state != BT_CONN_CONNECTED) {
LOG_ERR("NotConn[%d]", __LINE__);
params->value_handle = 0; /* unlinked: clear retry guard */
return -ENOTCONN;
}
sub = gattc_sub_add(conn);
if (sub == NULL) {
params->value_handle = 0; /* unlinked: clear retry guard */
return -ENOMEM;
}
#if 0
if (params->disc_params &&
params->disc_params->func == gattc_ccc_discover_cb) {
/* Already in progress */
LOG_ERR("GattcSubAlreadyInProgress[%u][%u][%u]",
params->ccc_handle, params->value_handle, params->end_handle);
return -EBUSY;
}
#endif
/* Lookup existing subscriptions */
SYS_SLIST_FOR_EACH_CONTAINER(&sub->list, tmp, node) {
/* Fail if entry already exists */
if (tmp == params) {
LOG_WRN("GattcSubExist[%u][%04x]", params->ccc_handle, params->value);
LOG_WRN("GattcSubExist[%u][%u][%04x]",
params->value_handle, params->ccc_handle, params->value);
/* live on sub->list: keep value_handle intact */
return -EALREADY;
}
@@ -1150,12 +1186,16 @@ int bt_gatt_subscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *par
}
}
LOG_INF("GattcHasSub[%u][%u][%u]",
params->value_handle, params->ccc_handle, has_subscription);
/* Skip write if already subscribed */
if (has_subscription == false) {
if (params->ccc_handle == BT_GATT_AUTO_DISCOVER_CCC_HANDLE) {
int err = gattc_ccc_discover(conn, params);
if (err) {
LOG_ERR("DiscCccFail[%d]", err);
params->value_handle = 0; /* unlinked: clear retry guard */
return err;
}
} else {
@@ -1238,7 +1278,13 @@ int bt_gatt_unsubscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *p
err = gattc_write_ccc(conn, params);
if (err) {
LOG_ERR("WrCccFail[%d]", err);
/* -ENOTCONN is expected on the disconnect race: upper layer saw the
* conn as still connected but the peer was already gone by the time
* the write was issued. Not a real failure.
*/
if (err != -ENOTCONN) {
LOG_ERR("WrCccFail[%d]", err);
}
return err;
}
}
@@ -1345,17 +1391,35 @@ int bt_gatt_write_without_response_cb(struct bt_conn *conn, uint16_t handle,
_LIB_ONLY
void bt_le_acl_conn_disconnected_gatt_listener(uint16_t conn_handle)
{
struct bt_conn *conn;
LOG_DBG("AclConnDisconnectedGattListener[%u]", conn_handle);
bt_le_nimble_gatt_nrp_clear(conn_handle);
/* Note:
* If the connection is disconnected, currently we will not delete
* the gatt client database.
* Hence after the connection is re-established, there is no need
* to re-discover the gatt client database which can save time.
* And the unsubscribe -> re-subscribe procedure is not needed.
/* Drop the cached GATT client database so the next connection runs a
* fresh discovery. This keeps the client resilient when the peer's
* bonding is lost (e.g., server reboot without persisted bonds) or its
* GATT structure changes across reconnects.
*
* TODO: preserve the cached DB across reconnects to the same bonded
* peer, and invalidate it only on a Service Changed indication. That
* saves the rediscovery round-trip but requires honoring CCCD caching
* and Service Changed handling end-to-end.
*/
bt_le_nimble_gattc_db_remove(conn_handle);
/* The cached DB is dropped above, so the app will rediscover and call
* bt_gatt_subscribe() again on reconnect with the BAP library's reused
* `bt_gatt_subscribe_params` pointers. Drop those nodes from the
* tracking list (and zero their value) so the duplicate check in
* bt_gatt_subscribe() doesn't short-circuit with -EALREADY, which
* would otherwise skip the CCCD write and starve notifications.
*/
conn = bt_le_acl_conn_find(conn_handle);
if (conn) {
gattc_sub_clear(conn);
}
}
void bt_le_gatt_handle_event(uint8_t *data, size_t data_len)
@@ -11,7 +11,7 @@
#include "sdkconfig.h"
#include "nimble/gatt/gatt.h"
#include "nimble/gatt.h"
#ifdef __cplusplus
extern "C" {
@@ -14,7 +14,7 @@
#include <zephyr/autoconf.h>
#include <zephyr/bluetooth/gatt.h>
#include "nimble/gatt/gatt.h"
#include "nimble/gatt.h"
#ifdef __cplusplus
extern "C" {
@@ -170,7 +170,7 @@ static const uint16_t ext_structs[] = {
sizeof(struct bt_bond_info),
};
#define LEA_VERSION (0x20260412)
#define LEA_VERSION (0x20260430)
struct lib_ext_cfgs {
/* BLE */
@@ -2049,10 +2049,6 @@ int bt_le_audio_init(void)
return err;
}
#if 0
lib_dymem_size_init();
#endif
printf(BT_ISO_LOG_COLOR_I "BLE Audio lib commit: [%s]" \
BT_ISO_LOG_RESET_COLOR "\n", lib_ext_commit_get());
@@ -454,6 +454,8 @@ static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason)
bt_iso_cleanup_acl(chan->iso);
if (conn_type == BT_ISO_CHAN_TYPE_PERIPHERAL) {
/* Release iso conn slot back to the pool. */
chan->iso->type = BT_CONN_TYPE_NONE;
bt_conn_unref(chan->iso);
chan->iso = NULL;
#if defined(CONFIG_BT_ISO_CENTRAL)
@@ -1745,6 +1747,8 @@ static void cleanup_cig(struct bt_iso_cig *cig)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&cig->cis_channels, cis, tmp, node) {
if (cis->iso != NULL) {
/* Release iso conn slot back to the pool. */
cis->iso->type = BT_CONN_TYPE_NONE;
bt_conn_unref(cis->iso);
cis->iso = NULL;
}
@@ -2403,6 +2407,8 @@ static void cleanup_big(struct bt_iso_big *big)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&big->bis_channels, bis, tmp, node) {
if (bis->iso != NULL) {
/* Release iso conn slot back to the pool. */
bis->iso->type = BT_CONN_TYPE_NONE;
bt_conn_unref(bis->iso);
bis->iso = NULL;
}
@@ -1261,7 +1261,7 @@ int bt_media_proxy_ctrl_get_search_results_id_safe(struct media_player *player);
*
* @return 0 if success, errno on failure.
*/
uint8_t bt_media_proxy_ctrl_get_content_ctrl_id_safe(struct media_player *player);
int bt_media_proxy_ctrl_get_content_ctrl_id_safe(struct media_player *player);
/**
* @brief Available calls in a player, that the media proxy can call
@@ -35,6 +35,8 @@ struct bt_conn;
/** Connection Type */
enum __packed bt_conn_type {
/** No Connection Type (free slot marker) */
BT_CONN_TYPE_NONE = 0,
/** LE Connection Type */
BT_CONN_TYPE_LE = BIT(0),
/** ISO Connection Type */
@@ -24,9 +24,6 @@ extern int lib_ext_structs_check(const uint16_t *ext_structs, size_t size_struct
extern int lib_ext_cfgs_set(const struct lib_ext_cfgs *ext_cfgs, size_t size_cfgs);
extern int lib_ext_funcs_set(const struct lib_ext_funcs *ext_funcs, size_t size_funcs);
extern int lib_funcs_set(const struct lib_funcs *funcs, size_t size_funcs);
#if 0
extern void lib_dymem_size_init(void);
#endif
extern const char *lib_ext_commit_get(void);
struct bt_aics;