All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 3/8] stk: Add parser for run at command commands
Date: Wed, 19 May 2010 18:24:41 +0800	[thread overview]
Message-ID: <1274264686-9706-3-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1274264686-9706-1-git-send-email-yang.gu@intel.com>

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

---
 src/stkutil.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 src/stkutil.h |    9 +++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 3b1e957..9b08e8a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2747,6 +2747,45 @@ static gboolean parse_setup_idle_mode_text(struct stk_command *command,
 	return TRUE;
 }
 
+static void destroy_run_at_command(struct stk_command *command)
+{
+	g_free(command->run_at_command.alpha_id);
+	g_free(command->run_at_command.at_command);
+}
+
+static gboolean parse_run_at_command(struct stk_command *command,
+					struct comprehension_tlv_iter *iter)
+{
+	struct stk_command_run_at_command *obj = &command->run_at_command;
+	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_AT_COMMAND,
+				DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
+				&obj->at_command,
+				STK_DATA_OBJECT_TYPE_ICON_ID, 0,
+				&obj->icon_id,
+				STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0,
+				&obj->text_attr,
+				STK_DATA_OBJECT_TYPE_FRAME_ID, 0,
+				&obj->frame_id,
+				STK_DATA_OBJECT_TYPE_INVALID);
+
+	if (ret == FALSE)
+		return FALSE;
+
+	command->destructor = destroy_run_at_command;
+
+	return TRUE;
+}
+
 struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 						unsigned int len)
 {
@@ -2865,6 +2904,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 	case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT:
 		ok = parse_setup_idle_mode_text(command, &iter);
 		break;
+	case STK_COMMAND_TYPE_RUN_AT_COMMAND:
+		ok = parse_run_at_command(command, &iter);
+		break;
 	default:
 		ok = FALSE;
 		break;
diff --git a/src/stkutil.h b/src/stkutil.h
index 09e5731..cd7a1f5 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -972,6 +972,14 @@ struct stk_command_setup_idle_mode_text {
 	struct stk_frame_id frame_id;
 };
 
+struct stk_command_run_at_command {
+	char *alpha_id;
+	char *at_command;
+	struct stk_icon_id icon_id;
+	struct stk_text_attribute text_attr;
+	struct stk_frame_id frame_id;
+};
+
 struct stk_command {
 	unsigned char number;
 	unsigned char type;
@@ -994,6 +1002,7 @@ struct stk_command {
 		struct stk_command_perform_card_apdu perform_card_apdu;
 		struct stk_command_timer_mgmt timer_mgmt;
 		struct stk_command_setup_idle_mode_text setup_idle_mode_text;
+		struct stk_command_run_at_command run_at_command;
 	};
 
 	void (*destructor)(struct stk_command *command);
-- 
1.7.0.4


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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 10:24 [PATCH 1/8] stk: Add parser for setup idle mode text commands Yang Gu
2010-05-19 10:24 ` [PATCH 2/8] test-stk: Add test for setup idle mode text parser Yang Gu
2010-05-19 10:24 ` Yang Gu [this message]
2010-05-19 10:24 ` [PATCH 4/8] test-stk: Add test for run at command parser Yang Gu
2010-05-19 10:24 ` [PATCH 5/8] stk: Add parser for send dtmf commands Yang Gu
2010-05-19 10:24 ` [PATCH 6/8] test-stk: Add test for send dtmf parser Yang Gu
2010-05-19 10:24 ` [PATCH 7/8] stk: Add parser for language notification commands Yang Gu
2010-05-19 10:24 ` [PATCH 8/8] teststk: Add test for language notification parser Yang Gu
2010-05-25 22:56 ` [PATCH 1/8] stk: Add parser for setup idle mode text commands 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=1274264686-9706-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.