From 3c67d49258ca60aea6fb2d14932e46efa0f4dba4 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 16 Oct 2025 15:36:13 -0400 Subject: [PATCH] shared/bap: Add bt_bap_get_db This adds bt_bap_get_db which can be used to access the gatt_db passed to bt_bap_new. --- src/shared/bap.c | 11 +++++++++++ src/shared/bap.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index fd52db316..c56429751 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -4653,6 +4653,17 @@ struct bt_att *bt_bap_get_att(struct bt_bap *bap) return bt_gatt_client_get_att(bap->client); } +struct gatt_db *bt_bap_get_db(struct bt_bap *bap, bool remote) +{ + if (!bap) + return NULL; + + if (remote) + return bap->rdb ? bap->rdb->db : NULL; + + return bap->ldb ? bap->ldb->db : NULL; +} + struct bt_bap *bt_bap_ref(struct bt_bap *bap) { if (!bap) diff --git a/src/shared/bap.h b/src/shared/bap.h index fba8b6b17..efeed604d 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -128,6 +128,8 @@ void *bt_bap_get_user_data(struct bt_bap *bap); struct bt_att *bt_bap_get_att(struct bt_bap *bap); +struct gatt_db *bt_bap_get_db(struct bt_bap *bap, bool remote); + struct bt_bap *bt_bap_ref(struct bt_bap *bap); void bt_bap_unref(struct bt_bap *bap); -- 2.47.3