* [PATCH BlueZ] src/device: Add ConnectedUUIDs property
@ 2026-04-10 8:59 294305068
2026-04-10 10:51 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: 294305068 @ 2026-04-10 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: caitao
From: caitao <caitao@kylinos.cn>
Add a new D-Bus property "ConnectedUUIDs" (array of strings, read-only)
to the org.bluez.Device interface. This property tracks the UUIDs of
profiles that are currently connected on the device.
The property is updated dynamically when a service state changes to
CONNECTED or DISCONNECTED.
---
doc/org.bluez.Device.rst | 5 +++
src/device.c | 72 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
diff --git a/doc/org.bluez.Device.rst b/doc/org.bluez.Device.rst
index 3e6a30aaf..c592afbd5 100644
--- a/doc/org.bluez.Device.rst
+++ b/doc/org.bluez.Device.rst
@@ -284,6 +284,11 @@ array{string} UUIDs [readonly, optional]
List of 128-bit UUIDs that represents the available remote services.
+array{string} ConnectedUUIDs [readonly]
+````````````````````````````````````````
+
+List of 128-bit UUIDs of profiles currently connected.
+
boolean Paired [readonly]
`````````````````````````
diff --git a/src/device.c b/src/device.c
index bb5bcd4f0..3bb244b98 100644
--- a/src/device.c
+++ b/src/device.c
@@ -244,6 +244,7 @@ struct btd_device {
char *modalias;
struct btd_adapter *adapter;
GSList *uuids;
+ GSList *connected_uuids; /* Currently connected UUIDs */
GSList *primaries; /* List of primary services */
GSList *services; /* List of btd_service */
GSList *pending; /* Pending services */
@@ -910,6 +911,7 @@ static void device_free(gpointer user_data)
device->client_dbus = NULL;
g_slist_free_full(device->uuids, g_free);
+ g_slist_free_full(device->connected_uuids, g_free);
g_slist_free_full(device->primaries, g_free);
g_slist_free_full(device->svc_callbacks, svc_dev_remove);
@@ -1464,6 +1466,70 @@ static gboolean dev_property_get_uuids(const GDBusPropertyTable *property,
return TRUE;
}
+static GSList *device_get_connected_uuids(struct btd_device *device)
+{
+ return device->connected_uuids;
+}
+
+static gboolean property_get_connected_uuids(const GDBusPropertyTable *property,
+ DBusMessageIter *iter,
+ void *data)
+{
+ struct btd_device *device = data;
+ GSList *l, *uuids = device_get_connected_uuids(device);
+ DBusMessageIter array_iter;
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING,
+ &array_iter);
+
+ for (l = uuids; l; l = g_slist_next(l)) {
+ const char *uuid = l->data;
+ dbus_message_iter_append_basic(&array_iter,
+ DBUS_TYPE_STRING,
+ &uuid);
+ }
+
+ dbus_message_iter_close_container(iter, &array_iter);
+ return TRUE;
+}
+
+static void device_add_connected_uuid(struct btd_device *device, const char *uuid)
+{
+ if (!device || !uuid)
+ return;
+
+ if (g_slist_find_custom(device->connected_uuids, uuid,
+ (GCompareFunc)strcmp))
+ return;
+
+ device->connected_uuids = g_slist_append(device->connected_uuids,
+ g_strdup(uuid));
+
+ g_dbus_emit_property_changed(dbus_conn, device->path,
+ DEVICE_INTERFACE, "ConnectedUUIDs");
+}
+
+static void device_remove_connected_uuid(struct btd_device *device, const char *uuid)
+{
+ GSList *match;
+
+ if (!device || !uuid)
+ return;
+
+ match = g_slist_find_custom(device->connected_uuids, uuid,
+ (GCompareFunc)strcmp);
+ if (!match)
+ return;
+
+ g_free(match->data);
+ device->connected_uuids = g_slist_delete_link(device->connected_uuids,
+ match);
+
+ g_dbus_emit_property_changed(dbus_conn, device->path,
+ DEVICE_INTERFACE, "ConnectedUUIDs");
+}
+
static gboolean dev_property_get_modalias(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
@@ -3715,6 +3781,7 @@ static const GDBusPropertyTable device_properties[] = {
{ "RSSI", "n", dev_property_get_rssi, NULL, dev_property_exists_rssi },
{ "Connected", "b", dev_property_get_connected },
{ "UUIDs", "as", dev_property_get_uuids },
+ { "ConnectedUUIDs", "as", property_get_connected_uuids },
{ "Modalias", "s", dev_property_get_modalias, NULL,
dev_property_exists_modalias },
{ "Adapter", "o", dev_property_get_adapter },
@@ -8231,6 +8298,11 @@ static void service_state_changed(struct btd_service *service,
device_profile_connected(device, profile, err);
else if (old_state == BTD_SERVICE_STATE_DISCONNECTING)
device_profile_disconnected(device, profile, err);
+
+ if (new_state == BTD_SERVICE_STATE_CONNECTED)
+ device_add_connected_uuid(device, profile->remote_uuid);
+ else if (new_state == BTD_SERVICE_STATE_DISCONNECTED)
+ device_remove_connected_uuid(device, profile->remote_uuid);
}
struct btd_service *btd_device_get_service(struct btd_device *dev,
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [BlueZ] src/device: Add ConnectedUUIDs property
2026-04-10 8:59 [PATCH BlueZ] src/device: Add ConnectedUUIDs property 294305068
@ 2026-04-10 10:51 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-04-10 10:51 UTC (permalink / raw)
To: linux-bluetooth, 294305068
[-- Attachment #1: Type: text/plain, Size: 1303 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=1079646
---Test result---
Test Summary:
CheckPatch PENDING 0.33 seconds
GitLint PENDING 0.34 seconds
BuildEll PASS 20.02 seconds
BluezMake PASS 633.80 seconds
MakeCheck PASS 19.08 seconds
MakeDistcheck PASS 243.43 seconds
CheckValgrind PASS 290.97 seconds
CheckSmatch PASS 344.92 seconds
bluezmakeextell PASS 179.46 seconds
IncrementalBuild PENDING 0.33 seconds
ScanBuild PASS 996.34 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
https://github.com/bluez/bluez/pull/2028
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-10 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 8:59 [PATCH BlueZ] src/device: Add ConnectedUUIDs property 294305068
2026-04-10 10:51 ` [BlueZ] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox