Open Source Telephony
 help / color / mirror / Atom feed
From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/4] stk: Handle user termination for Send DTMF.
Date: Mon, 28 Mar 2011 18:32:30 +0200	[thread overview]
Message-ID: <1301329952-10152-3-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <y>

[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]

---
 src/stk.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 94ad396..907d6b5 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -473,6 +473,16 @@ static void emit_menu_changed(struct ofono_stk *stk)
 	g_dbus_send_message(conn, signal);
 }
 
+static void user_termination_cb(enum stk_agent_result result, void *user_data)
+{
+	struct ofono_stk *stk = user_data;
+
+	if (result == STK_AGENT_RESULT_TERMINATE) {
+		stk->respond_on_exit = FALSE;
+		send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
+	}
+}
+
 static void stk_alpha_id_set(struct ofono_stk *stk,
 		const char *text, const struct stk_text_attribute *attr,
 		const struct stk_icon_id *icon)
@@ -484,8 +494,16 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 	 * and no alpha identifier cases equally. This may be changed once
 	 * better idea is found out.
 	 */
-	if (alpha != NULL)
-		stk_agent_display_action_info(stk->current_agent, alpha, icon);
+	if (alpha != NULL) {
+		if (stk->respond_on_exit) {
+			stk_agent_display_abortable_action_info(
+					stk->current_agent, alpha, icon,
+					user_termination_cb, stk, NULL);
+		}
+		else
+			stk_agent_display_action_info(stk->current_agent,
+								alpha, icon);
+	}
 
 	g_free(alpha);
 }
@@ -2329,10 +2347,6 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
 		return TRUE;
 	}
 
-	stk_alpha_id_set(stk, cmd->send_dtmf.alpha_id,
-				&cmd->send_dtmf.text_attr,
-				&cmd->send_dtmf.icon_id);
-
 	/*
 	 * Note that we don't strictly require an agent to be connected,
 	 * but to comply with 6.4.24 we need to send a End Session when
@@ -2342,6 +2356,10 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
 	stk->cancel_cmd = send_dtmf_cancel;
 	stk->dtmf_id = err;
 
+	stk_alpha_id_set(stk, cmd->send_dtmf.alpha_id,
+				&cmd->send_dtmf.text_attr,
+				&cmd->send_dtmf.icon_id);
+
 	return FALSE;
 }
 
-- 
1.7.1


             reply	other threads:[~2011-03-28 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 16:32 Philippe Nunes [this message]
2011-03-30  3:22 ` [PATCH 2/4] stk: Handle user termination for Send DTMF Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301329952-10152-3-git-send-email-philippe.nunes@linux.intel.com \
    --to=philippe.nunes@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox