From 181a211db506940ebdc18ee8707d85da6561f79e Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 11 Mar 2008 20:14:19 +0000 Subject: CreateDevice: Check if the device already exists --- hcid/device.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'hcid/device.c') diff --git a/hcid/device.c b/hcid/device.c index fa1b9b7e..f29e46a9 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -747,6 +747,22 @@ void device_foreach(GFunc func, gpointer user_data) g_slist_foreach(device_list, func, user_data); } +struct device *device_find(const gchar *address) +{ + GSList *l; + + if (!device_list || !address) + return NULL; + + for (l = device_list; l; l = l->next) { + struct device *device = l->data; + if (strcmp(device->address, address) == 0) + return device; + } + + return NULL; +} + static void device_free(struct device *device) { g_slist_foreach(device->uuids, (GFunc) g_free, NULL); -- cgit