summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-manager.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-16 10:09:05 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-16 10:09:05 +0000
commit424e98b0d14ffe676fb478ed48d083fced91e111 (patch)
tree4dedd1fa42410bf75e120f10a5dacae0f2e0a5a5 /hcid/dbus-manager.c
parentd25a07673af6e6320baa7380eca777533b67c1ef (diff)
Implement FindService method
Diffstat (limited to 'hcid/dbus-manager.c')
-rw-r--r--hcid/dbus-manager.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c
index 83363c73..ae180cc6 100644
--- a/hcid/dbus-manager.c
+++ b/hcid/dbus-manager.c
@@ -198,7 +198,26 @@ static DBusHandlerResult list_adapters(DBusConnection *conn,
static DBusHandlerResult find_service(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ DBusMessage *reply;
+ const char *pattern, *path;
+
+ if (!dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_STRING, &pattern,
+ DBUS_TYPE_INVALID))
+ return error_invalid_arguments(conn, msg);
+
+ path = search_service(conn, pattern);
+ if (!path)
+ return error_no_such_service(conn, msg);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &path,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
}
static DBusHandlerResult list_services(DBusConnection *conn,