From 424e98b0d14ffe676fb478ed48d083fced91e111 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 16 Jan 2007 10:09:05 +0000 Subject: Implement FindService method --- hcid/dbus-service.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'hcid/dbus-service.c') diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 5a6d8199..4f935ff5 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -877,6 +877,30 @@ void release_services(DBusConnection *conn) services = NULL; } +const char *search_service(DBusConnection *conn, const char *pattern) +{ + GSList *l = services; + struct service *service; + const char *path; + + while (l) { + path = l->data; + + l = l->next; + + if (!dbus_connection_get_object_path_data(conn, path, (void *) &service)) + continue; + + if (!service) + continue; + + if (service->ident && !strcmp(service->ident, pattern)) + return path; + } + + return NULL; +} + void append_available_services(DBusMessageIter *array_iter) { GSList *l; -- cgit