Diff between 8bec4a69161f9cbf97cd2d9f1b04be4331149fd8 and 24998ea93418daafa83e86275c664b2fdd1b0f4a

Changed Files

File Additions Deletions Status
src/device.c +20 -0 modified
src/device.h +2 -0 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 01c40a7..77466ff 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4020,6 +4020,26 @@ gboolean device_is_authenticating(struct btd_device *device)
 	return (device->authr != NULL);
 }
 
+static int primary_uuid_cmp(gconstpointer a, gconstpointer b)
+{
+	const struct gatt_primary *prim = a;
+	const char *uuid = b;
+
+	return strcasecmp(prim->uuid, uuid);
+}
+
+struct gatt_primary *btd_device_get_primary(struct btd_device *device,
+							const char *uuid)
+{
+	GSList *match;
+
+	match = g_slist_find_custom(device->primaries, uuid, primary_uuid_cmp);
+	if (match)
+		return match->data;
+
+	return NULL;
+}
+
 GSList *btd_device_get_primaries(struct btd_device *device)
 {
 	return device->primaries;
diff --git a/src/device.h b/src/device.h
index b9e20cc..8534117 100644
--- a/src/device.h
+++ b/src/device.h
@@ -46,6 +46,8 @@ GSList *device_get_uuids(struct btd_device *device);
 void device_probe_profiles(struct btd_device *device, GSList *profiles);
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 						const char *uuid);
+struct gatt_primary *btd_device_get_primary(struct btd_device *device,
+							const char *uuid);
 GSList *btd_device_get_primaries(struct btd_device *device);
 void btd_device_gatt_set_service_changed(struct btd_device *device,
 						uint16_t start, uint16_t end);