public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG:
@ 2026-01-23 11:21 Prathibha Madugonde
  2026-01-23 11:41 ` [BlueZ] " bluez.test.bot
  2026-01-23 13:28 ` [PATCH BlueZ] " Bastien Nocera
  0 siblings, 2 replies; 4+ messages in thread
From: Prathibha Madugonde @ 2026-01-23 11:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, quic_mohamull, quic_hbandi, quic_anubhavg

Add RAS service, characteristics, and descriptors to the local GATT DB
Implement server-side callbacks for RAS Features, Procedure Data,
Data Ready and Data Overwritten characteristics
Add client-side session handling, notification registration and
ready callbacks
Wire RAS attachment/detachment to ATT/GATT client and server
---
 Makefile.am      |   4 +-
 src/shared/rap.c | 874 +++++++++++++++++++++++++++++++++++++++++++++++
 src/shared/rap.h |  48 +++
 3 files changed, 925 insertions(+), 1 deletion(-)
 create mode 100644 src/shared/rap.c
 create mode 100644 src/shared/rap.h

diff --git a/Makefile.am b/Makefile.am
index 2217bcf15..cff5cc034 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -248,7 +248,9 @@ shared_sources = src/shared/io.h src/shared/timeout.h \
 			src/shared/bap-defs.h \
 			src/shared/asha.h src/shared/asha.c \
 			src/shared/battery.h src/shared/battery.c \
-			src/shared/uinput.h src/shared/uinput.c
+			src/shared/uinput.h src/shared/uinput.c \
+			src/shared/rap.h src/shared/rap.c
+
 
 if READLINE
 shared_sources += src/shared/shell.c src/shared/shell.h
diff --git a/src/shared/rap.c b/src/shared/rap.c
new file mode 100644
index 000000000..605963c92
--- /dev/null
+++ b/src/shared/rap.c
@@ -0,0 +1,874 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#define _GNU_SOURCE
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <errno.h>
+#include <glib.h>
+
+#include "bluetooth/bluetooth.h"
+#include "bluetooth/uuid.h"
+
+#include "src/shared/queue.h"
+#include "src/shared/util.h"
+#include "src/shared/timeout.h"
+#include "src/shared/att.h"
+#include "src/shared/gatt-db.h"
+#include "src/shared/gatt-server.h"
+#include "src/shared/gatt-client.h"
+#include "src/shared/rap.h"
+
+#define DBG(_rap, fmt, arg...) \
+	rap_debug(_rap, "%s:%s() " fmt, __FILE__, __func__, ## arg)
+
+#define RAS_UUID16			0x185B
+
+/* Total number of attribute handles reserved for the RAS service */
+#define RAS_TOTAL_NUM_HANDLES		18
+
+/* Ranging Service context */
+struct ras {
+	struct bt_rap_db *rapdb;
+
+	/* Service and characteristic attributes */
+	struct gatt_db_attribute *svc;
+	struct gatt_db_attribute *feat_chrc;
+	struct gatt_db_attribute *realtime_chrc;
+	struct gatt_db_attribute *realtime_chrc_ccc;
+	struct gatt_db_attribute *ondemand_chrc;
+	struct gatt_db_attribute *cp_chrc;
+	struct gatt_db_attribute *ready_chrc;
+	struct gatt_db_attribute *overwritten_chrc;
+};
+
+struct bt_rap_db {
+	struct gatt_db *db;
+	struct ras *ras;
+};
+
+struct bt_rap {
+	int ref_count;
+	struct bt_rap_db *lrapdb;
+	struct bt_rap_db *rrapdb;
+	struct bt_gatt_client *client;
+	struct bt_att *att;
+
+	unsigned int idle_id;
+
+	struct queue *notify;
+	struct queue *pending;
+	struct queue *ready_cbs;
+
+	bt_rap_debug_func_t debug_func;
+	bt_rap_destroy_func_t debug_destroy;
+	void *debug_data;
+	void *user_data;
+};
+
+static struct queue *rap_db;
+static struct queue *bt_rap_cbs;
+static struct queue *sessions;
+
+struct bt_rap_cb {
+	unsigned int id;
+	bt_rap_func_t attached;
+	bt_rap_func_t detached;
+	void *user_data;
+};
+
+typedef void (*rap_func_t)(struct bt_rap *rap, bool success,
+			   uint8_t att_ecode, const uint8_t *value,
+			   uint16_t length, void *user_data);
+
+struct bt_rap_pending {
+	unsigned int id;
+	struct bt_rap *rap;
+	rap_func_t func;
+	void *userdata;
+};
+
+struct bt_rap_ready {
+	unsigned int id;
+	bt_rap_ready_func_t func;
+	bt_rap_destroy_func_t destroy;
+	void *data;
+};
+
+typedef void (*rap_notify_t)(struct bt_rap *rap, uint16_t value_handle,
+			     const uint8_t *value, uint16_t length,
+			     void *user_data);
+
+struct bt_rap_notify {
+	unsigned int id;
+	struct bt_rap *rap;
+	rap_notify_t func;
+	void *user_data;
+};
+
+static bool real_time_enabled;
+static bool on_demand_enabled;
+struct gatt_db_attribute *global_real_time_char;
+struct gatt_db_attribute *global_on_demand_char;
+struct gatt_db_attribute *global_data_ready_char;
+struct gatt_db_attribute *global_data_overwritten_char;
+struct gatt_db_attribute *global_control_point_char;
+
+static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
+{
+	if (!rap)
+		return NULL;
+
+	if (rap->lrapdb)
+		return rap->lrapdb;
+
+	return NULL;
+}
+
+struct ras *rap_get_ras(struct bt_rap *rap)
+{
+	if (!rap)
+		return NULL;
+
+	if (rap->rrapdb->ras)
+		return rap->rrapdb->ras;
+
+	rap->rrapdb->ras = new0(struct ras, 1);
+	rap->rrapdb->ras->rapdb = rap->rrapdb;
+
+	return rap->rrapdb->ras;
+}
+
+static void rap_detached(void *data, void *user_data)
+{
+	struct bt_rap_cb *cb = data;
+	struct bt_rap *rap = user_data;
+
+	cb->detached(rap, cb->user_data);
+}
+
+void bt_rap_detach(struct bt_rap *rap)
+{
+	if (!queue_remove(sessions, rap))
+		return;
+
+	bt_gatt_client_idle_unregister(rap->client, rap->idle_id);
+	bt_gatt_client_unref(rap->client);
+	rap->client = NULL;
+
+	queue_foreach(bt_rap_cbs, rap_detached, rap);
+}
+
+static void rap_db_free(void *data)
+{
+	struct bt_rap_db *rapdb = data;
+
+	if (!rapdb)
+		return;
+
+	gatt_db_unref(rapdb->db);
+
+	free(rapdb->ras);
+	free(rapdb);
+}
+
+static void rap_ready_free(void *data)
+{
+	struct bt_rap_ready *ready = data;
+
+	if (ready->destroy)
+		ready->destroy(ready->data);
+
+	free(ready);
+}
+
+static void rap_free(void *data)
+{
+	struct bt_rap *rap = data;
+
+	bt_rap_detach(rap);
+
+	rap_db_free(rap->rrapdb);
+
+	queue_destroy(rap->notify, free);
+	queue_destroy(rap->pending, NULL);
+	queue_destroy(rap->ready_cbs, rap_ready_free);
+
+	free(rap);
+}
+
+bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data)
+{
+	if (!rap)
+		return false;
+
+	rap->user_data = user_data;
+
+	return true;
+}
+
+static bool rap_db_match(const void *data, const void *match_data)
+{
+	const struct bt_rap_db *rapdb = data;
+	const struct gatt_db *db = match_data;
+
+	return rapdb->db == db;
+}
+
+struct bt_att *bt_rap_get_att(struct bt_rap *rap)
+{
+	if (!rap)
+		return NULL;
+
+	if (rap->att)
+		return rap->att;
+
+	return bt_gatt_client_get_att(rap->client);
+}
+
+struct bt_rap *bt_rap_ref(struct bt_rap *rap)
+{
+	if (!rap)
+		return NULL;
+
+	__sync_fetch_and_add(&rap->ref_count, 1);
+
+	return rap;
+}
+
+void bt_rap_unref(struct bt_rap *rap)
+{
+	if (!rap)
+		return;
+
+	if (__sync_sub_and_fetch(&rap->ref_count, 1))
+		return;
+
+	rap_free(rap);
+}
+
+static void rap_debug(struct bt_rap *rap, const char *format, ...)
+{
+	va_list ap;
+
+	if (!rap || !format || !rap->debug_func)
+		return;
+
+	va_start(ap, format);
+	util_debug_va(rap->debug_func, rap->debug_data, format, ap);
+	va_end(ap);
+}
+
+bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
+			void *user_data, bt_rap_destroy_func_t destroy)
+{
+	if (!rap)
+		return false;
+
+	if (rap->debug_destroy)
+		rap->debug_destroy(rap->debug_data);
+
+	rap->debug_func = func;
+	rap->debug_destroy = destroy;
+	rap->debug_data = user_data;
+
+	return true;
+}
+
+static void ras_features_read_cb(struct gatt_db_attribute *attrib,
+				 unsigned int id, uint16_t offset,
+				 uint8_t opcode, struct bt_att *att,
+				 void *user_data)
+{
+	/*
+	 * Feature mask: bits 0-2 set:
+	 *  - Real-time ranging
+	 *  - Retrieve stored results
+	 *  - Abort operation
+	 */
+	uint8_t value[4] = { 0x01, 0x00, 0x00, 0x00 };
+
+	gatt_db_attribute_read_result(attrib, id, 0, value, sizeof(value));
+}
+
+static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
+				 unsigned int id, uint16_t offset,
+				 uint8_t opcode, struct bt_att *att,
+				 void *user_data)
+{
+	/* No static read data; real-time data is provided via notifications. */
+	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
+}
+
+static void ras_ondemand_read_cb(struct gatt_db_attribute *attrib,
+				 unsigned int id, uint16_t offset,
+				 uint8_t opcode, struct bt_att *att,
+				 void *user_data)
+{
+	/* No static read data – on‑demand data is pushed via
+	 * notifications
+	 */
+	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
+}
+
+/*
+ * Control point handler.
+ * Parses the opcode and acts on queued data (implementation TBD).
+ */
+static void ras_control_point_write_cb(struct gatt_db_attribute *attrib,
+				       unsigned int id, uint16_t offset,
+				       const uint8_t *value, size_t len,
+				       uint8_t opcode, struct bt_att *att,
+				       void *user_data)
+{
+	/* Control point handler - implementation TBD */
+}
+
+/* Data Ready – returns the latest ranging counter. */
+static void ras_data_ready_read_cb(struct gatt_db_attribute *attrib,
+				   unsigned int id, uint16_t offset,
+				   uint8_t opcode, struct bt_att *att,
+				   void *user_data)
+{
+	uint16_t counter = 0;
+	uint8_t value[2];
+
+	put_le16(counter, value);
+	gatt_db_attribute_read_result(attrib, id, 0, value, sizeof(value));
+}
+
+/* Data Overwritten – indicates how many results were overwritten. */
+static void ras_data_overwritten_read_cb(struct gatt_db_attribute *attrib,
+					 unsigned int id, uint16_t offset,
+					 uint8_t opcode, struct bt_att *att,
+					 void *user_data)
+{
+	uint8_t value[2] = { 0x00, 0x00 };
+
+	gatt_db_attribute_read_result(attrib, id, 0, value, sizeof(value));
+}
+
+/* Service registration – store attribute pointers */
+static struct ras *register_ras_service(struct gatt_db *db)
+{
+	struct ras *ras;
+	struct gatt_db_attribute *service;
+	bt_uuid_t uuid;
+
+	if (!db)
+		return NULL;
+
+	ras = new0(struct ras, 1);
+	if (!ras)
+		return NULL;
+
+	/* Primary RAS service */
+	bt_uuid16_create(&uuid, RAS_UUID16);
+	service = gatt_db_add_service(db, &uuid, true, RAS_TOTAL_NUM_HANDLES);
+	if (!service) {
+		free(ras);
+		return NULL;
+	}
+
+	ras->svc = service;
+
+	/* RAS Features */
+	bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
+		ras->feat_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_READ |
+						  BT_ATT_PERM_READ_ENCRYPT,
+						  BT_GATT_CHRC_PROP_READ,
+						  ras_features_read_cb,
+						  NULL, ras);
+
+	/* Real-time Ranging Data */
+	bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
+	ras->realtime_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_READ |
+						  BT_ATT_PERM_READ_ENCRYPT,
+						  BT_GATT_CHRC_PROP_NOTIFY |
+						  BT_GATT_CHRC_PROP_INDICATE,
+						  NULL, NULL, ras);
+
+	ras->realtime_chrc_ccc =
+		gatt_db_service_add_ccc(ras->svc,
+					BT_ATT_PERM_READ |
+					BT_ATT_PERM_WRITE);
+
+	/* On-demand Ranging Data */
+	bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
+	ras->ondemand_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_READ |
+						  BT_ATT_PERM_READ_ENCRYPT,
+						  BT_GATT_CHRC_PROP_NOTIFY |
+						  BT_GATT_CHRC_PROP_INDICATE,
+						  ras_ondemand_read_cb, NULL,
+						  ras);
+
+	gatt_db_service_add_ccc(ras->svc,
+				BT_ATT_PERM_READ | BT_ATT_PERM_WRITE);
+
+	/* RAS Control Point */
+	bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
+	ras->cp_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_WRITE |
+						  BT_ATT_PERM_WRITE_ENCRYPT,
+				BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP |
+						  BT_GATT_CHRC_PROP_INDICATE,
+						  NULL,
+						  ras_control_point_write_cb,
+						  ras);
+
+	gatt_db_service_add_ccc(ras->svc,
+				BT_ATT_PERM_READ | BT_ATT_PERM_WRITE);
+
+	/* RAS Data Ready */
+	bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
+	ras->ready_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_READ |
+						  BT_ATT_PERM_READ_ENCRYPT,
+						  BT_GATT_CHRC_PROP_READ |
+						  BT_GATT_CHRC_PROP_NOTIFY |
+						  BT_GATT_CHRC_PROP_INDICATE,
+						  ras_data_ready_read_cb, NULL,
+						  ras);
+
+	gatt_db_service_add_ccc(ras->svc,
+				BT_ATT_PERM_READ | BT_ATT_PERM_WRITE);
+
+	/* RAS Data Overwritten */
+	bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
+	ras->overwritten_chrc =
+		gatt_db_service_add_characteristic(ras->svc, &uuid,
+						  BT_ATT_PERM_READ |
+						  BT_ATT_PERM_READ_ENCRYPT,
+						  BT_GATT_CHRC_PROP_READ |
+						  BT_GATT_CHRC_PROP_NOTIFY |
+						  BT_GATT_CHRC_PROP_INDICATE,
+						  ras_data_overwritten_read_cb,
+						  NULL, ras);
+
+	gatt_db_service_add_ccc(ras->svc,
+				BT_ATT_PERM_READ | BT_ATT_PERM_WRITE);
+
+	/* Activate the service */
+	gatt_db_service_set_active(ras->svc, true);
+
+	return ras;
+}
+
+static struct bt_rap_db *rap_db_new(struct gatt_db *db)
+{
+	struct bt_rap_db *rapdb;
+
+	if (!db)
+		return NULL;
+
+	rapdb = new0(struct bt_rap_db, 1);
+	if (!rapdb)
+		return NULL;
+
+	rapdb->db = gatt_db_ref(db);
+
+	if (!rap_db)
+		rap_db = queue_new();
+
+	rapdb->ras = register_ras_service(db);
+	if (rapdb->ras)
+		rapdb->ras->rapdb = rapdb;
+
+	queue_push_tail(rap_db, rapdb);
+
+	return rapdb;
+}
+
+static struct bt_rap_db *rap_get_db(struct gatt_db *db)
+{
+	struct bt_rap_db *rapdb;
+
+	rapdb = queue_find(rap_db, rap_db_match, db);
+	if (rapdb)
+		return rapdb;
+
+	return rap_db_new(db);
+}
+
+void bt_rap_add_db(struct gatt_db *db)
+{
+	rap_db_new(db);
+}
+
+unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t detached,
+			     void *user_data)
+{
+	struct bt_rap_cb *cb;
+	static unsigned int id;
+
+	if (!attached && !detached)
+		return 0;
+
+	if (!bt_rap_cbs)
+		bt_rap_cbs = queue_new();
+
+	cb = new0(struct bt_rap_cb, 1);
+	cb->id = ++id ? id : ++id;
+	cb->attached = attached;
+	cb->detached = detached;
+	cb->user_data = user_data;
+
+	queue_push_tail(bt_rap_cbs, cb);
+
+	return cb->id;
+}
+
+static bool match_id(const void *data, const void *match_data)
+{
+	const struct bt_rap_cb *cb = data;
+	unsigned int id = PTR_TO_UINT(match_data);
+
+	return cb->id == id;
+}
+
+bool bt_rap_unregister(unsigned int id)
+{
+	struct bt_rap_cb *cb;
+
+	cb = queue_remove_if(bt_rap_cbs, match_id, UINT_TO_PTR(id));
+	if (!cb)
+		return false;
+
+	free(cb);
+
+	return true;
+}
+
+struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb)
+{
+	struct bt_rap *rap;
+	struct bt_rap_db *rapdb;
+
+	if (!ldb)
+		return NULL;
+
+	rapdb = rap_get_db(ldb);
+	if (!rapdb)
+		return NULL;
+
+	rap = new0(struct bt_rap, 1);
+	rap->lrapdb = rapdb;
+	rap->pending = queue_new();
+	rap->ready_cbs = queue_new();
+	rap->notify = queue_new();
+
+	if (!rdb)
+		goto done;
+
+	rapdb = new0(struct bt_rap_db, 1);
+	rapdb->db = gatt_db_ref(rdb);
+
+	rap->rrapdb = rapdb;
+
+done:
+	bt_rap_ref(rap);
+
+	return rap;
+}
+
+static void rap_pending_destroy(void *data)
+{
+	struct bt_rap_pending *pending = data;
+	struct bt_rap *rap = pending->rap;
+
+	if (queue_remove_if(rap->pending, NULL, pending))
+		free(pending);
+}
+
+static void rap_pending_complete(bool success, uint8_t att_ecode,
+				 const uint8_t *value, uint16_t length,
+				 void *user_data)
+{
+	struct bt_rap_pending *pending = user_data;
+
+	if (pending->func)
+		pending->func(pending->rap, success, att_ecode, value,
+			      length, pending->userdata);
+}
+
+static void rap_register(uint16_t att_ecode, void *user_data)
+{
+	struct bt_rap_notify *notify = user_data;
+
+	if (att_ecode)
+		DBG(notify->rap, "RAS register failed 0x%04x", att_ecode);
+}
+
+static void rap_notify(uint16_t value_handle, const uint8_t *value,
+		       uint16_t length, void *user_data)
+{
+	struct bt_rap_notify *notify = user_data;
+
+	if (notify->func)
+		notify->func(notify->rap, value_handle, value, length,
+			     notify->user_data);
+}
+
+static void rap_notify_destroy(void *data)
+{
+	struct bt_rap_notify *notify = data;
+	struct bt_rap *rap = notify->rap;
+
+	if (queue_remove_if(rap->notify, NULL, notify))
+		free(notify);
+}
+
+static unsigned int bt_rap_register_notify(struct bt_rap *rap,
+					   uint16_t value_handle,
+					   rap_notify_t func,
+					   void *user_data)
+{
+	struct bt_rap_notify *notify;
+
+	notify = new0(struct bt_rap_notify, 1);
+	notify->rap = rap;
+	notify->func = func;
+	notify->user_data = user_data;
+
+	notify->id = bt_gatt_client_register_notify(rap->client,
+						    value_handle,
+						    rap_register,
+						    rap_notify,
+						    notify,
+						    rap_notify_destroy);
+	if (!notify->id) {
+		DBG(rap, "Unable to register for notifications");
+		free(notify);
+		return 0;
+	}
+
+	queue_push_tail(rap->notify, notify);
+
+	return notify->id;
+}
+
+static void foreach_rap_char(struct gatt_db_attribute *attr, void *user_data)
+{
+	struct bt_rap *rap = user_data;
+	uint16_t value_handle;
+	bt_uuid_t uuid;
+	bt_uuid_t uuid_features;
+	bt_uuid_t uuid_realtime;
+	bt_uuid_t uuid_ondemand;
+	bt_uuid_t uuid_cp;
+	bt_uuid_t uuid_dataready;
+	bt_uuid_t uuid_overwritten;
+	struct ras *ras;
+
+	if (!gatt_db_attribute_get_char_data(attr, NULL, &value_handle,
+					     NULL, NULL, &uuid))
+		return;
+
+	bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
+	bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
+	bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
+	bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
+	bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
+	bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
+
+	if (!bt_uuid_cmp(&uuid, &uuid_features)) {
+		DBG(rap, "Features characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->feat_chrc)
+			return;
+
+		ras->feat_chrc = attr;
+	}
+
+	if (!bt_uuid_cmp(&uuid, &uuid_realtime)) {
+		DBG(rap, "Real Time Data characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->realtime_chrc)
+			return;
+
+		ras->realtime_chrc = attr;
+	}
+
+	if (!bt_uuid_cmp(&uuid, &uuid_ondemand)) {
+		DBG(rap, "On-demand Data characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->ondemand_chrc)
+			return;
+
+		ras->ondemand_chrc = attr;
+	}
+
+	if (!bt_uuid_cmp(&uuid, &uuid_cp)) {
+		DBG(rap, "Control Point characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->cp_chrc)
+			return;
+
+		ras->cp_chrc = attr;
+	}
+
+	if (!bt_uuid_cmp(&uuid, &uuid_dataready)) {
+		DBG(rap, "Data Ready characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->ready_chrc)
+			return;
+
+		ras->ready_chrc = attr;
+	}
+
+	if (!bt_uuid_cmp(&uuid, &uuid_overwritten)) {
+		DBG(rap, "Overwritten characteristic found: handle 0x%04x",
+		    value_handle);
+
+		ras = rap_get_ras(rap);
+		if (!ras || ras->overwritten_chrc)
+			return;
+
+		ras->overwritten_chrc = attr;
+	}
+}
+
+static void foreach_rap_service(struct gatt_db_attribute *attr,
+				void *user_data)
+{
+	struct bt_rap *rap = user_data;
+	struct ras *ras = rap_get_ras(rap);
+
+	ras->svc = attr;
+
+	gatt_db_service_set_claimed(attr, true);
+
+	gatt_db_service_foreach_char(attr, foreach_rap_char, rap);
+}
+
+unsigned int bt_rap_ready_register(struct bt_rap *rap,
+				   bt_rap_ready_func_t func, void *user_data,
+				   bt_rap_destroy_func_t destroy)
+{
+	struct bt_rap_ready *ready;
+	static unsigned int id;
+
+	if (!rap)
+		return 0;
+
+	DBG(rap, "bt_rap_ready_register");
+
+	ready = new0(struct bt_rap_ready, 1);
+	ready->id = ++id ? id : ++id;
+	ready->func = func;
+	ready->destroy = destroy;
+	ready->data = user_data;
+
+	queue_push_tail(rap->ready_cbs, ready);
+
+	return ready->id;
+}
+
+static bool match_ready_id(const void *data, const void *match_data)
+{
+	const struct bt_rap_ready *ready = data;
+	unsigned int id = PTR_TO_UINT(match_data);
+
+	return ready->id == id;
+}
+
+bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id)
+{
+	struct bt_rap_ready *ready;
+
+	ready = queue_remove_if(rap->ready_cbs, match_ready_id,
+				UINT_TO_PTR(id));
+	if (!ready)
+		return false;
+
+	rap_ready_free(ready);
+
+	return true;
+}
+
+static struct bt_rap *bt_rap_ref_safe(struct bt_rap *rap)
+{
+	if (!rap || !rap->ref_count)
+		return NULL;
+
+	return bt_rap_ref(rap);
+}
+
+static void rap_notify_ready(struct bt_rap *rap)
+{
+	const struct queue_entry *entry;
+
+	if (!bt_rap_ref_safe(rap))
+		return;
+
+	for (entry = queue_get_entries(rap->ready_cbs); entry;
+	     entry = entry->next) {
+		struct bt_rap_ready *ready = entry->data;
+
+		ready->func(rap, ready->data);
+	}
+
+	bt_rap_unref(rap);
+}
+
+static void rap_idle(void *data)
+{
+	struct bt_rap *rap = data;
+
+	rap->idle_id = 0;
+	rap_notify_ready(rap);
+}
+
+bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client *client)
+{
+	bt_uuid_t uuid;
+
+	if (!sessions)
+		sessions = queue_new();
+
+	queue_push_tail(sessions, rap);
+
+	if (!client)
+		return true;
+
+	if (rap->client)
+		return false;
+
+	rap->client = bt_gatt_client_clone(client);
+	if (!rap->client)
+		return false;
+
+	bt_gatt_client_idle_register(rap->client, rap_idle, rap, NULL);
+
+	bt_uuid16_create(&uuid, RAS_UUID16);
+
+	gatt_db_foreach_service(rap->lrapdb->db, &uuid,
+				foreach_rap_service, rap);
+
+	return true;
+}
diff --git a/src/shared/rap.h b/src/shared/rap.h
new file mode 100644
index 000000000..488172ac6
--- /dev/null
+++ b/src/shared/rap.h
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+#include "src/shared/io.h"
+#include "src/shared/gatt-client.h"
+#include "src/shared/gatt-server.h"
+
+
+struct bt_rap;
+
+typedef void (*bt_rap_debug_func_t)(const char *str, void *user_data);
+typedef void (*bt_rap_ready_func_t)(struct bt_rap *rap, void *user_data);
+typedef void (*bt_rap_destroy_func_t)(void *user_data);
+typedef void (*bt_rap_func_t)(struct bt_rap *rap, void *user_data);
+
+struct bt_rap *bt_rap_ref(struct bt_rap *rap);
+void bt_rap_unref(struct bt_rap *rap);
+
+void bt_rap_add_db(struct gatt_db *db);
+
+bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client *client);
+void bt_rap_detach(struct bt_rap *rap);
+
+struct bt_att *bt_rap_get_att(struct bt_rap *rap);
+
+bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data);
+
+bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
+			void *user_data, bt_rap_destroy_func_t destroy);
+
+/* session related functions */
+unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t detached,
+					void *user_data);
+unsigned int bt_rap_ready_register(struct bt_rap *rap,
+				bt_rap_ready_func_t func, void *user_data,
+				bt_rap_destroy_func_t destroy);
+bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id);
+
+bool bt_rap_unregister(unsigned int id);
+
+struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG:
  2026-01-23 11:21 [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG: Prathibha Madugonde
@ 2026-01-23 11:41 ` bluez.test.bot
  2026-01-23 13:28 ` [PATCH BlueZ] " Bastien Nocera
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-01-23 11:41 UTC (permalink / raw)
  To: linux-bluetooth, prathibha.madugonde

[-- Attachment #1: Type: text/plain, Size: 181724 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1046224

---Test result---

Test Summary:
CheckPatch                    PENDING   0.30 seconds
GitLint                       PENDING   0.26 seconds
BuildEll                      PASS      20.09 seconds
BluezMake                     FAIL      19.07 seconds
MakeCheck                     FAIL      42.28 seconds
MakeDistcheck                 FAIL      36.08 seconds
CheckValgrind                 FAIL      15.65 seconds
CheckSmatch                   FAIL      21.94 seconds
bluezmakeextell               FAIL      13.63 seconds
IncrementalBuild              PENDING   0.32 seconds
ScanBuild                     FAIL      33.95 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4260: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7759: src/shared/libshared_glib_la-rap.lo] Error 1
make: *** [Makefile:11069: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

../../src/shared/rap.c: In function ‘register_ras_service’:
../../src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
../../src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
../../src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
../../src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c: In function ‘foreach_rap_char’:
../../src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
../../src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
../../src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
../../src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4260: all] Error 2
make: *** [Makefile:10990: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:11069: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:312:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4260: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4260: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:

##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:

src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1697:56: warning: Use of memory after it is freed
        notify_data->chrc->ccc_write_id = notify_data->att_id = att_id;
                                          ~~~~~~~~~~~~~~~~~~~ ^
src/shared/gatt-client.c:2150:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2158:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3183:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3205:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
13 warnings generated.
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:19:24: error: redundant redeclaration of ‘bt_gatt_client_new’ [-Werror=redundant-decls]
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:19:24: note: previous declaration of ‘bt_gatt_client_new’ was here
   19 | struct bt_gatt_client *bt_gatt_client_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:23:24: error: redundant redeclaration of ‘bt_gatt_client_clone’ [-Werror=redundant-decls]
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:23:24: note: previous declaration of ‘bt_gatt_client_clone’ was here
   23 | struct bt_gatt_client *bt_gatt_client_clone(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:25:24: error: redundant redeclaration of ‘bt_gatt_client_ref’ [-Werror=redundant-decls]
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:25:24: note: previous declaration of ‘bt_gatt_client_ref’ was here
   25 | struct bt_gatt_client *bt_gatt_client_ref(struct bt_gatt_client *client);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:26:6: error: redundant redeclaration of ‘bt_gatt_client_unref’ [-Werror=redundant-decls]
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:26:6: note: previous declaration of ‘bt_gatt_client_unref’ was here
   26 | void bt_gatt_client_unref(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:48:6: error: redundant redeclaration of ‘bt_gatt_client_is_ready’ [-Werror=redundant-decls]
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:48:6: note: previous declaration of ‘bt_gatt_client_is_ready’ was here
   48 | bool bt_gatt_client_is_ready(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:49:14: error: redundant redeclaration of ‘bt_gatt_client_ready_register’ [-Werror=redundant-decls]
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:49:14: note: previous declaration of ‘bt_gatt_client_ready_register’ was here
   49 | unsigned int bt_gatt_client_ready_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:53:6: error: redundant redeclaration of ‘bt_gatt_client_ready_unregister’ [-Werror=redundant-decls]
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:53:6: note: previous declaration of ‘bt_gatt_client_ready_unregister’ was here
   53 | bool bt_gatt_client_ready_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:55:6: error: redundant redeclaration of ‘bt_gatt_client_set_service_changed’ [-Werror=redundant-decls]
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:55:6: note: previous declaration of ‘bt_gatt_client_set_service_changed’ was here
   55 | bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:59:6: error: redundant redeclaration of ‘bt_gatt_client_set_debug’ [-Werror=redundant-decls]
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:59:6: note: previous declaration of ‘bt_gatt_client_set_debug’ was here
   59 | bool bt_gatt_client_set_debug(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:64:10: error: redundant redeclaration of ‘bt_gatt_client_get_mtu’ [-Werror=redundant-decls]
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:64:10: note: previous declaration of ‘bt_gatt_client_get_mtu’ was here
   64 | uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:65:16: error: redundant redeclaration of ‘bt_gatt_client_get_att’ [-Werror=redundant-decls]
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:65:16: note: previous declaration of ‘bt_gatt_client_get_att’ was here
   65 | struct bt_att *bt_gatt_client_get_att(struct bt_gatt_client *client);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:66:17: error: redundant redeclaration of ‘bt_gatt_client_get_db’ [-Werror=redundant-decls]
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:66:17: note: previous declaration of ‘bt_gatt_client_get_db’ was here
   66 | struct gatt_db *bt_gatt_client_get_db(struct bt_gatt_client *client);
      |                 ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:67:9: error: redundant redeclaration of ‘bt_gatt_client_get_features’ [-Werror=redundant-decls]
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:67:9: note: previous declaration of ‘bt_gatt_client_get_features’ was here
   67 | uint8_t bt_gatt_client_get_features(struct bt_gatt_client *client);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:69:6: error: redundant redeclaration of ‘bt_gatt_client_cancel’ [-Werror=redundant-decls]
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:69:6: note: previous declaration of ‘bt_gatt_client_cancel’ was here
   69 | bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:70:6: error: redundant redeclaration of ‘bt_gatt_client_cancel_all’ [-Werror=redundant-decls]
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:70:6: note: previous declaration of ‘bt_gatt_client_cancel_all’ was here
   70 | bool bt_gatt_client_cancel_all(struct bt_gatt_client *client);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:72:14: error: redundant redeclaration of ‘bt_gatt_client_read_value’ [-Werror=redundant-decls]
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:72:14: note: previous declaration of ‘bt_gatt_client_read_value’ was here
   72 | unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:77:14: error: redundant redeclaration of ‘bt_gatt_client_read_long_value’ [-Werror=redundant-decls]
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:77:14: note: previous declaration of ‘bt_gatt_client_read_long_value’ was here
   77 | unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:82:14: error: redundant redeclaration of ‘bt_gatt_client_read_multiple’ [-Werror=redundant-decls]
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:82:14: note: previous declaration of ‘bt_gatt_client_read_multiple’ was here
   82 | unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:88:14: error: redundant redeclaration of ‘bt_gatt_client_write_without_response’ [-Werror=redundant-decls]
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:88:14: note: previous declaration of ‘bt_gatt_client_write_without_response’ was here
   88 | unsigned int bt_gatt_client_write_without_response(
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:93:14: error: redundant redeclaration of ‘bt_gatt_client_write_value’ [-Werror=redundant-decls]
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:93:14: note: previous declaration of ‘bt_gatt_client_write_value’ was here
   93 | unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:99:14: error: redundant redeclaration of ‘bt_gatt_client_write_long_value’ [-Werror=redundant-decls]
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:99:14: note: previous declaration of ‘bt_gatt_client_write_long_value’ was here
   99 | unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:106:14: error: redundant redeclaration of ‘bt_gatt_client_prepare_write’ [-Werror=redundant-decls]
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:106:14: note: previous declaration of ‘bt_gatt_client_prepare_write’ was here
  106 | unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:113:14: error: redundant redeclaration of ‘bt_gatt_client_write_execute’ [-Werror=redundant-decls]
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:113:14: note: previous declaration of ‘bt_gatt_client_write_execute’ was here
  113 | unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:119:14: error: redundant redeclaration of ‘bt_gatt_client_register_notify’ [-Werror=redundant-decls]
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:119:14: note: previous declaration of ‘bt_gatt_client_register_notify’ was here
  119 | unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:125:6: error: redundant redeclaration of ‘bt_gatt_client_unregister_notify’ [-Werror=redundant-decls]
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:125:6: note: previous declaration of ‘bt_gatt_client_unregister_notify’ was here
  125 | bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:128:6: error: redundant redeclaration of ‘bt_gatt_client_set_security’ [-Werror=redundant-decls]
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:128:6: note: previous declaration of ‘bt_gatt_client_set_security’ was here
  128 | bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:129:5: error: redundant redeclaration of ‘bt_gatt_client_get_security’ [-Werror=redundant-decls]
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:129:5: note: previous declaration of ‘bt_gatt_client_get_security’ was here
  129 | int bt_gatt_client_get_security(struct bt_gatt_client *client);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:131:14: error: redundant redeclaration of ‘bt_gatt_client_idle_register’ [-Werror=redundant-decls]
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:131:14: note: previous declaration of ‘bt_gatt_client_idle_register’ was here
  131 | unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:135:6: error: redundant redeclaration of ‘bt_gatt_client_idle_unregister’ [-Werror=redundant-decls]
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:135:6: note: previous declaration of ‘bt_gatt_client_idle_unregister’ was here
  135 | bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:12,
                 from src/shared/rap.c:27:
./src/shared/gatt-client.h:137:6: error: redundant redeclaration of ‘bt_gatt_client_set_retry’ [-Werror=redundant-decls]
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:26:
./src/shared/gatt-client.h:137:6: note: previous declaration of ‘bt_gatt_client_set_retry’ was here
  137 | bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:15:24: error: redundant redeclaration of ‘bt_gatt_server_new’ [-Werror=redundant-decls]
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:15:24: note: previous declaration of ‘bt_gatt_server_new’ was here
   15 | struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:18:10: error: redundant redeclaration of ‘bt_gatt_server_get_mtu’ [-Werror=redundant-decls]
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:18:10: note: previous declaration of ‘bt_gatt_server_get_mtu’ was here
   18 | uint16_t bt_gatt_server_get_mtu(struct bt_gatt_server *server);
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:19:16: error: redundant redeclaration of ‘bt_gatt_server_get_att’ [-Werror=redundant-decls]
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:19:16: note: previous declaration of ‘bt_gatt_server_get_att’ was here
   19 | struct bt_att *bt_gatt_server_get_att(struct bt_gatt_server *server);
      |                ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:21:24: error: redundant redeclaration of ‘bt_gatt_server_ref’ [-Werror=redundant-decls]
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:21:24: note: previous declaration of ‘bt_gatt_server_ref’ was here
   21 | struct bt_gatt_server *bt_gatt_server_ref(struct bt_gatt_server *server);
      |                        ^~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:22:6: error: redundant redeclaration of ‘bt_gatt_server_unref’ [-Werror=redundant-decls]
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:22:6: note: previous declaration of ‘bt_gatt_server_unref’ was here
   22 | void bt_gatt_server_unref(struct bt_gatt_server *server);
      |      ^~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:28:6: error: redundant redeclaration of ‘bt_gatt_server_set_debug’ [-Werror=redundant-decls]
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:28:6: note: previous declaration of ‘bt_gatt_server_set_debug’ was here
   28 | bool bt_gatt_server_set_debug(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:36:6: error: redundant redeclaration of ‘bt_gatt_server_set_authorize’ [-Werror=redundant-decls]
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:36:6: note: previous declaration of ‘bt_gatt_server_set_authorize’ was here
   36 | bool bt_gatt_server_set_authorize(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:40:6: error: redundant redeclaration of ‘bt_gatt_server_send_notification’ [-Werror=redundant-decls]
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:40:6: note: previous declaration of ‘bt_gatt_server_send_notification’ was here
   40 | bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/shared/rap.h:13,
                 from src/shared/rap.c:27:
./src/shared/gatt-server.h:44:6: error: redundant redeclaration of ‘bt_gatt_server_send_indication’ [-Werror=redundant-decls]
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/shared/rap.c:25:
./src/shared/gatt-server.h:44:6: note: previous declaration of ‘bt_gatt_server_send_indication’ was here
   44 | bool bt_gatt_server_send_indication(struct bt_gatt_server *server,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:135:13: error: no previous declaration for ‘rap_get_ras’ [-Werror=missing-declarations]
  135 | struct ras *rap_get_ras(struct bt_rap *rap)
      |             ^~~~~~~~~~~
src/shared/rap.c: In function ‘register_ras_service’:
src/shared/rap.c:383:26: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  383 |  bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
      |                          ^~~~~~~~~~~~~~~~~
      |                          CSC_FEATURE_UUID
src/shared/rap.c:383:26: note: each undeclared identifier is reported only once for each function it appears in
src/shared/rap.c:393:26: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  393 |  bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:408:26: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  408 |  bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:422:26: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  422 |  bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~
      |                          SC_CONTROL_POINT_UUID
src/shared/rap.c:437:26: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  437 |  bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:452:26: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  452 |  bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c: In function ‘foreach_rap_char’:
src/shared/rap.c:682:35: error: ‘RAS_FEATURES_UUID’ undeclared (first use in this function); did you mean ‘CSC_FEATURE_UUID’?
  682 |  bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
      |                                   ^~~~~~~~~~~~~~~~~
      |                                   CSC_FEATURE_UUID
src/shared/rap.c:683:35: error: ‘RAS_REALTIME_DATA_UUID’ undeclared (first use in this function)
  683 |  bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:684:35: error: ‘RAS_ONDEMAND_DATA_UUID’ undeclared (first use in this function)
  684 |  bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:685:29: error: ‘RAS_CONTROL_POINT_UUID’ undeclared (first use in this function); did you mean ‘SC_CONTROL_POINT_UUID’?
  685 |  bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             SC_CONTROL_POINT_UUID
src/shared/rap.c:686:36: error: ‘RAS_DATA_READY_UUID’ undeclared (first use in this function)
  686 |  bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
      |                                    ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:687:38: error: ‘RAS_DATA_OVERWRITTEN_UUID’ undeclared (first use in this function)
  687 |  bt_uuid16_create(&uuid_overwritten, RAS_DATA_OVERWRITTEN_UUID);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/shared/rap.c:636:21: error: ‘bt_rap_register_notify’ defined but not used [-Werror=unused-function]
  636 | static unsigned int bt_rap_register_notify(struct bt_rap *rap,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:598:13: error: ‘rap_pending_complete’ defined but not used [-Werror=unused-function]
  598 | static void rap_pending_complete(bool success, uint8_t att_ecode,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:589:13: error: ‘rap_pending_destroy’ defined but not used [-Werror=unused-function]
  589 | static void rap_pending_destroy(void *data)
      |             ^~~~~~~~~~~~~~~~~~~
src/shared/rap.c:301:13: error: ‘ras_realtime_read_cb’ defined but not used [-Werror=unused-function]
  301 | static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
      |             ^~~~~~~~~~~~~~~~~~~~
src/shared/rap.c:124:26: error: ‘rap_get_rapdb’ defined but not used [-Werror=unused-function]
  124 | static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
      |                          ^~~~~~~~~~~~~
src/shared/rap.c:117:13: error: ‘on_demand_enabled’ defined but not used [-Werror=unused-variable]
  117 | static bool on_demand_enabled;
      |             ^~~~~~~~~~~~~~~~~
src/shared/rap.c:116:13: error: ‘real_time_enabled’ defined but not used [-Werror=unused-variable]
  116 | static bool real_time_enabled;
      |             ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8039: src/shared/libshared_mainloop_la-rap.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
src/shared/bap.c:1529:8: warning: Use of memory after it is freed
        bap = bt_bap_ref_safe(bap);
              ^~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:2340:20: warning: Use of memory after it is freed
        return queue_find(stream->bap->streams, NULL, stream);
                          ^~~~~~~~~~~~~~~~~~~~
2 warnings generated.
make: *** [Makefile:4260: all] Error 2


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG:
  2026-01-23 11:21 [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG: Prathibha Madugonde
  2026-01-23 11:41 ` [BlueZ] " bluez.test.bot
@ 2026-01-23 13:28 ` Bastien Nocera
  2026-01-25 17:23   ` Prathibha Madugonde
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien Nocera @ 2026-01-23 13:28 UTC (permalink / raw)
  To: Prathibha Madugonde, linux-bluetooth
  Cc: luiz.dentz, quic_mohamull, quic_hbandi, quic_anubhavg

Hey Prathibha,

You should send all your RAS patches in a single patchset, probably
with a cover-letter, so they get applied as one set in the bluez CI.
Otherwise the CI will treat it as separate and independent patches
which won't apply or compile correctly.

You should also trim your commit subjects, they should be a maximum of
72 characters long.

Cheers

On Fri, 2026-01-23 at 16:51 +0530, Prathibha Madugonde wrote:
> Add RAS service, characteristics, and descriptors to the local GATT
> DB
> Implement server-side callbacks for RAS Features, Procedure Data,
> Data Ready and Data Overwritten characteristics
> Add client-side session handling, notification registration and
> ready callbacks
> Wire RAS attachment/detachment to ATT/GATT client and server
> ---
>  Makefile.am      |   4 +-
>  src/shared/rap.c | 874
> +++++++++++++++++++++++++++++++++++++++++++++++
>  src/shared/rap.h |  48 +++
>  3 files changed, 925 insertions(+), 1 deletion(-)
>  create mode 100644 src/shared/rap.c
>  create mode 100644 src/shared/rap.h
> 
> diff --git a/Makefile.am b/Makefile.am
> index 2217bcf15..cff5cc034 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -248,7 +248,9 @@ shared_sources = src/shared/io.h
> src/shared/timeout.h \
>  			src/shared/bap-defs.h \
>  			src/shared/asha.h src/shared/asha.c \
>  			src/shared/battery.h src/shared/battery.c \
> -			src/shared/uinput.h src/shared/uinput.c
> +			src/shared/uinput.h src/shared/uinput.c \
> +			src/shared/rap.h src/shared/rap.c
> +
>  
>  if READLINE
>  shared_sources += src/shared/shell.c src/shared/shell.h
> diff --git a/src/shared/rap.c b/src/shared/rap.c
> new file mode 100644
> index 000000000..605963c92
> --- /dev/null
> +++ b/src/shared/rap.c
> @@ -0,0 +1,874 @@
> +// SPDX-License-Identifier: LGPL-2.1-or-later
> +/*
> + * BlueZ - Bluetooth protocol stack for Linux
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its
> subsidiaries.
> + */
> +
> +#define _GNU_SOURCE
> +#include <inttypes.h>
> +#include <string.h>
> +#include <stdlib.h>
> +#include <stdbool.h>
> +#include <unistd.h>
> +#include <errno.h>
> +#include <glib.h>
> +
> +#include "bluetooth/bluetooth.h"
> +#include "bluetooth/uuid.h"
> +
> +#include "src/shared/queue.h"
> +#include "src/shared/util.h"
> +#include "src/shared/timeout.h"
> +#include "src/shared/att.h"
> +#include "src/shared/gatt-db.h"
> +#include "src/shared/gatt-server.h"
> +#include "src/shared/gatt-client.h"
> +#include "src/shared/rap.h"
> +
> +#define DBG(_rap, fmt, arg...) \
> +	rap_debug(_rap, "%s:%s() " fmt, __FILE__, __func__, ## arg)
> +
> +#define RAS_UUID16			0x185B
> +
> +/* Total number of attribute handles reserved for the RAS service */
> +#define RAS_TOTAL_NUM_HANDLES		18
> +
> +/* Ranging Service context */
> +struct ras {
> +	struct bt_rap_db *rapdb;
> +
> +	/* Service and characteristic attributes */
> +	struct gatt_db_attribute *svc;
> +	struct gatt_db_attribute *feat_chrc;
> +	struct gatt_db_attribute *realtime_chrc;
> +	struct gatt_db_attribute *realtime_chrc_ccc;
> +	struct gatt_db_attribute *ondemand_chrc;
> +	struct gatt_db_attribute *cp_chrc;
> +	struct gatt_db_attribute *ready_chrc;
> +	struct gatt_db_attribute *overwritten_chrc;
> +};
> +
> +struct bt_rap_db {
> +	struct gatt_db *db;
> +	struct ras *ras;
> +};
> +
> +struct bt_rap {
> +	int ref_count;
> +	struct bt_rap_db *lrapdb;
> +	struct bt_rap_db *rrapdb;
> +	struct bt_gatt_client *client;
> +	struct bt_att *att;
> +
> +	unsigned int idle_id;
> +
> +	struct queue *notify;
> +	struct queue *pending;
> +	struct queue *ready_cbs;
> +
> +	bt_rap_debug_func_t debug_func;
> +	bt_rap_destroy_func_t debug_destroy;
> +	void *debug_data;
> +	void *user_data;
> +};
> +
> +static struct queue *rap_db;
> +static struct queue *bt_rap_cbs;
> +static struct queue *sessions;
> +
> +struct bt_rap_cb {
> +	unsigned int id;
> +	bt_rap_func_t attached;
> +	bt_rap_func_t detached;
> +	void *user_data;
> +};
> +
> +typedef void (*rap_func_t)(struct bt_rap *rap, bool success,
> +			   uint8_t att_ecode, const uint8_t *value,
> +			   uint16_t length, void *user_data);
> +
> +struct bt_rap_pending {
> +	unsigned int id;
> +	struct bt_rap *rap;
> +	rap_func_t func;
> +	void *userdata;
> +};
> +
> +struct bt_rap_ready {
> +	unsigned int id;
> +	bt_rap_ready_func_t func;
> +	bt_rap_destroy_func_t destroy;
> +	void *data;
> +};
> +
> +typedef void (*rap_notify_t)(struct bt_rap *rap, uint16_t
> value_handle,
> +			     const uint8_t *value, uint16_t length,
> +			     void *user_data);
> +
> +struct bt_rap_notify {
> +	unsigned int id;
> +	struct bt_rap *rap;
> +	rap_notify_t func;
> +	void *user_data;
> +};
> +
> +static bool real_time_enabled;
> +static bool on_demand_enabled;
> +struct gatt_db_attribute *global_real_time_char;
> +struct gatt_db_attribute *global_on_demand_char;
> +struct gatt_db_attribute *global_data_ready_char;
> +struct gatt_db_attribute *global_data_overwritten_char;
> +struct gatt_db_attribute *global_control_point_char;
> +
> +static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
> +{
> +	if (!rap)
> +		return NULL;
> +
> +	if (rap->lrapdb)
> +		return rap->lrapdb;
> +
> +	return NULL;
> +}
> +
> +struct ras *rap_get_ras(struct bt_rap *rap)
> +{
> +	if (!rap)
> +		return NULL;
> +
> +	if (rap->rrapdb->ras)
> +		return rap->rrapdb->ras;
> +
> +	rap->rrapdb->ras = new0(struct ras, 1);
> +	rap->rrapdb->ras->rapdb = rap->rrapdb;
> +
> +	return rap->rrapdb->ras;
> +}
> +
> +static void rap_detached(void *data, void *user_data)
> +{
> +	struct bt_rap_cb *cb = data;
> +	struct bt_rap *rap = user_data;
> +
> +	cb->detached(rap, cb->user_data);
> +}
> +
> +void bt_rap_detach(struct bt_rap *rap)
> +{
> +	if (!queue_remove(sessions, rap))
> +		return;
> +
> +	bt_gatt_client_idle_unregister(rap->client, rap->idle_id);
> +	bt_gatt_client_unref(rap->client);
> +	rap->client = NULL;
> +
> +	queue_foreach(bt_rap_cbs, rap_detached, rap);
> +}
> +
> +static void rap_db_free(void *data)
> +{
> +	struct bt_rap_db *rapdb = data;
> +
> +	if (!rapdb)
> +		return;
> +
> +	gatt_db_unref(rapdb->db);
> +
> +	free(rapdb->ras);
> +	free(rapdb);
> +}
> +
> +static void rap_ready_free(void *data)
> +{
> +	struct bt_rap_ready *ready = data;
> +
> +	if (ready->destroy)
> +		ready->destroy(ready->data);
> +
> +	free(ready);
> +}
> +
> +static void rap_free(void *data)
> +{
> +	struct bt_rap *rap = data;
> +
> +	bt_rap_detach(rap);
> +
> +	rap_db_free(rap->rrapdb);
> +
> +	queue_destroy(rap->notify, free);
> +	queue_destroy(rap->pending, NULL);
> +	queue_destroy(rap->ready_cbs, rap_ready_free);
> +
> +	free(rap);
> +}
> +
> +bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data)
> +{
> +	if (!rap)
> +		return false;
> +
> +	rap->user_data = user_data;
> +
> +	return true;
> +}
> +
> +static bool rap_db_match(const void *data, const void *match_data)
> +{
> +	const struct bt_rap_db *rapdb = data;
> +	const struct gatt_db *db = match_data;
> +
> +	return rapdb->db == db;
> +}
> +
> +struct bt_att *bt_rap_get_att(struct bt_rap *rap)
> +{
> +	if (!rap)
> +		return NULL;
> +
> +	if (rap->att)
> +		return rap->att;
> +
> +	return bt_gatt_client_get_att(rap->client);
> +}
> +
> +struct bt_rap *bt_rap_ref(struct bt_rap *rap)
> +{
> +	if (!rap)
> +		return NULL;
> +
> +	__sync_fetch_and_add(&rap->ref_count, 1);
> +
> +	return rap;
> +}
> +
> +void bt_rap_unref(struct bt_rap *rap)
> +{
> +	if (!rap)
> +		return;
> +
> +	if (__sync_sub_and_fetch(&rap->ref_count, 1))
> +		return;
> +
> +	rap_free(rap);
> +}
> +
> +static void rap_debug(struct bt_rap *rap, const char *format, ...)
> +{
> +	va_list ap;
> +
> +	if (!rap || !format || !rap->debug_func)
> +		return;
> +
> +	va_start(ap, format);
> +	util_debug_va(rap->debug_func, rap->debug_data, format, ap);
> +	va_end(ap);
> +}
> +
> +bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
> +			void *user_data, bt_rap_destroy_func_t
> destroy)
> +{
> +	if (!rap)
> +		return false;
> +
> +	if (rap->debug_destroy)
> +		rap->debug_destroy(rap->debug_data);
> +
> +	rap->debug_func = func;
> +	rap->debug_destroy = destroy;
> +	rap->debug_data = user_data;
> +
> +	return true;
> +}
> +
> +static void ras_features_read_cb(struct gatt_db_attribute *attrib,
> +				 unsigned int id, uint16_t offset,
> +				 uint8_t opcode, struct bt_att *att,
> +				 void *user_data)
> +{
> +	/*
> +	 * Feature mask: bits 0-2 set:
> +	 *  - Real-time ranging
> +	 *  - Retrieve stored results
> +	 *  - Abort operation
> +	 */
> +	uint8_t value[4] = { 0x01, 0x00, 0x00, 0x00 };
> +
> +	gatt_db_attribute_read_result(attrib, id, 0, value,
> sizeof(value));
> +}
> +
> +static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
> +				 unsigned int id, uint16_t offset,
> +				 uint8_t opcode, struct bt_att *att,
> +				 void *user_data)
> +{
> +	/* No static read data; real-time data is provided via
> notifications. */
> +	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
> +}
> +
> +static void ras_ondemand_read_cb(struct gatt_db_attribute *attrib,
> +				 unsigned int id, uint16_t offset,
> +				 uint8_t opcode, struct bt_att *att,
> +				 void *user_data)
> +{
> +	/* No static read data – on‑demand data is pushed via
> +	 * notifications
> +	 */
> +	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
> +}
> +
> +/*
> + * Control point handler.
> + * Parses the opcode and acts on queued data (implementation TBD).
> + */
> +static void ras_control_point_write_cb(struct gatt_db_attribute
> *attrib,
> +				       unsigned int id, uint16_t
> offset,
> +				       const uint8_t *value, size_t
> len,
> +				       uint8_t opcode, struct bt_att
> *att,
> +				       void *user_data)
> +{
> +	/* Control point handler - implementation TBD */
> +}
> +
> +/* Data Ready – returns the latest ranging counter. */
> +static void ras_data_ready_read_cb(struct gatt_db_attribute *attrib,
> +				   unsigned int id, uint16_t offset,
> +				   uint8_t opcode, struct bt_att
> *att,
> +				   void *user_data)
> +{
> +	uint16_t counter = 0;
> +	uint8_t value[2];
> +
> +	put_le16(counter, value);
> +	gatt_db_attribute_read_result(attrib, id, 0, value,
> sizeof(value));
> +}
> +
> +/* Data Overwritten – indicates how many results were overwritten.
> */
> +static void ras_data_overwritten_read_cb(struct gatt_db_attribute
> *attrib,
> +					 unsigned int id, uint16_t
> offset,
> +					 uint8_t opcode, struct
> bt_att *att,
> +					 void *user_data)
> +{
> +	uint8_t value[2] = { 0x00, 0x00 };
> +
> +	gatt_db_attribute_read_result(attrib, id, 0, value,
> sizeof(value));
> +}
> +
> +/* Service registration – store attribute pointers */
> +static struct ras *register_ras_service(struct gatt_db *db)
> +{
> +	struct ras *ras;
> +	struct gatt_db_attribute *service;
> +	bt_uuid_t uuid;
> +
> +	if (!db)
> +		return NULL;
> +
> +	ras = new0(struct ras, 1);
> +	if (!ras)
> +		return NULL;
> +
> +	/* Primary RAS service */
> +	bt_uuid16_create(&uuid, RAS_UUID16);
> +	service = gatt_db_add_service(db, &uuid, true,
> RAS_TOTAL_NUM_HANDLES);
> +	if (!service) {
> +		free(ras);
> +		return NULL;
> +	}
> +
> +	ras->svc = service;
> +
> +	/* RAS Features */
> +	bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
> +		ras->feat_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_READ |
> +						 
> BT_ATT_PERM_READ_ENCRYPT,
> +						 
> BT_GATT_CHRC_PROP_READ,
> +						 
> ras_features_read_cb,
> +						  NULL, ras);
> +
> +	/* Real-time Ranging Data */
> +	bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
> +	ras->realtime_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_READ |
> +						 
> BT_ATT_PERM_READ_ENCRYPT,
> +						 
> BT_GATT_CHRC_PROP_NOTIFY |
> +						 
> BT_GATT_CHRC_PROP_INDICATE,
> +						  NULL, NULL, ras);
> +
> +	ras->realtime_chrc_ccc =
> +		gatt_db_service_add_ccc(ras->svc,
> +					BT_ATT_PERM_READ |
> +					BT_ATT_PERM_WRITE);
> +
> +	/* On-demand Ranging Data */
> +	bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
> +	ras->ondemand_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_READ |
> +						 
> BT_ATT_PERM_READ_ENCRYPT,
> +						 
> BT_GATT_CHRC_PROP_NOTIFY |
> +						 
> BT_GATT_CHRC_PROP_INDICATE,
> +						 
> ras_ondemand_read_cb, NULL,
> +						  ras);
> +
> +	gatt_db_service_add_ccc(ras->svc,
> +				BT_ATT_PERM_READ |
> BT_ATT_PERM_WRITE);
> +
> +	/* RAS Control Point */
> +	bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
> +	ras->cp_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_WRITE
> |
> +						 
> BT_ATT_PERM_WRITE_ENCRYPT,
> +				BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP
> |
> +						 
> BT_GATT_CHRC_PROP_INDICATE,
> +						  NULL,
> +						 
> ras_control_point_write_cb,
> +						  ras);
> +
> +	gatt_db_service_add_ccc(ras->svc,
> +				BT_ATT_PERM_READ |
> BT_ATT_PERM_WRITE);
> +
> +	/* RAS Data Ready */
> +	bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
> +	ras->ready_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_READ |
> +						 
> BT_ATT_PERM_READ_ENCRYPT,
> +						 
> BT_GATT_CHRC_PROP_READ |
> +						 
> BT_GATT_CHRC_PROP_NOTIFY |
> +						 
> BT_GATT_CHRC_PROP_INDICATE,
> +						 
> ras_data_ready_read_cb, NULL,
> +						  ras);
> +
> +	gatt_db_service_add_ccc(ras->svc,
> +				BT_ATT_PERM_READ |
> BT_ATT_PERM_WRITE);
> +
> +	/* RAS Data Overwritten */
> +	bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
> +	ras->overwritten_chrc =
> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
> +						  BT_ATT_PERM_READ |
> +						 
> BT_ATT_PERM_READ_ENCRYPT,
> +						 
> BT_GATT_CHRC_PROP_READ |
> +						 
> BT_GATT_CHRC_PROP_NOTIFY |
> +						 
> BT_GATT_CHRC_PROP_INDICATE,
> +						 
> ras_data_overwritten_read_cb,
> +						  NULL, ras);
> +
> +	gatt_db_service_add_ccc(ras->svc,
> +				BT_ATT_PERM_READ |
> BT_ATT_PERM_WRITE);
> +
> +	/* Activate the service */
> +	gatt_db_service_set_active(ras->svc, true);
> +
> +	return ras;
> +}
> +
> +static struct bt_rap_db *rap_db_new(struct gatt_db *db)
> +{
> +	struct bt_rap_db *rapdb;
> +
> +	if (!db)
> +		return NULL;
> +
> +	rapdb = new0(struct bt_rap_db, 1);
> +	if (!rapdb)
> +		return NULL;
> +
> +	rapdb->db = gatt_db_ref(db);
> +
> +	if (!rap_db)
> +		rap_db = queue_new();
> +
> +	rapdb->ras = register_ras_service(db);
> +	if (rapdb->ras)
> +		rapdb->ras->rapdb = rapdb;
> +
> +	queue_push_tail(rap_db, rapdb);
> +
> +	return rapdb;
> +}
> +
> +static struct bt_rap_db *rap_get_db(struct gatt_db *db)
> +{
> +	struct bt_rap_db *rapdb;
> +
> +	rapdb = queue_find(rap_db, rap_db_match, db);
> +	if (rapdb)
> +		return rapdb;
> +
> +	return rap_db_new(db);
> +}
> +
> +void bt_rap_add_db(struct gatt_db *db)
> +{
> +	rap_db_new(db);
> +}
> +
> +unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t
> detached,
> +			     void *user_data)
> +{
> +	struct bt_rap_cb *cb;
> +	static unsigned int id;
> +
> +	if (!attached && !detached)
> +		return 0;
> +
> +	if (!bt_rap_cbs)
> +		bt_rap_cbs = queue_new();
> +
> +	cb = new0(struct bt_rap_cb, 1);
> +	cb->id = ++id ? id : ++id;
> +	cb->attached = attached;
> +	cb->detached = detached;
> +	cb->user_data = user_data;
> +
> +	queue_push_tail(bt_rap_cbs, cb);
> +
> +	return cb->id;
> +}
> +
> +static bool match_id(const void *data, const void *match_data)
> +{
> +	const struct bt_rap_cb *cb = data;
> +	unsigned int id = PTR_TO_UINT(match_data);
> +
> +	return cb->id == id;
> +}
> +
> +bool bt_rap_unregister(unsigned int id)
> +{
> +	struct bt_rap_cb *cb;
> +
> +	cb = queue_remove_if(bt_rap_cbs, match_id, UINT_TO_PTR(id));
> +	if (!cb)
> +		return false;
> +
> +	free(cb);
> +
> +	return true;
> +}
> +
> +struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> +{
> +	struct bt_rap *rap;
> +	struct bt_rap_db *rapdb;
> +
> +	if (!ldb)
> +		return NULL;
> +
> +	rapdb = rap_get_db(ldb);
> +	if (!rapdb)
> +		return NULL;
> +
> +	rap = new0(struct bt_rap, 1);
> +	rap->lrapdb = rapdb;
> +	rap->pending = queue_new();
> +	rap->ready_cbs = queue_new();
> +	rap->notify = queue_new();
> +
> +	if (!rdb)
> +		goto done;
> +
> +	rapdb = new0(struct bt_rap_db, 1);
> +	rapdb->db = gatt_db_ref(rdb);
> +
> +	rap->rrapdb = rapdb;
> +
> +done:
> +	bt_rap_ref(rap);
> +
> +	return rap;
> +}
> +
> +static void rap_pending_destroy(void *data)
> +{
> +	struct bt_rap_pending *pending = data;
> +	struct bt_rap *rap = pending->rap;
> +
> +	if (queue_remove_if(rap->pending, NULL, pending))
> +		free(pending);
> +}
> +
> +static void rap_pending_complete(bool success, uint8_t att_ecode,
> +				 const uint8_t *value, uint16_t
> length,
> +				 void *user_data)
> +{
> +	struct bt_rap_pending *pending = user_data;
> +
> +	if (pending->func)
> +		pending->func(pending->rap, success, att_ecode,
> value,
> +			      length, pending->userdata);
> +}
> +
> +static void rap_register(uint16_t att_ecode, void *user_data)
> +{
> +	struct bt_rap_notify *notify = user_data;
> +
> +	if (att_ecode)
> +		DBG(notify->rap, "RAS register failed 0x%04x",
> att_ecode);
> +}
> +
> +static void rap_notify(uint16_t value_handle, const uint8_t *value,
> +		       uint16_t length, void *user_data)
> +{
> +	struct bt_rap_notify *notify = user_data;
> +
> +	if (notify->func)
> +		notify->func(notify->rap, value_handle, value,
> length,
> +			     notify->user_data);
> +}
> +
> +static void rap_notify_destroy(void *data)
> +{
> +	struct bt_rap_notify *notify = data;
> +	struct bt_rap *rap = notify->rap;
> +
> +	if (queue_remove_if(rap->notify, NULL, notify))
> +		free(notify);
> +}
> +
> +static unsigned int bt_rap_register_notify(struct bt_rap *rap,
> +					   uint16_t value_handle,
> +					   rap_notify_t func,
> +					   void *user_data)
> +{
> +	struct bt_rap_notify *notify;
> +
> +	notify = new0(struct bt_rap_notify, 1);
> +	notify->rap = rap;
> +	notify->func = func;
> +	notify->user_data = user_data;
> +
> +	notify->id = bt_gatt_client_register_notify(rap->client,
> +						    value_handle,
> +						    rap_register,
> +						    rap_notify,
> +						    notify,
> +						   
> rap_notify_destroy);
> +	if (!notify->id) {
> +		DBG(rap, "Unable to register for notifications");
> +		free(notify);
> +		return 0;
> +	}
> +
> +	queue_push_tail(rap->notify, notify);
> +
> +	return notify->id;
> +}
> +
> +static void foreach_rap_char(struct gatt_db_attribute *attr, void
> *user_data)
> +{
> +	struct bt_rap *rap = user_data;
> +	uint16_t value_handle;
> +	bt_uuid_t uuid;
> +	bt_uuid_t uuid_features;
> +	bt_uuid_t uuid_realtime;
> +	bt_uuid_t uuid_ondemand;
> +	bt_uuid_t uuid_cp;
> +	bt_uuid_t uuid_dataready;
> +	bt_uuid_t uuid_overwritten;
> +	struct ras *ras;
> +
> +	if (!gatt_db_attribute_get_char_data(attr, NULL,
> &value_handle,
> +					     NULL, NULL, &uuid))
> +		return;
> +
> +	bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
> +	bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
> +	bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
> +	bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
> +	bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
> +	bt_uuid16_create(&uuid_overwritten,
> RAS_DATA_OVERWRITTEN_UUID);
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_features)) {
> +		DBG(rap, "Features characteristic found: handle
> 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->feat_chrc)
> +			return;
> +
> +		ras->feat_chrc = attr;
> +	}
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_realtime)) {
> +		DBG(rap, "Real Time Data characteristic found:
> handle 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->realtime_chrc)
> +			return;
> +
> +		ras->realtime_chrc = attr;
> +	}
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_ondemand)) {
> +		DBG(rap, "On-demand Data characteristic found:
> handle 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->ondemand_chrc)
> +			return;
> +
> +		ras->ondemand_chrc = attr;
> +	}
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_cp)) {
> +		DBG(rap, "Control Point characteristic found: handle
> 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->cp_chrc)
> +			return;
> +
> +		ras->cp_chrc = attr;
> +	}
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_dataready)) {
> +		DBG(rap, "Data Ready characteristic found: handle
> 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->ready_chrc)
> +			return;
> +
> +		ras->ready_chrc = attr;
> +	}
> +
> +	if (!bt_uuid_cmp(&uuid, &uuid_overwritten)) {
> +		DBG(rap, "Overwritten characteristic found: handle
> 0x%04x",
> +		    value_handle);
> +
> +		ras = rap_get_ras(rap);
> +		if (!ras || ras->overwritten_chrc)
> +			return;
> +
> +		ras->overwritten_chrc = attr;
> +	}
> +}
> +
> +static void foreach_rap_service(struct gatt_db_attribute *attr,
> +				void *user_data)
> +{
> +	struct bt_rap *rap = user_data;
> +	struct ras *ras = rap_get_ras(rap);
> +
> +	ras->svc = attr;
> +
> +	gatt_db_service_set_claimed(attr, true);
> +
> +	gatt_db_service_foreach_char(attr, foreach_rap_char, rap);
> +}
> +
> +unsigned int bt_rap_ready_register(struct bt_rap *rap,
> +				   bt_rap_ready_func_t func, void
> *user_data,
> +				   bt_rap_destroy_func_t destroy)
> +{
> +	struct bt_rap_ready *ready;
> +	static unsigned int id;
> +
> +	if (!rap)
> +		return 0;
> +
> +	DBG(rap, "bt_rap_ready_register");
> +
> +	ready = new0(struct bt_rap_ready, 1);
> +	ready->id = ++id ? id : ++id;
> +	ready->func = func;
> +	ready->destroy = destroy;
> +	ready->data = user_data;
> +
> +	queue_push_tail(rap->ready_cbs, ready);
> +
> +	return ready->id;
> +}
> +
> +static bool match_ready_id(const void *data, const void *match_data)
> +{
> +	const struct bt_rap_ready *ready = data;
> +	unsigned int id = PTR_TO_UINT(match_data);
> +
> +	return ready->id == id;
> +}
> +
> +bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id)
> +{
> +	struct bt_rap_ready *ready;
> +
> +	ready = queue_remove_if(rap->ready_cbs, match_ready_id,
> +				UINT_TO_PTR(id));
> +	if (!ready)
> +		return false;
> +
> +	rap_ready_free(ready);
> +
> +	return true;
> +}
> +
> +static struct bt_rap *bt_rap_ref_safe(struct bt_rap *rap)
> +{
> +	if (!rap || !rap->ref_count)
> +		return NULL;
> +
> +	return bt_rap_ref(rap);
> +}
> +
> +static void rap_notify_ready(struct bt_rap *rap)
> +{
> +	const struct queue_entry *entry;
> +
> +	if (!bt_rap_ref_safe(rap))
> +		return;
> +
> +	for (entry = queue_get_entries(rap->ready_cbs); entry;
> +	     entry = entry->next) {
> +		struct bt_rap_ready *ready = entry->data;
> +
> +		ready->func(rap, ready->data);
> +	}
> +
> +	bt_rap_unref(rap);
> +}
> +
> +static void rap_idle(void *data)
> +{
> +	struct bt_rap *rap = data;
> +
> +	rap->idle_id = 0;
> +	rap_notify_ready(rap);
> +}
> +
> +bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client
> *client)
> +{
> +	bt_uuid_t uuid;
> +
> +	if (!sessions)
> +		sessions = queue_new();
> +
> +	queue_push_tail(sessions, rap);
> +
> +	if (!client)
> +		return true;
> +
> +	if (rap->client)
> +		return false;
> +
> +	rap->client = bt_gatt_client_clone(client);
> +	if (!rap->client)
> +		return false;
> +
> +	bt_gatt_client_idle_register(rap->client, rap_idle, rap,
> NULL);
> +
> +	bt_uuid16_create(&uuid, RAS_UUID16);
> +
> +	gatt_db_foreach_service(rap->lrapdb->db, &uuid,
> +				foreach_rap_service, rap);
> +
> +	return true;
> +}
> diff --git a/src/shared/rap.h b/src/shared/rap.h
> new file mode 100644
> index 000000000..488172ac6
> --- /dev/null
> +++ b/src/shared/rap.h
> @@ -0,0 +1,48 @@
> +// SPDX-License-Identifier: LGPL-2.1-or-later
> +/*
> + * BlueZ - Bluetooth protocol stack for Linux
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its
> subsidiaries.
> + */
> +
> +#include <stdbool.h>
> +#include <inttypes.h>
> +
> +#include "src/shared/io.h"
> +#include "src/shared/gatt-client.h"
> +#include "src/shared/gatt-server.h"
> +
> +
> +struct bt_rap;
> +
> +typedef void (*bt_rap_debug_func_t)(const char *str, void
> *user_data);
> +typedef void (*bt_rap_ready_func_t)(struct bt_rap *rap, void
> *user_data);
> +typedef void (*bt_rap_destroy_func_t)(void *user_data);
> +typedef void (*bt_rap_func_t)(struct bt_rap *rap, void *user_data);
> +
> +struct bt_rap *bt_rap_ref(struct bt_rap *rap);
> +void bt_rap_unref(struct bt_rap *rap);
> +
> +void bt_rap_add_db(struct gatt_db *db);
> +
> +bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client
> *client);
> +void bt_rap_detach(struct bt_rap *rap);
> +
> +struct bt_att *bt_rap_get_att(struct bt_rap *rap);
> +
> +bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data);
> +
> +bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
> +			void *user_data, bt_rap_destroy_func_t
> destroy);
> +
> +/* session related functions */
> +unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t
> detached,
> +					void *user_data);
> +unsigned int bt_rap_ready_register(struct bt_rap *rap,
> +				bt_rap_ready_func_t func, void
> *user_data,
> +				bt_rap_destroy_func_t destroy);
> +bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id);
> +
> +bool bt_rap_unregister(unsigned int id);
> +
> +struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG:
  2026-01-23 13:28 ` [PATCH BlueZ] " Bastien Nocera
@ 2026-01-25 17:23   ` Prathibha Madugonde
  0 siblings, 0 replies; 4+ messages in thread
From: Prathibha Madugonde @ 2026-01-25 17:23 UTC (permalink / raw)
  To: Bastien Nocera, linux-bluetooth
  Cc: luiz.dentz, quic_mohamull, quic_hbandi, quic_anubhavg

Hi Bastien,

Thanks for the feedback.

I'll resend the RAS changes as a single patchset with cover letter,

with Subjects not exceeding 72 characters.

Thanks
Prathibha

On 1/23/2026 6:58 PM, Bastien Nocera wrote:
> Hey Prathibha,
> 
> You should send all your RAS patches in a single patchset, probably
> with a cover-letter, so they get applied as one set in the bluez CI.
> Otherwise the CI will treat it as separate and independent patches
> which won't apply or compile correctly.
> 
> You should also trim your commit subjects, they should be a maximum of
> 72 characters long.
> 
> Cheers
> 
> On Fri, 2026-01-23 at 16:51 +0530, Prathibha Madugonde wrote:
>> Add RAS service, characteristics, and descriptors to the local GATT
>> DB
>> Implement server-side callbacks for RAS Features, Procedure Data,
>> Data Ready and Data Overwritten characteristics
>> Add client-side session handling, notification registration and
>> ready callbacks
>> Wire RAS attachment/detachment to ATT/GATT client and server
>> ---
>>   Makefile.am      |   4 +-
>>   src/shared/rap.c | 874
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>   src/shared/rap.h |  48 +++
>>   3 files changed, 925 insertions(+), 1 deletion(-)
>>   create mode 100644 src/shared/rap.c
>>   create mode 100644 src/shared/rap.h
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 2217bcf15..cff5cc034 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -248,7 +248,9 @@ shared_sources = src/shared/io.h
>> src/shared/timeout.h \
>>   			src/shared/bap-defs.h \
>>   			src/shared/asha.h src/shared/asha.c \
>>   			src/shared/battery.h src/shared/battery.c \
>> -			src/shared/uinput.h src/shared/uinput.c
>> +			src/shared/uinput.h src/shared/uinput.c \
>> +			src/shared/rap.h src/shared/rap.c
>> +
>>   
>>   if READLINE
>>   shared_sources += src/shared/shell.c src/shared/shell.h
>> diff --git a/src/shared/rap.c b/src/shared/rap.c
>> new file mode 100644
>> index 000000000..605963c92
>> --- /dev/null
>> +++ b/src/shared/rap.c
>> @@ -0,0 +1,874 @@
>> +// SPDX-License-Identifier: LGPL-2.1-or-later
>> +/*
>> + * BlueZ - Bluetooth protocol stack for Linux
>> + *
>> + * Copyright (c) Qualcomm Technologies, Inc. and/or its
>> subsidiaries.
>> + */
>> +
>> +#define _GNU_SOURCE
>> +#include <inttypes.h>
>> +#include <string.h>
>> +#include <stdlib.h>
>> +#include <stdbool.h>
>> +#include <unistd.h>
>> +#include <errno.h>
>> +#include <glib.h>
>> +
>> +#include "bluetooth/bluetooth.h"
>> +#include "bluetooth/uuid.h"
>> +
>> +#include "src/shared/queue.h"
>> +#include "src/shared/util.h"
>> +#include "src/shared/timeout.h"
>> +#include "src/shared/att.h"
>> +#include "src/shared/gatt-db.h"
>> +#include "src/shared/gatt-server.h"
>> +#include "src/shared/gatt-client.h"
>> +#include "src/shared/rap.h"
>> +
>> +#define DBG(_rap, fmt, arg...) \
>> +	rap_debug(_rap, "%s:%s() " fmt, __FILE__, __func__, ## arg)
>> +
>> +#define RAS_UUID16			0x185B
>> +
>> +/* Total number of attribute handles reserved for the RAS service */
>> +#define RAS_TOTAL_NUM_HANDLES		18
>> +
>> +/* Ranging Service context */
>> +struct ras {
>> +	struct bt_rap_db *rapdb;
>> +
>> +	/* Service and characteristic attributes */
>> +	struct gatt_db_attribute *svc;
>> +	struct gatt_db_attribute *feat_chrc;
>> +	struct gatt_db_attribute *realtime_chrc;
>> +	struct gatt_db_attribute *realtime_chrc_ccc;
>> +	struct gatt_db_attribute *ondemand_chrc;
>> +	struct gatt_db_attribute *cp_chrc;
>> +	struct gatt_db_attribute *ready_chrc;
>> +	struct gatt_db_attribute *overwritten_chrc;
>> +};
>> +
>> +struct bt_rap_db {
>> +	struct gatt_db *db;
>> +	struct ras *ras;
>> +};
>> +
>> +struct bt_rap {
>> +	int ref_count;
>> +	struct bt_rap_db *lrapdb;
>> +	struct bt_rap_db *rrapdb;
>> +	struct bt_gatt_client *client;
>> +	struct bt_att *att;
>> +
>> +	unsigned int idle_id;
>> +
>> +	struct queue *notify;
>> +	struct queue *pending;
>> +	struct queue *ready_cbs;
>> +
>> +	bt_rap_debug_func_t debug_func;
>> +	bt_rap_destroy_func_t debug_destroy;
>> +	void *debug_data;
>> +	void *user_data;
>> +};
>> +
>> +static struct queue *rap_db;
>> +static struct queue *bt_rap_cbs;
>> +static struct queue *sessions;
>> +
>> +struct bt_rap_cb {
>> +	unsigned int id;
>> +	bt_rap_func_t attached;
>> +	bt_rap_func_t detached;
>> +	void *user_data;
>> +};
>> +
>> +typedef void (*rap_func_t)(struct bt_rap *rap, bool success,
>> +			   uint8_t att_ecode, const uint8_t *value,
>> +			   uint16_t length, void *user_data);
>> +
>> +struct bt_rap_pending {
>> +	unsigned int id;
>> +	struct bt_rap *rap;
>> +	rap_func_t func;
>> +	void *userdata;
>> +};
>> +
>> +struct bt_rap_ready {
>> +	unsigned int id;
>> +	bt_rap_ready_func_t func;
>> +	bt_rap_destroy_func_t destroy;
>> +	void *data;
>> +};
>> +
>> +typedef void (*rap_notify_t)(struct bt_rap *rap, uint16_t
>> value_handle,
>> +			     const uint8_t *value, uint16_t length,
>> +			     void *user_data);
>> +
>> +struct bt_rap_notify {
>> +	unsigned int id;
>> +	struct bt_rap *rap;
>> +	rap_notify_t func;
>> +	void *user_data;
>> +};
>> +
>> +static bool real_time_enabled;
>> +static bool on_demand_enabled;
>> +struct gatt_db_attribute *global_real_time_char;
>> +struct gatt_db_attribute *global_on_demand_char;
>> +struct gatt_db_attribute *global_data_ready_char;
>> +struct gatt_db_attribute *global_data_overwritten_char;
>> +struct gatt_db_attribute *global_control_point_char;
>> +
>> +static struct bt_rap_db *rap_get_rapdb(struct bt_rap *rap)
>> +{
>> +	if (!rap)
>> +		return NULL;
>> +
>> +	if (rap->lrapdb)
>> +		return rap->lrapdb;
>> +
>> +	return NULL;
>> +}
>> +
>> +struct ras *rap_get_ras(struct bt_rap *rap)
>> +{
>> +	if (!rap)
>> +		return NULL;
>> +
>> +	if (rap->rrapdb->ras)
>> +		return rap->rrapdb->ras;
>> +
>> +	rap->rrapdb->ras = new0(struct ras, 1);
>> +	rap->rrapdb->ras->rapdb = rap->rrapdb;
>> +
>> +	return rap->rrapdb->ras;
>> +}
>> +
>> +static void rap_detached(void *data, void *user_data)
>> +{
>> +	struct bt_rap_cb *cb = data;
>> +	struct bt_rap *rap = user_data;
>> +
>> +	cb->detached(rap, cb->user_data);
>> +}
>> +
>> +void bt_rap_detach(struct bt_rap *rap)
>> +{
>> +	if (!queue_remove(sessions, rap))
>> +		return;
>> +
>> +	bt_gatt_client_idle_unregister(rap->client, rap->idle_id);
>> +	bt_gatt_client_unref(rap->client);
>> +	rap->client = NULL;
>> +
>> +	queue_foreach(bt_rap_cbs, rap_detached, rap);
>> +}
>> +
>> +static void rap_db_free(void *data)
>> +{
>> +	struct bt_rap_db *rapdb = data;
>> +
>> +	if (!rapdb)
>> +		return;
>> +
>> +	gatt_db_unref(rapdb->db);
>> +
>> +	free(rapdb->ras);
>> +	free(rapdb);
>> +}
>> +
>> +static void rap_ready_free(void *data)
>> +{
>> +	struct bt_rap_ready *ready = data;
>> +
>> +	if (ready->destroy)
>> +		ready->destroy(ready->data);
>> +
>> +	free(ready);
>> +}
>> +
>> +static void rap_free(void *data)
>> +{
>> +	struct bt_rap *rap = data;
>> +
>> +	bt_rap_detach(rap);
>> +
>> +	rap_db_free(rap->rrapdb);
>> +
>> +	queue_destroy(rap->notify, free);
>> +	queue_destroy(rap->pending, NULL);
>> +	queue_destroy(rap->ready_cbs, rap_ready_free);
>> +
>> +	free(rap);
>> +}
>> +
>> +bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data)
>> +{
>> +	if (!rap)
>> +		return false;
>> +
>> +	rap->user_data = user_data;
>> +
>> +	return true;
>> +}
>> +
>> +static bool rap_db_match(const void *data, const void *match_data)
>> +{
>> +	const struct bt_rap_db *rapdb = data;
>> +	const struct gatt_db *db = match_data;
>> +
>> +	return rapdb->db == db;
>> +}
>> +
>> +struct bt_att *bt_rap_get_att(struct bt_rap *rap)
>> +{
>> +	if (!rap)
>> +		return NULL;
>> +
>> +	if (rap->att)
>> +		return rap->att;
>> +
>> +	return bt_gatt_client_get_att(rap->client);
>> +}
>> +
>> +struct bt_rap *bt_rap_ref(struct bt_rap *rap)
>> +{
>> +	if (!rap)
>> +		return NULL;
>> +
>> +	__sync_fetch_and_add(&rap->ref_count, 1);
>> +
>> +	return rap;
>> +}
>> +
>> +void bt_rap_unref(struct bt_rap *rap)
>> +{
>> +	if (!rap)
>> +		return;
>> +
>> +	if (__sync_sub_and_fetch(&rap->ref_count, 1))
>> +		return;
>> +
>> +	rap_free(rap);
>> +}
>> +
>> +static void rap_debug(struct bt_rap *rap, const char *format, ...)
>> +{
>> +	va_list ap;
>> +
>> +	if (!rap || !format || !rap->debug_func)
>> +		return;
>> +
>> +	va_start(ap, format);
>> +	util_debug_va(rap->debug_func, rap->debug_data, format, ap);
>> +	va_end(ap);
>> +}
>> +
>> +bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
>> +			void *user_data, bt_rap_destroy_func_t
>> destroy)
>> +{
>> +	if (!rap)
>> +		return false;
>> +
>> +	if (rap->debug_destroy)
>> +		rap->debug_destroy(rap->debug_data);
>> +
>> +	rap->debug_func = func;
>> +	rap->debug_destroy = destroy;
>> +	rap->debug_data = user_data;
>> +
>> +	return true;
>> +}
>> +
>> +static void ras_features_read_cb(struct gatt_db_attribute *attrib,
>> +				 unsigned int id, uint16_t offset,
>> +				 uint8_t opcode, struct bt_att *att,
>> +				 void *user_data)
>> +{
>> +	/*
>> +	 * Feature mask: bits 0-2 set:
>> +	 *  - Real-time ranging
>> +	 *  - Retrieve stored results
>> +	 *  - Abort operation
>> +	 */
>> +	uint8_t value[4] = { 0x01, 0x00, 0x00, 0x00 };
>> +
>> +	gatt_db_attribute_read_result(attrib, id, 0, value,
>> sizeof(value));
>> +}
>> +
>> +static void ras_realtime_read_cb(struct gatt_db_attribute *attrib,
>> +				 unsigned int id, uint16_t offset,
>> +				 uint8_t opcode, struct bt_att *att,
>> +				 void *user_data)
>> +{
>> +	/* No static read data; real-time data is provided via
>> notifications. */
>> +	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
>> +}
>> +
>> +static void ras_ondemand_read_cb(struct gatt_db_attribute *attrib,
>> +				 unsigned int id, uint16_t offset,
>> +				 uint8_t opcode, struct bt_att *att,
>> +				 void *user_data)
>> +{
>> +	/* No static read data – on‑demand data is pushed via
>> +	 * notifications
>> +	 */
>> +	gatt_db_attribute_read_result(attrib, id, 0, NULL, 0);
>> +}
>> +
>> +/*
>> + * Control point handler.
>> + * Parses the opcode and acts on queued data (implementation TBD).
>> + */
>> +static void ras_control_point_write_cb(struct gatt_db_attribute
>> *attrib,
>> +				       unsigned int id, uint16_t
>> offset,
>> +				       const uint8_t *value, size_t
>> len,
>> +				       uint8_t opcode, struct bt_att
>> *att,
>> +				       void *user_data)
>> +{
>> +	/* Control point handler - implementation TBD */
>> +}
>> +
>> +/* Data Ready – returns the latest ranging counter. */
>> +static void ras_data_ready_read_cb(struct gatt_db_attribute *attrib,
>> +				   unsigned int id, uint16_t offset,
>> +				   uint8_t opcode, struct bt_att
>> *att,
>> +				   void *user_data)
>> +{
>> +	uint16_t counter = 0;
>> +	uint8_t value[2];
>> +
>> +	put_le16(counter, value);
>> +	gatt_db_attribute_read_result(attrib, id, 0, value,
>> sizeof(value));
>> +}
>> +
>> +/* Data Overwritten – indicates how many results were overwritten.
>> */
>> +static void ras_data_overwritten_read_cb(struct gatt_db_attribute
>> *attrib,
>> +					 unsigned int id, uint16_t
>> offset,
>> +					 uint8_t opcode, struct
>> bt_att *att,
>> +					 void *user_data)
>> +{
>> +	uint8_t value[2] = { 0x00, 0x00 };
>> +
>> +	gatt_db_attribute_read_result(attrib, id, 0, value,
>> sizeof(value));
>> +}
>> +
>> +/* Service registration – store attribute pointers */
>> +static struct ras *register_ras_service(struct gatt_db *db)
>> +{
>> +	struct ras *ras;
>> +	struct gatt_db_attribute *service;
>> +	bt_uuid_t uuid;
>> +
>> +	if (!db)
>> +		return NULL;
>> +
>> +	ras = new0(struct ras, 1);
>> +	if (!ras)
>> +		return NULL;
>> +
>> +	/* Primary RAS service */
>> +	bt_uuid16_create(&uuid, RAS_UUID16);
>> +	service = gatt_db_add_service(db, &uuid, true,
>> RAS_TOTAL_NUM_HANDLES);
>> +	if (!service) {
>> +		free(ras);
>> +		return NULL;
>> +	}
>> +
>> +	ras->svc = service;
>> +
>> +	/* RAS Features */
>> +	bt_uuid16_create(&uuid, RAS_FEATURES_UUID);
>> +		ras->feat_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_READ |
>> +						
>> BT_ATT_PERM_READ_ENCRYPT,
>> +						
>> BT_GATT_CHRC_PROP_READ,
>> +						
>> ras_features_read_cb,
>> +						  NULL, ras);
>> +
>> +	/* Real-time Ranging Data */
>> +	bt_uuid16_create(&uuid, RAS_REALTIME_DATA_UUID);
>> +	ras->realtime_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_READ |
>> +						
>> BT_ATT_PERM_READ_ENCRYPT,
>> +						
>> BT_GATT_CHRC_PROP_NOTIFY |
>> +						
>> BT_GATT_CHRC_PROP_INDICATE,
>> +						  NULL, NULL, ras);
>> +
>> +	ras->realtime_chrc_ccc =
>> +		gatt_db_service_add_ccc(ras->svc,
>> +					BT_ATT_PERM_READ |
>> +					BT_ATT_PERM_WRITE);
>> +
>> +	/* On-demand Ranging Data */
>> +	bt_uuid16_create(&uuid, RAS_ONDEMAND_DATA_UUID);
>> +	ras->ondemand_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_READ |
>> +						
>> BT_ATT_PERM_READ_ENCRYPT,
>> +						
>> BT_GATT_CHRC_PROP_NOTIFY |
>> +						
>> BT_GATT_CHRC_PROP_INDICATE,
>> +						
>> ras_ondemand_read_cb, NULL,
>> +						  ras);
>> +
>> +	gatt_db_service_add_ccc(ras->svc,
>> +				BT_ATT_PERM_READ |
>> BT_ATT_PERM_WRITE);
>> +
>> +	/* RAS Control Point */
>> +	bt_uuid16_create(&uuid, RAS_CONTROL_POINT_UUID);
>> +	ras->cp_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_WRITE
>> |
>> +						
>> BT_ATT_PERM_WRITE_ENCRYPT,
>> +				BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP
>> |
>> +						
>> BT_GATT_CHRC_PROP_INDICATE,
>> +						  NULL,
>> +						
>> ras_control_point_write_cb,
>> +						  ras);
>> +
>> +	gatt_db_service_add_ccc(ras->svc,
>> +				BT_ATT_PERM_READ |
>> BT_ATT_PERM_WRITE);
>> +
>> +	/* RAS Data Ready */
>> +	bt_uuid16_create(&uuid, RAS_DATA_READY_UUID);
>> +	ras->ready_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_READ |
>> +						
>> BT_ATT_PERM_READ_ENCRYPT,
>> +						
>> BT_GATT_CHRC_PROP_READ |
>> +						
>> BT_GATT_CHRC_PROP_NOTIFY |
>> +						
>> BT_GATT_CHRC_PROP_INDICATE,
>> +						
>> ras_data_ready_read_cb, NULL,
>> +						  ras);
>> +
>> +	gatt_db_service_add_ccc(ras->svc,
>> +				BT_ATT_PERM_READ |
>> BT_ATT_PERM_WRITE);
>> +
>> +	/* RAS Data Overwritten */
>> +	bt_uuid16_create(&uuid, RAS_DATA_OVERWRITTEN_UUID);
>> +	ras->overwritten_chrc =
>> +		gatt_db_service_add_characteristic(ras->svc, &uuid,
>> +						  BT_ATT_PERM_READ |
>> +						
>> BT_ATT_PERM_READ_ENCRYPT,
>> +						
>> BT_GATT_CHRC_PROP_READ |
>> +						
>> BT_GATT_CHRC_PROP_NOTIFY |
>> +						
>> BT_GATT_CHRC_PROP_INDICATE,
>> +						
>> ras_data_overwritten_read_cb,
>> +						  NULL, ras);
>> +
>> +	gatt_db_service_add_ccc(ras->svc,
>> +				BT_ATT_PERM_READ |
>> BT_ATT_PERM_WRITE);
>> +
>> +	/* Activate the service */
>> +	gatt_db_service_set_active(ras->svc, true);
>> +
>> +	return ras;
>> +}
>> +
>> +static struct bt_rap_db *rap_db_new(struct gatt_db *db)
>> +{
>> +	struct bt_rap_db *rapdb;
>> +
>> +	if (!db)
>> +		return NULL;
>> +
>> +	rapdb = new0(struct bt_rap_db, 1);
>> +	if (!rapdb)
>> +		return NULL;
>> +
>> +	rapdb->db = gatt_db_ref(db);
>> +
>> +	if (!rap_db)
>> +		rap_db = queue_new();
>> +
>> +	rapdb->ras = register_ras_service(db);
>> +	if (rapdb->ras)
>> +		rapdb->ras->rapdb = rapdb;
>> +
>> +	queue_push_tail(rap_db, rapdb);
>> +
>> +	return rapdb;
>> +}
>> +
>> +static struct bt_rap_db *rap_get_db(struct gatt_db *db)
>> +{
>> +	struct bt_rap_db *rapdb;
>> +
>> +	rapdb = queue_find(rap_db, rap_db_match, db);
>> +	if (rapdb)
>> +		return rapdb;
>> +
>> +	return rap_db_new(db);
>> +}
>> +
>> +void bt_rap_add_db(struct gatt_db *db)
>> +{
>> +	rap_db_new(db);
>> +}
>> +
>> +unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t
>> detached,
>> +			     void *user_data)
>> +{
>> +	struct bt_rap_cb *cb;
>> +	static unsigned int id;
>> +
>> +	if (!attached && !detached)
>> +		return 0;
>> +
>> +	if (!bt_rap_cbs)
>> +		bt_rap_cbs = queue_new();
>> +
>> +	cb = new0(struct bt_rap_cb, 1);
>> +	cb->id = ++id ? id : ++id;
>> +	cb->attached = attached;
>> +	cb->detached = detached;
>> +	cb->user_data = user_data;
>> +
>> +	queue_push_tail(bt_rap_cbs, cb);
>> +
>> +	return cb->id;
>> +}
>> +
>> +static bool match_id(const void *data, const void *match_data)
>> +{
>> +	const struct bt_rap_cb *cb = data;
>> +	unsigned int id = PTR_TO_UINT(match_data);
>> +
>> +	return cb->id == id;
>> +}
>> +
>> +bool bt_rap_unregister(unsigned int id)
>> +{
>> +	struct bt_rap_cb *cb;
>> +
>> +	cb = queue_remove_if(bt_rap_cbs, match_id, UINT_TO_PTR(id));
>> +	if (!cb)
>> +		return false;
>> +
>> +	free(cb);
>> +
>> +	return true;
>> +}
>> +
>> +struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb)
>> +{
>> +	struct bt_rap *rap;
>> +	struct bt_rap_db *rapdb;
>> +
>> +	if (!ldb)
>> +		return NULL;
>> +
>> +	rapdb = rap_get_db(ldb);
>> +	if (!rapdb)
>> +		return NULL;
>> +
>> +	rap = new0(struct bt_rap, 1);
>> +	rap->lrapdb = rapdb;
>> +	rap->pending = queue_new();
>> +	rap->ready_cbs = queue_new();
>> +	rap->notify = queue_new();
>> +
>> +	if (!rdb)
>> +		goto done;
>> +
>> +	rapdb = new0(struct bt_rap_db, 1);
>> +	rapdb->db = gatt_db_ref(rdb);
>> +
>> +	rap->rrapdb = rapdb;
>> +
>> +done:
>> +	bt_rap_ref(rap);
>> +
>> +	return rap;
>> +}
>> +
>> +static void rap_pending_destroy(void *data)
>> +{
>> +	struct bt_rap_pending *pending = data;
>> +	struct bt_rap *rap = pending->rap;
>> +
>> +	if (queue_remove_if(rap->pending, NULL, pending))
>> +		free(pending);
>> +}
>> +
>> +static void rap_pending_complete(bool success, uint8_t att_ecode,
>> +				 const uint8_t *value, uint16_t
>> length,
>> +				 void *user_data)
>> +{
>> +	struct bt_rap_pending *pending = user_data;
>> +
>> +	if (pending->func)
>> +		pending->func(pending->rap, success, att_ecode,
>> value,
>> +			      length, pending->userdata);
>> +}
>> +
>> +static void rap_register(uint16_t att_ecode, void *user_data)
>> +{
>> +	struct bt_rap_notify *notify = user_data;
>> +
>> +	if (att_ecode)
>> +		DBG(notify->rap, "RAS register failed 0x%04x",
>> att_ecode);
>> +}
>> +
>> +static void rap_notify(uint16_t value_handle, const uint8_t *value,
>> +		       uint16_t length, void *user_data)
>> +{
>> +	struct bt_rap_notify *notify = user_data;
>> +
>> +	if (notify->func)
>> +		notify->func(notify->rap, value_handle, value,
>> length,
>> +			     notify->user_data);
>> +}
>> +
>> +static void rap_notify_destroy(void *data)
>> +{
>> +	struct bt_rap_notify *notify = data;
>> +	struct bt_rap *rap = notify->rap;
>> +
>> +	if (queue_remove_if(rap->notify, NULL, notify))
>> +		free(notify);
>> +}
>> +
>> +static unsigned int bt_rap_register_notify(struct bt_rap *rap,
>> +					   uint16_t value_handle,
>> +					   rap_notify_t func,
>> +					   void *user_data)
>> +{
>> +	struct bt_rap_notify *notify;
>> +
>> +	notify = new0(struct bt_rap_notify, 1);
>> +	notify->rap = rap;
>> +	notify->func = func;
>> +	notify->user_data = user_data;
>> +
>> +	notify->id = bt_gatt_client_register_notify(rap->client,
>> +						    value_handle,
>> +						    rap_register,
>> +						    rap_notify,
>> +						    notify,
>> +						
>> rap_notify_destroy);
>> +	if (!notify->id) {
>> +		DBG(rap, "Unable to register for notifications");
>> +		free(notify);
>> +		return 0;
>> +	}
>> +
>> +	queue_push_tail(rap->notify, notify);
>> +
>> +	return notify->id;
>> +}
>> +
>> +static void foreach_rap_char(struct gatt_db_attribute *attr, void
>> *user_data)
>> +{
>> +	struct bt_rap *rap = user_data;
>> +	uint16_t value_handle;
>> +	bt_uuid_t uuid;
>> +	bt_uuid_t uuid_features;
>> +	bt_uuid_t uuid_realtime;
>> +	bt_uuid_t uuid_ondemand;
>> +	bt_uuid_t uuid_cp;
>> +	bt_uuid_t uuid_dataready;
>> +	bt_uuid_t uuid_overwritten;
>> +	struct ras *ras;
>> +
>> +	if (!gatt_db_attribute_get_char_data(attr, NULL,
>> &value_handle,
>> +					     NULL, NULL, &uuid))
>> +		return;
>> +
>> +	bt_uuid16_create(&uuid_features, RAS_FEATURES_UUID);
>> +	bt_uuid16_create(&uuid_realtime, RAS_REALTIME_DATA_UUID);
>> +	bt_uuid16_create(&uuid_ondemand, RAS_ONDEMAND_DATA_UUID);
>> +	bt_uuid16_create(&uuid_cp, RAS_CONTROL_POINT_UUID);
>> +	bt_uuid16_create(&uuid_dataready, RAS_DATA_READY_UUID);
>> +	bt_uuid16_create(&uuid_overwritten,
>> RAS_DATA_OVERWRITTEN_UUID);
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_features)) {
>> +		DBG(rap, "Features characteristic found: handle
>> 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->feat_chrc)
>> +			return;
>> +
>> +		ras->feat_chrc = attr;
>> +	}
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_realtime)) {
>> +		DBG(rap, "Real Time Data characteristic found:
>> handle 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->realtime_chrc)
>> +			return;
>> +
>> +		ras->realtime_chrc = attr;
>> +	}
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_ondemand)) {
>> +		DBG(rap, "On-demand Data characteristic found:
>> handle 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->ondemand_chrc)
>> +			return;
>> +
>> +		ras->ondemand_chrc = attr;
>> +	}
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_cp)) {
>> +		DBG(rap, "Control Point characteristic found: handle
>> 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->cp_chrc)
>> +			return;
>> +
>> +		ras->cp_chrc = attr;
>> +	}
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_dataready)) {
>> +		DBG(rap, "Data Ready characteristic found: handle
>> 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->ready_chrc)
>> +			return;
>> +
>> +		ras->ready_chrc = attr;
>> +	}
>> +
>> +	if (!bt_uuid_cmp(&uuid, &uuid_overwritten)) {
>> +		DBG(rap, "Overwritten characteristic found: handle
>> 0x%04x",
>> +		    value_handle);
>> +
>> +		ras = rap_get_ras(rap);
>> +		if (!ras || ras->overwritten_chrc)
>> +			return;
>> +
>> +		ras->overwritten_chrc = attr;
>> +	}
>> +}
>> +
>> +static void foreach_rap_service(struct gatt_db_attribute *attr,
>> +				void *user_data)
>> +{
>> +	struct bt_rap *rap = user_data;
>> +	struct ras *ras = rap_get_ras(rap);
>> +
>> +	ras->svc = attr;
>> +
>> +	gatt_db_service_set_claimed(attr, true);
>> +
>> +	gatt_db_service_foreach_char(attr, foreach_rap_char, rap);
>> +}
>> +
>> +unsigned int bt_rap_ready_register(struct bt_rap *rap,
>> +				   bt_rap_ready_func_t func, void
>> *user_data,
>> +				   bt_rap_destroy_func_t destroy)
>> +{
>> +	struct bt_rap_ready *ready;
>> +	static unsigned int id;
>> +
>> +	if (!rap)
>> +		return 0;
>> +
>> +	DBG(rap, "bt_rap_ready_register");
>> +
>> +	ready = new0(struct bt_rap_ready, 1);
>> +	ready->id = ++id ? id : ++id;
>> +	ready->func = func;
>> +	ready->destroy = destroy;
>> +	ready->data = user_data;
>> +
>> +	queue_push_tail(rap->ready_cbs, ready);
>> +
>> +	return ready->id;
>> +}
>> +
>> +static bool match_ready_id(const void *data, const void *match_data)
>> +{
>> +	const struct bt_rap_ready *ready = data;
>> +	unsigned int id = PTR_TO_UINT(match_data);
>> +
>> +	return ready->id == id;
>> +}
>> +
>> +bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id)
>> +{
>> +	struct bt_rap_ready *ready;
>> +
>> +	ready = queue_remove_if(rap->ready_cbs, match_ready_id,
>> +				UINT_TO_PTR(id));
>> +	if (!ready)
>> +		return false;
>> +
>> +	rap_ready_free(ready);
>> +
>> +	return true;
>> +}
>> +
>> +static struct bt_rap *bt_rap_ref_safe(struct bt_rap *rap)
>> +{
>> +	if (!rap || !rap->ref_count)
>> +		return NULL;
>> +
>> +	return bt_rap_ref(rap);
>> +}
>> +
>> +static void rap_notify_ready(struct bt_rap *rap)
>> +{
>> +	const struct queue_entry *entry;
>> +
>> +	if (!bt_rap_ref_safe(rap))
>> +		return;
>> +
>> +	for (entry = queue_get_entries(rap->ready_cbs); entry;
>> +	     entry = entry->next) {
>> +		struct bt_rap_ready *ready = entry->data;
>> +
>> +		ready->func(rap, ready->data);
>> +	}
>> +
>> +	bt_rap_unref(rap);
>> +}
>> +
>> +static void rap_idle(void *data)
>> +{
>> +	struct bt_rap *rap = data;
>> +
>> +	rap->idle_id = 0;
>> +	rap_notify_ready(rap);
>> +}
>> +
>> +bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client
>> *client)
>> +{
>> +	bt_uuid_t uuid;
>> +
>> +	if (!sessions)
>> +		sessions = queue_new();
>> +
>> +	queue_push_tail(sessions, rap);
>> +
>> +	if (!client)
>> +		return true;
>> +
>> +	if (rap->client)
>> +		return false;
>> +
>> +	rap->client = bt_gatt_client_clone(client);
>> +	if (!rap->client)
>> +		return false;
>> +
>> +	bt_gatt_client_idle_register(rap->client, rap_idle, rap,
>> NULL);
>> +
>> +	bt_uuid16_create(&uuid, RAS_UUID16);
>> +
>> +	gatt_db_foreach_service(rap->lrapdb->db, &uuid,
>> +				foreach_rap_service, rap);
>> +
>> +	return true;
>> +}
>> diff --git a/src/shared/rap.h b/src/shared/rap.h
>> new file mode 100644
>> index 000000000..488172ac6
>> --- /dev/null
>> +++ b/src/shared/rap.h
>> @@ -0,0 +1,48 @@
>> +// SPDX-License-Identifier: LGPL-2.1-or-later
>> +/*
>> + * BlueZ - Bluetooth protocol stack for Linux
>> + *
>> + * Copyright (c) Qualcomm Technologies, Inc. and/or its
>> subsidiaries.
>> + */
>> +
>> +#include <stdbool.h>
>> +#include <inttypes.h>
>> +
>> +#include "src/shared/io.h"
>> +#include "src/shared/gatt-client.h"
>> +#include "src/shared/gatt-server.h"
>> +
>> +
>> +struct bt_rap;
>> +
>> +typedef void (*bt_rap_debug_func_t)(const char *str, void
>> *user_data);
>> +typedef void (*bt_rap_ready_func_t)(struct bt_rap *rap, void
>> *user_data);
>> +typedef void (*bt_rap_destroy_func_t)(void *user_data);
>> +typedef void (*bt_rap_func_t)(struct bt_rap *rap, void *user_data);
>> +
>> +struct bt_rap *bt_rap_ref(struct bt_rap *rap);
>> +void bt_rap_unref(struct bt_rap *rap);
>> +
>> +void bt_rap_add_db(struct gatt_db *db);
>> +
>> +bool bt_rap_attach(struct bt_rap *rap, struct bt_gatt_client
>> *client);
>> +void bt_rap_detach(struct bt_rap *rap);
>> +
>> +struct bt_att *bt_rap_get_att(struct bt_rap *rap);
>> +
>> +bool bt_rap_set_user_data(struct bt_rap *rap, void *user_data);
>> +
>> +bool bt_rap_set_debug(struct bt_rap *rap, bt_rap_debug_func_t func,
>> +			void *user_data, bt_rap_destroy_func_t
>> destroy);
>> +
>> +/* session related functions */
>> +unsigned int bt_rap_register(bt_rap_func_t attached, bt_rap_func_t
>> detached,
>> +					void *user_data);
>> +unsigned int bt_rap_ready_register(struct bt_rap *rap,
>> +				bt_rap_ready_func_t func, void
>> *user_data,
>> +				bt_rap_destroy_func_t destroy);
>> +bool bt_rap_ready_unregister(struct bt_rap *rap, unsigned int id);
>> +
>> +bool bt_rap_unregister(unsigned int id);
>> +
>> +struct bt_rap *bt_rap_new(struct gatt_db *ldb, struct gatt_db *rdb);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-25 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 11:21 [PATCH BlueZ] Implement the Bluetooth Ranging Profile GATT server and client support as specified by the Bluetooth SIG: Prathibha Madugonde
2026-01-23 11:41 ` [BlueZ] " bluez.test.bot
2026-01-23 13:28 ` [PATCH BlueZ] " Bastien Nocera
2026-01-25 17:23   ` Prathibha Madugonde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox