diff options
author | Denis Kenzior <denkenz@gmail.com> | 2012-09-28 18:15:19 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-10-03 09:10:43 -0500 |
commit | 1af931695ab104e0d856dc5c43496c90ec814716 (patch) | |
tree | aebc138aa5369935ba1720dd2b57d9412e806b98 /tools | |
parent | dfdf7a2b9bbdb3349bc161dc7aad1e6ed6669d70 (diff) | |
download | ofono-1af931695ab104e0d856dc5c43496c90ec814716.tar.bz2 |
stktest: Make DisplayText async and cancelable
Diffstat (limited to 'tools')
-rw-r--r-- | tools/stktest.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/stktest.c b/tools/stktest.c index cb1d1f3d..aebeaa51 100644 --- a/tools/stktest.c +++ b/tools/stktest.c @@ -90,6 +90,7 @@ static DBusConnection *conn; static gboolean ofono_running = FALSE; static guint modem_changed_watch; enum test_state state; +DBusMessage *pending = NULL; /* Emulator setup */ static guint server_watch; @@ -190,9 +191,25 @@ static DBusMessage *agent_release(DBusConnection *conn, DBusMessage *msg, { g_print("Got Release\n"); + if (pending) { + dbus_message_unref(pending); + pending = NULL; + } + return dbus_message_new_method_return(msg); } +static DBusMessage *agent_cancel(DBusConnection *conn, DBusMessage *msg, + void *data) +{ + if (pending) { + dbus_message_unref(pending); + pending = NULL; + } + + return NULL; +} + static DBusMessage *agent_display_text(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -831,10 +848,11 @@ static int get_modems(DBusConnection *conn) static const GDBusMethodTable agent_methods[] = { { GDBUS_METHOD("Release", NULL, NULL, agent_release) }, - { GDBUS_METHOD("DisplayText", + { GDBUS_ASYNC_METHOD("DisplayText", GDBUS_ARGS({ "text", "s" }, { "icon_id", "y" }, { "urgent", "b" }), NULL, agent_display_text) }, + { GDBUS_NOREPLY_METHOD("Cancel", NULL, NULL, agent_cancel) }, { }, }; |