Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 13/19] stkutil: Add select item proactive command parser
Date: Mon, 10 May 2010 18:38:56 +0800	[thread overview]
Message-ID: <1273487942-27213-13-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1273487942-27213-1-git-send-email-yang.gu@intel.com>

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

---
 src/stkutil.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/stkutil.h |   13 +++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 45bb285..ebe1114 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2360,6 +2360,56 @@ error:
 	return FALSE;
 }
 
+static void destroy_select_item(struct stk_command *command)
+{
+	g_free(command->select_item.alpha_id);
+	g_slist_foreach(command->select_item.items,
+				(GFunc)destroy_stk_item, NULL);
+	g_slist_free(command->select_item.items);
+}
+
+static gboolean parse_select_item(struct stk_command *command,
+					struct comprehension_tlv_iter *iter)
+{
+	struct stk_command_select_item *obj = &command->select_item;
+	gboolean ret;
+
+	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
+		return FALSE;
+
+	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
+		return FALSE;
+
+	ret = parse_dataobj(iter,
+			STK_DATA_OBJECT_TYPE_ALPHA_ID, 0,
+			&obj->alpha_id,
+			STK_DATA_OBJECT_TYPE_ITEM,
+			DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
+			&obj->items,
+			STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR, 0,
+			&obj->next_act,
+			STK_DATA_OBJECT_TYPE_ITEM_ID, 0,
+			&obj->item_id,
+			STK_DATA_OBJECT_TYPE_ICON_ID, 0,
+			&obj->icon_id,
+			STK_DATA_OBJECT_TYPE_ITEM_ICON_ID_LIST, 0,
+			&obj->item_icon_id_list,
+			STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0,
+			&obj->text_attr,
+			STK_DATA_OBJECT_TYPE_ITEM_TEXT_ATTRIBUTE_LIST, 0,
+			&obj->item_text_attr_list,
+			STK_DATA_OBJECT_TYPE_FRAME_ID, 0,
+			&obj->frame_id,
+			STK_DATA_OBJECT_TYPE_INVALID);
+
+	if (ret == FALSE)
+		return FALSE;
+
+	command->destructor = destroy_select_item;
+
+	return TRUE;
+}
+
 static void destroy_send_sms(struct stk_command *command)
 {
 	g_free(command->send_sms.alpha_id);
@@ -2486,6 +2536,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 	case STK_COMMAND_TYPE_SETUP_MENU:
 		ok = parse_setup_menu(command, &iter);
 		break;
+	case STK_COMMAND_TYPE_SELECT_ITEM:
+		ok = parse_select_item(command, &iter);
+		break;
 	case STK_COMMAND_TYPE_SEND_SMS:
 		ok = parse_send_sms(command, &iter);
 		break;
diff --git a/src/stkutil.h b/src/stkutil.h
index d91ac66..143679f 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -834,6 +834,18 @@ struct stk_command_setup_menu {
 	struct stk_item_text_attribute_list item_text_attr_list;
 };
 
+struct stk_command_select_item {
+	char *alpha_id;
+	GSList *items;
+	struct stk_items_next_action_indicator next_act;
+	unsigned char item_id;
+	struct stk_icon_id icon_id;
+	struct stk_item_icon_id_list item_icon_id_list;
+	struct stk_text_attribute text_attr;
+	struct stk_item_text_attribute_list item_text_attr_list;
+	struct stk_frame_id frame_id;
+};
+
 struct stk_command_send_sms {
 	char *alpha_id;
 	struct stk_address address;
@@ -857,6 +869,7 @@ struct stk_command {
 		struct stk_command_get_input get_input;
 		struct stk_command_play_tone play_tone;
 		struct stk_command_setup_menu setup_menu;
+		struct stk_command_select_item select_item;
 		struct stk_command_send_sms send_sms;
 	};
 
-- 
1.7.0.4


  parent reply	other threads:[~2010-05-10 10:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 10:38 [PATCH 01/19] stkutil: Free default text for get input parser Yang Gu
2010-05-10 10:38 ` [PATCH 02/19] test-stkutil: Add unit test " Yang Gu
2010-05-11 19:25   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 03/19] stk: Unify variable names to use abbreviation Yang Gu
2010-05-11 19:25   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 04/19] test-stkutil: Use enum for icon_id Yang Gu
2010-05-11 19:25   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 05/19] stkutil: Add play tone proactive command parser Yang Gu
2010-05-11 19:26   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 06/19] Replace check_text with check_common_text Yang Gu
2010-05-11 19:26   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 07/19] stkutil: Refactor parser for tone objects Yang Gu
2010-05-11 19:26   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 08/19] test-stkutil: Add unit test for play tone parser Yang Gu
2010-05-11 19:27   ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 09/19] stkutil: Add poll interval proactive command parser Yang Gu
2010-05-11 19:23   ` Denis Kenzior
2010-05-12  9:03     ` Gu, Yang
2010-05-12 14:21       ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 10/19] test-stkutil: Add unit test for poll interval parser Yang Gu
2010-05-10 10:38 ` [PATCH 11/19] stkutil: Add setup menu proactive command parser Yang Gu
2010-05-11 19:21   ` Denis Kenzior
2010-05-12  8:53     ` Gu, Yang
2010-05-12 14:43       ` Denis Kenzior
2010-05-10 10:38 ` [PATCH 12/19] test-stkutil: Add unit test for setup menu parser Yang Gu
2010-05-10 10:38 ` Yang Gu [this message]
2010-05-10 10:38 ` [PATCH 14/19] test-stkutil: Add unit test for select item parser Yang Gu
2010-05-10 10:38 ` [PATCH 15/19] test-stkutil: Use dedicated functions to check Yang Gu
2010-05-10 10:38 ` [PATCH 16/19] stkutil: Parse cdma tpdu in send sms parser Yang Gu
2010-05-11 19:38   ` Denis Kenzior
2010-05-10 10:39 ` [PATCH 17/19] test-stkutil: Refactor test for " Yang Gu
2010-05-10 10:39 ` [PATCH 18/19] stkutil: Add setup call proactive command parser Yang Gu
2010-05-10 10:39 ` [PATCH 19/19] test-stkutil: Add unit test for setup call parser Yang Gu
2010-05-11 19:24 ` [PATCH 01/19] stkutil: Free default text for get input parser 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=1273487942-27213-13-git-send-email-yang.gu@intel.com \
    --to=yang.gu@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