All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/15] Add parser for access technology objects
@ 2010-04-21  4:55 Yang Gu
  2010-04-21  4:55 ` [PATCH 02/15] Add parser for display parameters objects Yang Gu
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 0d4be68..69d5a4a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1243,6 +1243,18 @@ static gboolean parse_dataobj_aid(struct comprehension_tlv_iter *iter,
 	return TRUE;
 }
 
+/*
+ * Defined in TS 102.223 Section 8.61. According to it, the technology field
+ * can have at most 127 bytes. However, all the defined values are only 1 byte,
+ * so we just use 1 byte to represent it.
+ */
+static gboolean parse_dataobj_access_technology(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	unsigned char *byte = user;
+	return parse_dataobj_common_byte(iter, byte);
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1393,6 +1405,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_uicc_te_interface;
 	case STK_DATA_OBJECT_TYPE_AID:
 		return parse_dataobj_aid;
+	case STK_DATA_OBJECT_TYPE_ACCESS_TECHNOLOGY:
+		return parse_dataobj_access_technology;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
-- 
1.7.0.4


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

* [PATCH 02/15] Add parser for display parameters objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 03/15] Add parser for service record objects Yang Gu
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   20 ++++++++++++++++++++
 src/stkutil.h |    7 +++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 69d5a4a..d569f16 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1255,6 +1255,24 @@ static gboolean parse_dataobj_access_technology(
 	return parse_dataobj_common_byte(iter, byte);
 }
 
+/* Defined in TS 102.223 Section 8.62 */
+static gboolean parse_dataobj_display_parameters(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_display_parameters *dp = user;
+	const unsigned char *data;
+
+	if (comprehension_tlv_iter_get_length(iter) != 3)
+		return FALSE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	dp->height = data[0];
+	dp->width = data[1];
+	dp->effects = data[2];
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1407,6 +1425,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_aid;
 	case STK_DATA_OBJECT_TYPE_ACCESS_TECHNOLOGY:
 		return parse_dataobj_access_technology;
+	case STK_DATA_OBJECT_TYPE_DISPLAY_PARAMETERS:
+		return parse_dataobj_display_parameters;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 67e7ef7..3cf9caa 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -599,6 +599,13 @@ struct stk_aid {
 	unsigned int len;
 };
 
+/* Defined in TS 102.223 Section 8.62 */
+struct stk_display_parameters {
+	unsigned char height;
+	unsigned char width;
+	unsigned char effects;
+};
+
 /*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
-- 
1.7.0.4


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

* [PATCH 03/15] Add parser for service record objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
  2010-04-21  4:55 ` [PATCH 02/15] Add parser for display parameters objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 04/15] Add parser for device filter objects Yang Gu
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   28 ++++++++++++++++++++++++++++
 src/stkutil.h |   16 ++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index d569f16..0e0135f 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1273,6 +1273,32 @@ static gboolean parse_dataobj_display_parameters(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.63 */
+static gboolean parse_dataobj_service_record(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_service_record *sr = user;
+	const unsigned char *data;
+	unsigned int len;
+
+	len = comprehension_tlv_iter_get_length(iter);
+	if (len < 3)
+		return FALSE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	sr->tech_id = data[0];
+	sr->serv_id = data[1];
+	sr->len = len - 2;
+
+	sr->serv_rec = g_try_malloc(sr->len);
+	if (sr->serv_rec == NULL)
+		return FALSE;
+
+	memcpy(sr->serv_rec, data + 2, sr->len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1427,6 +1453,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_access_technology;
 	case STK_DATA_OBJECT_TYPE_DISPLAY_PARAMETERS:
 		return parse_dataobj_display_parameters;
+	case STK_DATA_OBJECT_TYPE_SERVICE_RECORD:
+		return parse_dataobj_service_record;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 3cf9caa..581d947 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -349,6 +349,14 @@ enum stk_access_technology_type {
 	STK_ACCESS_TECHNOLOGY_EUTRAN = 		0x08
 };
 
+enum stk_technology_id {
+	STK_TECHNOLOGY_INDEPENDENT = 	0x00,
+	STK_TECHNOLOGY_BLUETOOTH = 	0x01,
+	STK_TECHNOLOGY_IRDA = 		0x02,
+	STK_TECHNOLOGY_RS232 = 		0x03,
+	STK_TECHNOLOGY_USB = 		0x04
+};
+
 /* For data object that only has a byte array with undetermined length */
 struct stk_common_byte_array {
 	unsigned char *array;
@@ -606,6 +614,14 @@ struct stk_display_parameters {
 	unsigned char effects;
 };
 
+/* Defined in TS 102.223 Section 8.63 */
+struct stk_service_record {
+	unsigned char tech_id;
+	unsigned char serv_id;
+	unsigned char *serv_rec;
+	unsigned int len;
+};
+
 /*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
-- 
1.7.0.4


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

* [PATCH 04/15] Add parser for device filter objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
  2010-04-21  4:55 ` [PATCH 02/15] Add parser for display parameters objects Yang Gu
  2010-04-21  4:55 ` [PATCH 03/15] Add parser for service record objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 05/15] Add parser for service search objects Yang Gu
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   29 +++++++++++++++++++++++++++++
 src/stkutil.h |    7 +++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 0e0135f..d6c7235 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1299,6 +1299,33 @@ static gboolean parse_dataobj_service_record(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.64 */
+static gboolean parse_dataobj_device_filter(struct comprehension_tlv_iter *iter,
+						void *user)
+{
+	struct stk_device_filter *df = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len < 1)
+		return FALSE;
+
+	if (len == 1)
+		return TRUE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	df->tech_id = data[0];
+	df->len = len - 1;
+
+	df->dev_filter = g_try_malloc(df->len);
+	if (df->dev_filter == NULL)
+		return FALSE;
+
+	memcpy(df->dev_filter, data + 1, df->len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1455,6 +1482,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_display_parameters;
 	case STK_DATA_OBJECT_TYPE_SERVICE_RECORD:
 		return parse_dataobj_service_record;
+	case STK_DATA_OBJECT_TYPE_DEVICE_FILTER:
+		return parse_dataobj_device_filter;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 581d947..cc2915d 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -622,6 +622,13 @@ struct stk_service_record {
 	unsigned int len;
 };
 
+/* Defined in TS 102.223 Section 8.64 */
+struct stk_device_filter {
+	unsigned char tech_id;
+	unsigned char *dev_filter;
+	unsigned int len;
+};
+
 /*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
-- 
1.7.0.4


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

* [PATCH 05/15] Add parser for service search objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (2 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 04/15] Add parser for device filter objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 06/15] Add parser for attribute information objects Yang Gu
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   29 +++++++++++++++++++++++++++++
 src/stkutil.h |    7 +++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index d6c7235..fdeeee2 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1326,6 +1326,33 @@ static gboolean parse_dataobj_device_filter(struct comprehension_tlv_iter *iter,
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.65 */
+static gboolean parse_dataobj_service_search(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_service_search *ss = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len < 1)
+		return FALSE;
+
+	if (len == 1)
+		return TRUE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	ss->tech_id = data[0];
+	ss->len = len - 1;
+
+	ss->ser_search = g_try_malloc(ss->len);
+	if (ss->ser_search == NULL)
+		return FALSE;
+
+	memcpy(ss->ser_search, data + 1, ss->len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1484,6 +1511,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_service_record;
 	case STK_DATA_OBJECT_TYPE_DEVICE_FILTER:
 		return parse_dataobj_device_filter;
+	case STK_DATA_OBJECT_TYPE_SERVICE_SEARCH:
+		return parse_dataobj_service_search;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index cc2915d..57952ba 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -629,6 +629,13 @@ struct stk_device_filter {
 	unsigned int len;
 };
 
+/* Defined in TS 102.223 Section 8.65 */
+struct stk_service_search {
+	unsigned char tech_id;
+	unsigned char *ser_search;
+	unsigned int len;
+};
+
 /*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
-- 
1.7.0.4


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

* [PATCH 06/15] Add parser for attribute information objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (3 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 05/15] Add parser for service search objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 07/15] Add parser for service availability objects Yang Gu
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   29 +++++++++++++++++++++++++++++
 src/stkutil.h |    7 +++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index fdeeee2..ca32e08 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1353,6 +1353,33 @@ static gboolean parse_dataobj_service_search(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.66 */
+static gboolean parse_dataobj_attribute_info(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_attribute_info *ai = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len < 1)
+		return FALSE;
+
+	if (len == 1)
+		return TRUE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	ai->tech_id = data[0];
+	ai->len = len - 1;
+
+	ai->attr_info = g_try_malloc(ai->len);
+	if (ai->attr_info == NULL)
+		return FALSE;
+
+	memcpy(ai->attr_info, data + 1, ai->len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1513,6 +1540,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_device_filter;
 	case STK_DATA_OBJECT_TYPE_SERVICE_SEARCH:
 		return parse_dataobj_service_search;
+	case STK_DATA_OBJECT_TYPE_ATTRIBUTE_INFO:
+		return parse_dataobj_attribute_info;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 57952ba..f15f38d 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -636,6 +636,13 @@ struct stk_service_search {
 	unsigned int len;
 };
 
+/* Defined in TS 102.223 Section 8.66 */
+struct stk_attribute_info {
+	unsigned char tech_id;
+	unsigned char *attr_info;
+	unsigned int len;
+};
+
 /*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
-- 
1.7.0.4


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

* [PATCH 07/15] Add parser for service availability objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (4 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 06/15] Add parser for attribute information objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 08/15] Add parser for remote entity address objects Yang Gu
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index ca32e08..f9d4ce7 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1380,6 +1380,14 @@ static gboolean parse_dataobj_attribute_info(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.67 */
+static gboolean parse_dataobj_service_availability(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_common_byte_array *array = user;
+	return parse_dataobj_common_byte_array(iter, array);
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1542,6 +1550,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_service_search;
 	case STK_DATA_OBJECT_TYPE_ATTRIBUTE_INFO:
 		return parse_dataobj_attribute_info;
+	case STK_DATA_OBJECT_TYPE_SERVICE_AVAILABILITY:
+		return parse_dataobj_service_availability;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
-- 
1.7.0.4


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

* [PATCH 08/15] Add parser for remote entity address objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (5 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 07/15] Add parser for service availability objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 09/15] Add parser for esn objects Yang Gu
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   31 +++++++++++++++++++++++++++++++
 src/stkutil.h |   12 ++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index f9d4ce7..33bdb21 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1388,6 +1388,35 @@ static gboolean parse_dataobj_service_availability(
 	return parse_dataobj_common_byte_array(iter, array);
 }
 
+/* Defined in TS 102.223 Section 8.68 */
+static gboolean parse_dataobj_remote_entity_address(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_remote_entity_address *rea = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	data = comprehension_tlv_iter_get_data(iter);
+
+	rea->coding_type = data[0];
+	switch (rea->coding_type) {
+	case 0x00:
+		if (len != 7)
+			return FALSE;
+		break;
+	case 0x01:
+		if (len != 5)
+			return FALSE;
+		break;
+	default:
+		return FALSE;
+	}
+
+	memcpy(&rea->addr, data + 1, len - 1);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1552,6 +1581,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_attribute_info;
 	case STK_DATA_OBJECT_TYPE_SERVICE_AVAILABILITY:
 		return parse_dataobj_service_availability;
+	case STK_DATA_OBJECT_TYPE_REMOTE_ENTITY_ADDRESS:
+		return parse_dataobj_remote_entity_address;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index f15f38d..39d159b 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -644,6 +644,18 @@ struct stk_attribute_info {
 };
 
 /*
+ * According to TS 102.223 Section 8.68, remote entity address can be either
+ * 6-bytes IEEE-802 address, or 4-bytes IrDA device address.
+ */
+struct stk_remote_entity_address {
+	unsigned char coding_type;
+	union {
+		unsigned char ieee802[6];
+		unsigned char irda[4];
+	} addr;
+};
+
+/*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
  * of CTLVs.  Empty attribute options will have len of 0.
-- 
1.7.0.4


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

* [PATCH 09/15] Add parser for esn objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (6 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 08/15] Add parser for remote entity address objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 10/15] Add parser for network access name objects Yang Gu
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 33bdb21..1856c93 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1417,6 +1417,25 @@ static gboolean parse_dataobj_remote_entity_address(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.69 */
+static gboolean parse_dataobj_esn(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	unsigned char **esn = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len != 4)
+		return FALSE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+
+	/* Assume esn is 4 bytes long */
+	memcpy(*esn, data, len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1583,6 +1602,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_service_availability;
 	case STK_DATA_OBJECT_TYPE_REMOTE_ENTITY_ADDRESS:
 		return parse_dataobj_remote_entity_address;
+	case STK_DATA_OBJECT_TYPE_ESN:
+		return parse_dataobj_esn;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
-- 
1.7.0.4


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

* [PATCH 10/15] Add parser for network access name objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (7 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 09/15] Add parser for esn objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 11/15] Add parser for cdma sms tpdu objects Yang Gu
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 1856c93..6b3500e 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1436,6 +1436,24 @@ static gboolean parse_dataobj_esn(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.70 */
+static gboolean parse_dataobj_network_access_name(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_network_access_name *nan = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len == 0)
+		return TRUE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	nan->len = len;
+	memcpy(nan->name, data, len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1604,6 +1622,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_remote_entity_address;
 	case STK_DATA_OBJECT_TYPE_ESN:
 		return parse_dataobj_esn;
+	case STK_DATA_OBJECT_TYPE_NETWORK_ACCESS_NAME:
+		return parse_dataobj_network_access_name;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 39d159b..9e3cbf5 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -656,6 +656,15 @@ struct stk_remote_entity_address {
 };
 
 /*
+ * According to 102.223 Section 8.70 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs.
+ */
+struct stk_network_access_name {
+	unsigned char name[127];
+	unsigned char len;
+};
+
+/*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
  * of CTLVs.  Empty attribute options will have len of 0.
-- 
1.7.0.4


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

* [PATCH 11/15] Add parser for cdma sms tpdu objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (8 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 10/15] Add parser for network access name objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 12/15] Add parser for item text attribute list objects Yang Gu
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 6b3500e..b1ba4d4 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1454,6 +1454,14 @@ static gboolean parse_dataobj_network_access_name(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.71 */
+static gboolean parse_dataobj_cdma_sms_tpdu(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_common_byte_array *array = user;
+	return parse_dataobj_common_byte_array(iter, array);
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1624,6 +1632,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_esn;
 	case STK_DATA_OBJECT_TYPE_NETWORK_ACCESS_NAME:
 		return parse_dataobj_network_access_name;
+	case STK_DATA_OBJECT_TYPE_CDMA_SMS_TPDU:
+		return parse_dataobj_cdma_sms_tpdu;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
-- 
1.7.0.4


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

* [PATCH 12/15] Add parser for item text attribute list objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (9 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 11/15] Add parser for cdma sms tpdu objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 13/15] Add parser for imeisv objects Yang Gu
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   21 +++++++++++++++++++++
 src/stkutil.h |   11 +++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b1ba4d4..4d6722d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1483,6 +1483,25 @@ static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.73 */
+static gboolean parse_dataobj_item_text_attribute_list(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_item_text_attribute_list *ital = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if ((len > sizeof(ital->list)) || (len % 4 != 0))
+		return FALSE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+
+	memcpy(ital->list, data, len);
+	ital->len = len;
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.80 */
 static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1636,6 +1655,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_cdma_sms_tpdu;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
+	case STK_DATA_OBJECT_TYPE_ITEM_TEXT_ATTRIBUTE_LIST:
+		return parse_dataobj_item_text_attribute_list;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
 		return parse_dataobj_frame_id;
 	default:
diff --git a/src/stkutil.h b/src/stkutil.h
index 9e3cbf5..d973251 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -674,6 +674,17 @@ struct stk_text_attribute {
 	unsigned char len;
 };
 
+/*
+ * According to 102.223 Section 8.73 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs. In addition,
+ * the length should be also the number multiplied by 4, so the maximum number
+ * is 124.
+ */
+struct stk_item_text_attribute_list {
+	unsigned char list[124];
+	unsigned char len;
+};
+
 struct stk_command_display_text {
 	char *text;
 	struct stk_icon_id icon_id;
-- 
1.7.0.4


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

* [PATCH 13/15] Add parser for imeisv objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (10 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 12/15] Add parser for item text attribute list objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 14/15] Add parser for network search mode objects Yang Gu
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 4d6722d..8582b9f 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1502,6 +1502,49 @@ static gboolean parse_dataobj_item_text_attribute_list(
 	return TRUE;
 }
 
+/*
+ * Defined in TS 102.223 Section 8.74.
+ *
+ * According to 3GPP TS 24.008, Section 10.5.1.4, IMEISV is composed of
+ * 16 digits and totally 9 bytes are used to represent it.
+ *
+ * Bits 1-3 of first byte represent the type of identity, and they
+ * are 0 1 1 separately for IMEISV. Bit 4 of first byte is the odd/even
+ * indication, and it's 0 to indicate IMEISV has odd number of digits (16).
+ * The rest bytes are coded using BCD coding.
+ *
+ * For example, if the IMEISV is "1234567890123456", then it's coded as
+ * "13 32 54 76 98 10 32 54 F6".
+ */
+static gboolean parse_dataobj_imeisv(struct comprehension_tlv_iter *iter,
+					void *user)
+{
+	char **imeisv = user;
+	const unsigned char *data;
+	unsigned int len;
+	static const char digit_lut[] = "0123456789*#abc\0";
+
+	len = comprehension_tlv_iter_get_length(iter);
+	if (len != 9)
+		return FALSE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+
+	if ((data[0] & 0x0f) != 0x03)
+		return FALSE;
+
+	if (data[8] >> 4 != 0x0f)
+		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';
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.80 */
 static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1657,6 +1700,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_ITEM_TEXT_ATTRIBUTE_LIST:
 		return parse_dataobj_item_text_attribute_list;
+	case STK_DATA_OBJECT_TYPE_IMEISV:
+		return parse_dataobj_imeisv;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
 		return parse_dataobj_frame_id;
 	default:
-- 
1.7.0.4


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

* [PATCH 14/15] Add parser for network search mode objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (11 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 13/15] Add parser for imeisv objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21  4:55 ` [PATCH 15/15] Add parser for battery state objects Yang Gu
  2010-04-21 15:34 ` [PATCH 01/15] Add parser for access technology objects Denis Kenzior
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stkutil.c b/src/stkutil.c
index 8582b9f..fcc396b 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1545,6 +1545,14 @@ static gboolean parse_dataobj_imeisv(struct comprehension_tlv_iter *iter,
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.75 */
+static gboolean parse_dataobj_network_search_mode(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	unsigned char *byte = user;
+	return parse_dataobj_common_byte(iter, byte);
+}
+
 /* Defined in TS 102.223 Section 8.80 */
 static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1702,6 +1710,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_item_text_attribute_list;
 	case STK_DATA_OBJECT_TYPE_IMEISV:
 		return parse_dataobj_imeisv;
+	case STK_DATA_OBJECT_TYPE_NETWORK_SEARCH_MODE:
+		return parse_dataobj_network_search_mode;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
 		return parse_dataobj_frame_id;
 	default:
-- 
1.7.0.4


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

* [PATCH 15/15] Add parser for battery state objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (12 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 14/15] Add parser for network search mode objects Yang Gu
@ 2010-04-21  4:55 ` Yang Gu
  2010-04-21 15:34 ` [PATCH 01/15] Add parser for access technology objects Denis Kenzior
  14 siblings, 0 replies; 16+ messages in thread
From: Yang Gu @ 2010-04-21  4:55 UTC (permalink / raw)
  To: ofono

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

---
 src/stkutil.c |   10 ++++++++++
 src/stkutil.h |    8 ++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index fcc396b..eec3fc2 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1553,6 +1553,14 @@ static gboolean parse_dataobj_network_search_mode(
 	return parse_dataobj_common_byte(iter, byte);
 }
 
+/* Defined in TS 102.223 Section 8.76 */
+static gboolean parse_dataobj_battery_state(struct comprehension_tlv_iter *iter,
+						void *user)
+{
+	unsigned char *byte = user;
+	return parse_dataobj_common_byte(iter, byte);
+}
+
 /* Defined in TS 102.223 Section 8.80 */
 static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1712,6 +1720,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_imeisv;
 	case STK_DATA_OBJECT_TYPE_NETWORK_SEARCH_MODE:
 		return parse_dataobj_network_search_mode;
+	case STK_DATA_OBJECT_TYPE_BATTERY_STATE:
+		return parse_dataobj_battery_state;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
 		return parse_dataobj_frame_id;
 	default:
diff --git a/src/stkutil.h b/src/stkutil.h
index d973251..98da709 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -357,6 +357,14 @@ enum stk_technology_id {
 	STK_TECHNOLOGY_USB = 		0x04
 };
 
+enum stk_battery_state {
+	STK_BATTERY_VERY_LOW = 	0x00,
+	STK_BATTERY_LOW = 	0x01,
+	STK_BATTERY_AVERAGE = 	0x02,
+	STK_BATTERY_GOOD = 	0x03,
+	STK_BATTERY_FULL = 	0x04
+};
+
 /* For data object that only has a byte array with undetermined length */
 struct stk_common_byte_array {
 	unsigned char *array;
-- 
1.7.0.4


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

* Re: [PATCH 01/15] Add parser for access technology objects
  2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
                   ` (13 preceding siblings ...)
  2010-04-21  4:55 ` [PATCH 15/15] Add parser for battery state objects Yang Gu
@ 2010-04-21 15:34 ` Denis Kenzior
  14 siblings, 0 replies; 16+ messages in thread
From: Denis Kenzior @ 2010-04-21 15:34 UTC (permalink / raw)
  To: ofono

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

Hi Yang,

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

All 15 patches have been applied with some trivial fixes in between.

Regards,
-Denis

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

end of thread, other threads:[~2010-04-21 15:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21  4:55 [PATCH 01/15] Add parser for access technology objects Yang Gu
2010-04-21  4:55 ` [PATCH 02/15] Add parser for display parameters objects Yang Gu
2010-04-21  4:55 ` [PATCH 03/15] Add parser for service record objects Yang Gu
2010-04-21  4:55 ` [PATCH 04/15] Add parser for device filter objects Yang Gu
2010-04-21  4:55 ` [PATCH 05/15] Add parser for service search objects Yang Gu
2010-04-21  4:55 ` [PATCH 06/15] Add parser for attribute information objects Yang Gu
2010-04-21  4:55 ` [PATCH 07/15] Add parser for service availability objects Yang Gu
2010-04-21  4:55 ` [PATCH 08/15] Add parser for remote entity address objects Yang Gu
2010-04-21  4:55 ` [PATCH 09/15] Add parser for esn objects Yang Gu
2010-04-21  4:55 ` [PATCH 10/15] Add parser for network access name objects Yang Gu
2010-04-21  4:55 ` [PATCH 11/15] Add parser for cdma sms tpdu objects Yang Gu
2010-04-21  4:55 ` [PATCH 12/15] Add parser for item text attribute list objects Yang Gu
2010-04-21  4:55 ` [PATCH 13/15] Add parser for imeisv objects Yang Gu
2010-04-21  4:55 ` [PATCH 14/15] Add parser for network search mode objects Yang Gu
2010-04-21  4:55 ` [PATCH 15/15] Add parser for battery state objects Yang Gu
2010-04-21 15:34 ` [PATCH 01/15] Add parser for access technology objects 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.