stktest: Make DisplayText async and cancelable

This commit is contained in:
Denis Kenzior 2012-09-28 18:15:19 -05:00
parent dfdf7a2b9b
commit 1af931695a
1 changed files with 19 additions and 1 deletions

View File

@ -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) },
{ },
};