diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-03-10 19:00:05 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-03-10 19:00:05 +0000 |
commit | fc2b76f42d970db748de8ea4433406f66d9584a3 (patch) | |
tree | e5168bbf1a5387ec842fc58b58658eda67bbe5e9 /hcid/passkey-agent.c | |
parent | e74876f86a31c5bb6a04a8a091b6ecddba26055f (diff) |
Add method reply handling for passkey request
Diffstat (limited to 'hcid/passkey-agent.c')
-rw-r--r-- | hcid/passkey-agent.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/hcid/passkey-agent.c b/hcid/passkey-agent.c index 7c1b73c2..b7eeb068 100644 --- a/hcid/passkey-agent.c +++ b/hcid/passkey-agent.c @@ -35,6 +35,8 @@ static const char *agent_path = "/org/bluez/passkey-agent/"; +static char *passkey = "0000"; + static volatile sig_atomic_t __io_canceled = 0; static void sig_term(int sig) @@ -44,7 +46,26 @@ static void sig_term(int sig) DBusHandlerResult agent_message(DBusConnection *conn, DBusMessage *msg, void *data) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + DBusMessage *reply; + DBusMessageIter iter; + char *path, *address; + + dbus_message_iter_init(msg, &iter); + dbus_message_iter_get_basic(&iter, &path); + dbus_message_iter_get_basic(&iter, &address); + + reply = dbus_message_new_method_return(msg); + + dbus_message_iter_init_append(reply, &iter); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &passkey); + + dbus_connection_send(conn, reply, NULL); + + dbus_connection_flush(conn); + + dbus_message_unref(reply); + + return DBUS_HANDLER_RESULT_HANDLED; } static const DBusObjectPathVTable agent_table = { |