diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-07-30 09:55:51 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-07-30 17:19:56 -0500 |
commit | e5ea6e2193062365eec7662d7866d306e8b56bcf (patch) | |
tree | 0f2268e9a0a3235381aa91bf05d0b72d6ac732ad | |
parent | e44d130b8c71bf7dfaabb79e21cf1fbd633e500d (diff) | |
download | ofono-e5ea6e2193062365eec7662d7866d306e8b56bcf.tar.bz2 |
stk: Handle the new termination semantics
The termination semantics were changed in stkagent. Now if an agent
sends an invalid response or an unexpected error, then the agent is
terminated, even if it is the default agent.
-rw-r--r-- | src/stk.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -414,12 +414,28 @@ static void stk_request_cancel(struct ofono_stk *stk) stk_agent_request_cancel(stk->default_agent); } +static gboolean agent_called(struct ofono_stk *stk) +{ + if (stk->pending_cmd == NULL) + return FALSE; + + switch (stk->pending_cmd->type) { + case STK_COMMAND_TYPE_SELECT_ITEM: + case STK_COMMAND_TYPE_DISPLAY_TEXT: + return TRUE; + } + + return FALSE; +} + static void default_agent_notify(gpointer user_data) { struct ofono_stk *stk = user_data; - stk->default_agent = NULL; + if (stk->current_agent == stk->default_agent && agent_called(stk)) + send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED); + stk->default_agent = NULL; stk->current_agent = stk->session_agent; } @@ -427,8 +443,10 @@ static void session_agent_notify(gpointer user_data) { struct ofono_stk *stk = user_data; - stk->session_agent = NULL; + if (stk->current_agent == stk->session_agent && agent_called(stk)) + send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED); + stk->session_agent = NULL; stk->current_agent = stk->default_agent; if (stk->remove_agent_source) { |