All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj
@ 2010-04-27  9:47 Yang Gu
  2010-04-27  9:47 ` [PATCH 2/7] stkutil: Use struct to represent frame id Yang Gu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

Not all the proactive commands have comprehension tlv other than command
details and device identities. So the appropriate code should be moved to
parse_dataobj() from stk_command_new_from_pdu().
---
 src/stkutil.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b4279c1..3323550 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2030,6 +2030,10 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,
 		entries = g_slist_prepend(entries, entry);
 	}
 
+
+	if (comprehension_tlv_iter_next(iter) != TRUE)
+		goto out;
+
 	entries = g_slist_reverse(entries);
 
 	for (l = entries; l; l = l->next) {
@@ -2048,6 +2052,7 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,
 		}
 	}
 
+out:
 	for (l = entries; l; l = l->next) {
 		struct dataobj_handler_entry *entry = l->data;
 
@@ -2295,9 +2300,6 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 	command->src = data[0];
 	command->dst = data[1];
 
-	if (comprehension_tlv_iter_next(&iter) != TRUE)
-		return FALSE;
-
 	switch (command->type) {
 	case STK_COMMAND_TYPE_DISPLAY_TEXT:
 		ok = parse_display_text(command, &iter);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] stkutil: Use struct to represent frame id
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27  9:47 ` [PATCH 3/7] test-stkutil: Refactor the implementation to test display text Yang Gu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

Use a field has_id to indicate if we have frame id or not. Originally we use
0xFF to indicate we don't have frame id. But in that way, we have to initialize
each test case of proactive command when it doesn't have this comprehension
tlv to be 0xFF. To use has_id will save this effort, and keep consistency with
other implementations.
---
 src/stkutil.c |   13 +++----------
 src/stkutil.h |   12 +++++++++---
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 3323550..ed48db4 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1635,7 +1635,7 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter,
 static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 					void *user)
 {
-	unsigned char *frame_id = user;
+	struct stk_frame_id *fi = user;
 	const unsigned char *data;
 
 	if (comprehension_tlv_iter_get_length(iter) != 1)
@@ -1646,7 +1646,8 @@ static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 	if (data[0] >= 0x10)
 		return FALSE;
 
-	*frame_id = data[0];
+	fi->has_id = TRUE;
+	fi->id = data[0];
 
 	return TRUE;
 }
@@ -2084,8 +2085,6 @@ static gboolean parse_display_text(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_DISPLAY)
 		return FALSE;
 
-	obj->frame_id = 0xFF;
-
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT,
 				DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
 				&obj->text,
@@ -2126,8 +2125,6 @@ static gboolean parse_get_inkey(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
 		return FALSE;
 
-	obj->frame_id = 0xFF;
-
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT,
 				DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
 				&obj->text,
@@ -2162,8 +2159,6 @@ static gboolean parse_get_input(struct stk_command *command,
 	struct stk_command_get_input *obj = &command->get_input;
 	gboolean ret;
 
-	obj->frame_id = 0xFF;
-
 	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
 		return FALSE;
 
@@ -2207,8 +2202,6 @@ static gboolean parse_send_sms(struct stk_command *command,
 	struct gsm_sms_tpdu tpdu;
 	gboolean ret;
 
-	obj->frame_id = 0xFF;
-
 	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
 		return FALSE;
 
diff --git a/src/stkutil.h b/src/stkutil.h
index 5d2a818..cbb6442 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -728,6 +728,12 @@ struct stk_frames_info {
 	unsigned int len;
 };
 
+/* Defined in TS 102.223 Section 8.80 */
+struct stk_frame_id {
+	ofono_bool_t has_id;
+	unsigned char id;
+};
+
 /*
  * According to 102.223 Section 8.82 the length of CTLV is 1 byte. This means
  * that the maximum size is 127 according to the rules of CTLVs.
@@ -789,7 +795,7 @@ struct stk_command_display_text {
 	ofono_bool_t immediate_response;
 	struct stk_duration duration;
 	struct stk_text_attribute text_attribute;
-	unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
+	struct stk_frame_id frame_id;
 };
 
 struct stk_command_get_input {
@@ -798,7 +804,7 @@ struct stk_command_get_input {
 	char *default_text;
 	struct stk_icon_id icon_id;
 	struct stk_text_attribute text_attribute;
-	unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
+	struct stk_frame_id frame_id;
 };
 
 struct stk_command_send_sms {
@@ -807,7 +813,7 @@ struct stk_command_send_sms {
 	struct sms gsm_sms;
 	struct stk_icon_id icon_id;
 	struct stk_text_attribute text_attribute;
-	unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
+	struct stk_frame_id frame_id;
 };
 
 struct stk_command {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] test-stkutil: Refactor the implementation to test display text
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
  2010-04-27  9:47 ` [PATCH 2/7] stkutil: Use struct to represent frame id Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27  9:47 ` [PATCH 4/7] stkutil: Add parser for more time proactive commands Yang Gu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

---
 unit/test-stkutil.c |  160 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 109 insertions(+), 51 deletions(-)

diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 2bea19b..0961368 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -35,15 +35,72 @@
 #include "smsutil.h"
 #include "stkutil.h"
 
+static gboolean g_mem_equal(const unsigned char *v1, const unsigned char *v2,
+				unsigned int len)
+{
+	unsigned int i;
+
+	for (i = 0; i < len; i++)
+		if (v1[i] != v2[i])
+			return FALSE;
+	return TRUE;
+}
+
+static inline void check_common_bool(const ofono_bool_t command,
+					const ofono_bool_t test)
+{
+	g_assert(command == test);
+}
+
+/* Defined in TS 102.223 Section 8.8 */
+static void check_duration(const struct stk_duration *command,
+					const struct stk_duration *test)
+{
+	g_assert(command->unit == test->unit);
+	g_assert(command->interval == test->interval);
+}
+
+/* Defined in TS 102.223 Section 8.15 */
+static inline void check_text(const char *command, const char *test)
+{
+	g_assert(g_str_equal(command, test));
+}
+
+/* Defined in TS 102.223 Section 8.31 */
+static void check_icon_id(const struct stk_icon_id *command,
+					const struct stk_icon_id *test)
+{
+	g_assert(command->id == test->id);
+	g_assert(command->qualifier == test->qualifier);
+}
+
+/* Defined in TS 102.223 Section 8.72 */
+static void check_text_attr(const struct stk_text_attribute *command,
+					const struct stk_text_attribute *test)
+{
+	g_assert(command->len == test->len);
+	g_assert(g_mem_equal(command->attributes, test->attributes, test->len));
+}
+
+/* Defined in TS 102.223 Section 8.80 */
+static void check_frame_id(const struct stk_frame_id *command,
+					const struct stk_frame_id *test)
+{
+	g_assert(command->has_id == test->has_id);
+	if (test->has_id)
+		g_assert(command->id == test->id);
+}
+
 struct display_text_test {
 	const unsigned char *pdu;
 	unsigned int pdu_len;
-	const char *expected;
 	unsigned char qualifier;
-	unsigned char icon_qualifier;
-	unsigned char icon_id;
-	enum stk_duration_type duration_unit;
-	unsigned char duration_interval;
+	const char *text;
+	struct stk_icon_id icon_id;
+	ofono_bool_t immediate_response;
+	struct stk_duration duration;
+	struct stk_text_attribute text_attribute;
+	struct stk_frame_id frame_id;
 };
 
 unsigned char display_text_111[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80,
@@ -151,103 +208,111 @@ unsigned char display_text_1011[] = { 0xD0, 0x12, 0x81, 0x03, 0x01, 0x21, 0x80,
 static struct display_text_test display_text_data_111 = {
 	.pdu = display_text_111,
 	.pdu_len = sizeof(display_text_111),
-	.expected = "Toolkit Test 1",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "Toolkit Test 1"
 };
 
 static struct display_text_test display_text_data_131 = {
 	.pdu = display_text_131,
 	.pdu_len = sizeof(display_text_131),
-	.expected = "Toolkit Test 2",
-	.qualifier = 0x81
+	.qualifier = 0x81,
+	.text = "Toolkit Test 2"
 };
 
 static struct display_text_test display_text_data_141 = {
 	.pdu = display_text_141,
 	.pdu_len = sizeof(display_text_141),
-	.expected = "Toolkit Test 3",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "Toolkit Test 3"
 };
 
 static struct display_text_test display_text_data_151 = {
 	.pdu = display_text_151,
 	.pdu_len = sizeof(display_text_151),
-	.expected = "Toolkit Test 4",
-	.qualifier = 0x00
+	.qualifier = 0x00,
+	.text = "Toolkit Test 4"
 };
 
 static struct display_text_test display_text_data_161 = {
 	.pdu = display_text_161,
 	.pdu_len = sizeof(display_text_161),
-	.expected = "This command instructs the ME to display a text message. "
+	.qualifier = 0x80,
+	.text = "This command instructs the ME to display a text message. "
 			"It allows the SIM to define the priority of that "
 			"message, and the text string format. Two types of "
-			"prio",
-	.qualifier = 0x80
+			"prio"
 };
 
 static struct display_text_test display_text_data_171 = {
 	.pdu = display_text_171,
 	.pdu_len = sizeof(display_text_171),
-	.expected = "<GO-BACKWARDS>",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "<GO-BACKWARDS>"
 };
 
 static struct display_text_test display_text_data_511 = {
 	.pdu = display_text_511,
 	.pdu_len = sizeof(display_text_511),
-	.expected = "Basic Icon",
 	.qualifier = 0x80,
-	.icon_id = 0x01,
-	.icon_qualifier = 0x00,
+	.text = "Basic Icon",
+	.icon_id = {
+		.qualifier = 0x00,
+		.id = 0x01
+	}
 };
 
 static struct display_text_test display_text_data_521 = {
 	.pdu = display_text_521,
 	.pdu_len = sizeof(display_text_521),
-	.expected = "Colour Icon",
 	.qualifier = 0x80,
-	.icon_id = 0x02,
-	.icon_qualifier = 0x00,
+	.text = "Colour Icon",
+	.icon_id = {
+		.qualifier = 0x00,
+		.id = 0x02
+	}
 };
 
 static struct display_text_test display_text_data_531 = {
 	.pdu = display_text_531,
 	.pdu_len = sizeof(display_text_531),
-	.expected = "Basic Icon",
 	.qualifier = 0x80,
-	.icon_id = 0x01,
-	.icon_qualifier = 0x01,
+	.text = "Basic Icon",
+	.icon_id = {
+		.qualifier = 0x01,
+		.id = 0x01
+	}
 };
 
 static struct display_text_test display_text_data_611 = {
 	.pdu = display_text_611,
 	.pdu_len = sizeof(display_text_611),
-	.expected = "ЗДРАВСТВУЙТЕ",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "ЗДРАВСТВУЙТЕ"
 };
 
 static struct display_text_test display_text_data_711 = {
 	.pdu = display_text_711,
 	.pdu_len = sizeof(display_text_711),
-	.expected = "10 Second",
 	.qualifier = 0x80,
-	.duration_unit = STK_DURATION_TYPE_SECONDS,
-	.duration_interval = 10,
+	.text = "10 Second",
+	.duration = {
+		.unit = STK_DURATION_TYPE_SECONDS,
+		.interval = 10,
+	}
 };
 
 static struct display_text_test display_text_data_911 = {
 	.pdu = display_text_911,
 	.pdu_len = sizeof(display_text_911),
-	.expected = "你好",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "你好"
 };
 
 static struct display_text_test display_text_data_1011 = {
 	.pdu = display_text_1011,
 	.pdu_len = sizeof(display_text_1011),
-	.expected = "80ル",
-	.qualifier = 0x80
+	.qualifier = 0x80,
+	.text = "80ル"
 };
 
 /* Defined in TS 102.384 Section 27.22.4.1 */
@@ -268,21 +333,14 @@ static void test_display_text(gconstpointer data)
 	g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_DISPLAY);
 
 	g_assert(command->display_text.text);
-
-	g_assert(g_str_equal(test->expected, command->display_text.text));
-
-	if (test->icon_id > 0) {
-		g_assert(command->display_text.icon_id.id == test->icon_id);
-		g_assert(command->display_text.icon_id.qualifier ==
-				test->icon_qualifier);
-	}
-
-	if (test->duration_interval > 0) {
-		g_assert(command->display_text.duration.unit ==
-				test->duration_unit);
-		g_assert(command->display_text.duration.interval ==
-				test->duration_interval);
-	}
+	check_text(command->display_text.text, test->text);
+	check_icon_id(&command->display_text.icon_id, &test->icon_id);
+	check_common_bool(command->display_text.immediate_response,
+						test->immediate_response);
+	check_duration(&command->display_text.duration, &test->duration);
+	check_text_attr(&command->display_text.text_attribute,
+						&test->text_attribute);
+	check_frame_id(&command->display_text.frame_id, &test->frame_id);
 
 	stk_command_free(command);
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] stkutil: Add parser for more time proactive commands
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
  2010-04-27  9:47 ` [PATCH 2/7] stkutil: Use struct to represent frame id Yang Gu
  2010-04-27  9:47 ` [PATCH 3/7] test-stkutil: Refactor the implementation to test display text Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27  9:47 ` [PATCH 5/7] test-stkutil: Add unit test for more time parser Yang Gu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index ed48db4..2e0c957 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2189,6 +2189,18 @@ static gboolean parse_get_input(struct stk_command *command,
 	return TRUE;
 }
 
+static gboolean parse_more_time(struct stk_command *command,
+					struct comprehension_tlv_iter *iter)
+{
+	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
+		return FALSE;
+
+	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
+		return FALSE;
+
+	return TRUE;
+}
+
 static void destroy_send_sms(struct stk_command *command)
 {
 	g_free(command->send_sms.alpha_id);
@@ -2303,6 +2315,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 	case STK_COMMAND_TYPE_GET_INPUT:
 		ok = parse_get_input(command, &iter);
 		break;
+	case STK_COMMAND_TYPE_MORE_TIME:
+		ok = parse_more_time(command, &iter);
+		break;
 	case STK_COMMAND_TYPE_SEND_SMS:
 		ok = parse_send_sms(command, &iter);
 		break;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] test-stkutil: Add unit test for more time parser
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
                   ` (2 preceding siblings ...)
  2010-04-27  9:47 ` [PATCH 4/7] stkutil: Add parser for more time proactive commands Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27  9:47 ` [PATCH 6/7] stkutil: Change some dataobj parser to use char * instead of char ** Yang Gu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

---
 unit/test-stkutil.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 0961368..427d7a2 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -405,6 +405,41 @@ static void test_get_input(gconstpointer data)
 	stk_command_free(command);
 }
 
+struct more_time_test {
+	const unsigned char *pdu;
+	unsigned int pdu_len;
+	unsigned char qualifier;
+};
+
+static unsigned char more_time_111[] = { 0xD0, 0x09, 0x81, 0x03, 0x01, 0x02,
+						0x00, 0x82, 0x02, 0x81, 0x82 };
+
+static struct more_time_test more_time_data_111 = {
+	.pdu = more_time_111,
+	.pdu_len = sizeof(more_time_111),
+	.qualifier = 0x00,
+};
+
+/* Defined in TS 102.384 Section 27.22.4.4 */
+static void test_more_time(gconstpointer data)
+{
+	const struct get_input_test *test = data;
+	struct stk_command *command;
+
+	command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+	g_assert(command);
+
+	g_assert(command->number == 1);
+	g_assert(command->type == STK_COMMAND_TYPE_MORE_TIME);
+	g_assert(command->qualifier == test->qualifier);
+
+	g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+	g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL);
+
+	stk_command_free(command);
+}
+
 struct send_sms_test {
 	const unsigned char *pdu;
 	unsigned int pdu_len;
@@ -516,6 +551,9 @@ int main(int argc, char **argv)
 	g_test_add_data_func("/teststk/Get Input 1.1.1",
 				&get_input_data_111, test_get_input);
 
+	g_test_add_data_func("/teststk/More Time 1.1.1",
+				&more_time_data_111, test_more_time);
+
 	g_test_add_data_func("/teststk/Send SMS 1.1",
 				&send_sms_data_11, test_send_sms);
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] stkutil: Change some dataobj parser to use char * instead of char **
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
                   ` (3 preceding siblings ...)
  2010-04-27  9:47 ` [PATCH 5/7] test-stkutil: Add unit test for more time parser Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27  9:47 ` [PATCH 7/7] stkutil: Make get inkey parser use its own struct Yang Gu
  2010-04-27 14:36 ` [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 2e0c957..a0166d0 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -611,7 +611,7 @@ static gboolean parse_dataobj_location_info(struct comprehension_tlv_iter *iter,
 static gboolean parse_dataobj_imei(struct comprehension_tlv_iter *iter,
 					void *user)
 {
-	char **imei = user;
+	char *imei = user;
 	const unsigned char *data;
 	unsigned int len;
 	static const char digit_lut[] = "0123456789*#abc\0";
@@ -626,8 +626,8 @@ static gboolean parse_dataobj_imei(struct comprehension_tlv_iter *iter,
 		return FALSE;
 
 	/* Assume imei is at least 16 bytes long (15 for imei + null) */
-	(*imei)[0] = digit_lut[(data[0] & 0xf0) >> 4];
-	extract_bcd_number(data + 1, 7, *imei + 1);
+	imei[0] = digit_lut[(data[0] & 0xf0) >> 4];
+	extract_bcd_number(data + 1, 7, imei + 1);
 
 	return TRUE;
 }
@@ -644,7 +644,7 @@ static gboolean parse_dataobj_help_request(struct comprehension_tlv_iter *iter,
 static gboolean parse_dataobj_network_measurement_results(
 		struct comprehension_tlv_iter *iter, void *user)
 {
-	unsigned char **nmr = user;
+	unsigned char *nmr = user;
 	const unsigned char *data;
 	unsigned int len;
 
@@ -655,7 +655,7 @@ static gboolean parse_dataobj_network_measurement_results(
 	data = comprehension_tlv_iter_get_data(iter);
 
 	/* Assume network measurement result is 16 bytes long */
-	memcpy(*nmr, data, len);
+	memcpy(nmr, data, len);
 
 	return TRUE;
 }
@@ -1430,7 +1430,7 @@ static gboolean parse_dataobj_remote_entity_address(
 static gboolean parse_dataobj_esn(struct comprehension_tlv_iter *iter,
 					void *user)
 {
-	unsigned char **esn = user;
+	unsigned char *esn = user;
 	const unsigned char *data;
 	unsigned int len = comprehension_tlv_iter_get_length(iter);
 
@@ -1440,7 +1440,7 @@ static gboolean parse_dataobj_esn(struct comprehension_tlv_iter *iter,
 	data = comprehension_tlv_iter_get_data(iter);
 
 	/* Assume esn is 4 bytes long */
-	memcpy(*esn, data, len);
+	memcpy(esn, data, len);
 
 	return TRUE;
 }
@@ -1528,7 +1528,7 @@ static gboolean parse_dataobj_item_text_attribute_list(
 static gboolean parse_dataobj_imeisv(struct comprehension_tlv_iter *iter,
 					void *user)
 {
-	char **imeisv = user;
+	char *imeisv = user;
 	const unsigned char *data;
 	unsigned int len;
 	static const char digit_lut[] = "0123456789*#abc\0";
@@ -1546,10 +1546,10 @@ static gboolean parse_dataobj_imeisv(struct comprehension_tlv_iter *iter,
 		return FALSE;
 
 	/* Assume imeisv is at least 17 bytes long (16 for imeisv + null) */
-	(*imeisv)[0] = digit_lut[data[0] >> 4];
-	extract_bcd_number(data + 1, 7, *imeisv + 1);
-	(*imeisv)[15] = digit_lut[data[8] & 0x0f];
-	(*imeisv)[16] = '\0';
+	imeisv[0] = digit_lut[data[0] >> 4];
+	extract_bcd_number(data + 1, 7, imeisv + 1);
+	imeisv[15] = digit_lut[data[8] & 0x0f];
+	imeisv[16] = '\0';
 
 	return TRUE;
 }
@@ -1656,7 +1656,7 @@ static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 static gboolean parse_dataobj_meid(struct comprehension_tlv_iter *iter,
 					void *user)
 {
-	unsigned char **meid = user;
+	unsigned char *meid = user;
 	const unsigned char *data;
 
 	if (comprehension_tlv_iter_get_length(iter) != 8)
@@ -1665,7 +1665,7 @@ static gboolean parse_dataobj_meid(struct comprehension_tlv_iter *iter,
 	data = comprehension_tlv_iter_get_data(iter);
 
 	/* Assume meid is 8 bytes long */
-	memcpy(*meid, data, 8);
+	memcpy(meid, data, 8);
 
 	return TRUE;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] stkutil: Make get inkey parser use its own struct
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
                   ` (4 preceding siblings ...)
  2010-04-27  9:47 ` [PATCH 6/7] stkutil: Change some dataobj parser to use char * instead of char ** Yang Gu
@ 2010-04-27  9:47 ` Yang Gu
  2010-04-27 14:36 ` [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Yang Gu @ 2010-04-27  9:47 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |    6 ++----
 src/stkutil.h |   10 +++++++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index a0166d0..50fa4c1 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2116,7 +2116,7 @@ static void destroy_get_inkey(struct stk_command *command)
 static gboolean parse_get_inkey(struct stk_command *command,
 				struct comprehension_tlv_iter *iter)
 {
-	struct stk_command_display_text *obj = &command->get_inkey;
+	struct stk_command_get_inkey *obj = &command->get_inkey;
 	gboolean ret;
 
 	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
@@ -2130,12 +2130,10 @@ static gboolean parse_get_inkey(struct stk_command *command,
 				&obj->text,
 				STK_DATA_OBJECT_TYPE_ICON_ID, 0,
 				&obj->icon_id,
-				STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE, 0,
-				&obj->immediate_response,
 				STK_DATA_OBJECT_TYPE_DURATION, 0,
 				&obj->duration,
 				STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0,
-				&obj->text_attribute,
+				&obj->text_attr,
 				STK_DATA_OBJECT_TYPE_FRAME_ID, 0,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
diff --git a/src/stkutil.h b/src/stkutil.h
index cbb6442..41c03a7 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -798,6 +798,14 @@ struct stk_command_display_text {
 	struct stk_frame_id frame_id;
 };
 
+struct stk_command_get_inkey {
+	char *text;
+	struct stk_icon_id icon_id;
+	struct stk_duration duration;
+	struct stk_text_attribute text_attr;
+	struct stk_frame_id frame_id;
+};
+
 struct stk_command_get_input {
 	char *text;
 	struct stk_response_length response_length;
@@ -825,7 +833,7 @@ struct stk_command {
 
 	union {
 		struct stk_command_display_text display_text;
-		struct stk_command_display_text get_inkey;
+		struct stk_command_get_inkey get_inkey;
 		struct stk_command_get_input get_input;
 		struct stk_command_send_sms send_sms;
 	};
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj
  2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
                   ` (5 preceding siblings ...)
  2010-04-27  9:47 ` [PATCH 7/7] stkutil: Make get inkey parser use its own struct Yang Gu
@ 2010-04-27 14:36 ` Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2010-04-27 14:36 UTC (permalink / raw)
  To: ofono

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

Hi Yang,

> Not all the proactive commands have comprehension tlv other than command
> details and device identities. So the appropriate code should be moved to
> parse_dataobj() from stk_command_new_from_pdu().
> ---
>  src/stkutil.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)

All 7 patches have been applied, thanks.  Can you make sure your commit 
headers are less than 50 characters long and your commit description is less 
than 72 characters long?

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-27 14:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-27  9:47 [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Yang Gu
2010-04-27  9:47 ` [PATCH 2/7] stkutil: Use struct to represent frame id Yang Gu
2010-04-27  9:47 ` [PATCH 3/7] test-stkutil: Refactor the implementation to test display text Yang Gu
2010-04-27  9:47 ` [PATCH 4/7] stkutil: Add parser for more time proactive commands Yang Gu
2010-04-27  9:47 ` [PATCH 5/7] test-stkutil: Add unit test for more time parser Yang Gu
2010-04-27  9:47 ` [PATCH 6/7] stkutil: Change some dataobj parser to use char * instead of char ** Yang Gu
2010-04-27  9:47 ` [PATCH 7/7] stkutil: Make get inkey parser use its own struct Yang Gu
2010-04-27 14:36 ` [PATCH 1/7] stkutil: Move advance of ctlv to parse_dataobj Denis Kenzior

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.