From c0d584d1601428806c63cd4426bcf4226849e6b2 Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Thu, 23 Dec 2010 05:39:41 +0100 Subject: stk: Send the AlphaId's to agent Terminate session if return signature doesn't match but allow agent to return from the call if it does match. --- src/stkagent.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/stkagent.c') diff --git a/src/stkagent.c b/src/stkagent.c index e1a6f483..2cdc6e16 100644 --- a/src/stkagent.c +++ b/src/stkagent.c @@ -964,3 +964,52 @@ int stk_agent_loop_tone(struct stk_agent *agent, const char *text, return 0; } + +static void action_info_cb(DBusPendingCall *call, void *data) +{ + struct stk_agent *agent = data; + DBusMessage *reply = dbus_pending_call_steal_reply(call); + enum stk_agent_result result; + gboolean remove_agent; + + if (check_error(agent, reply, 0, &result) == -EINVAL) { + remove_agent = TRUE; + goto error; + } + + if (dbus_message_get_args(reply, NULL, DBUS_TYPE_INVALID) == FALSE) { + ofono_error("Can't parse the reply to DisplayActionInfo()"); + remove_agent = TRUE; + goto error; + } + + goto done; + + CALLBACK_END(); +} + +int stk_agent_display_action_info(struct stk_agent *agent, const char *text, + const struct stk_icon_id *icon) +{ + DBusConnection *conn = ofono_dbus_get_connection(); + + agent->msg = dbus_message_new_method_call(agent->bus, agent->path, + OFONO_SIM_APP_INTERFACE, + "DisplayActionInformation"); + if (agent->msg == NULL) + return -ENOMEM; + + dbus_message_append_args(agent->msg, + DBUS_TYPE_STRING, &text, + DBUS_TYPE_BYTE, &icon->id, + DBUS_TYPE_INVALID); + + if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call, + 0) == FALSE || + agent->call == NULL) + return -EIO; + + dbus_pending_call_set_notify(agent->call, action_info_cb, agent, NULL); + + return 0; +} -- cgit v1.2.3