* [PATCH 02/17] Add parser for aid objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
@ 2010-04-20 6:14 ` Yang Gu
2010-04-20 22:00 ` Denis Kenzior
2010-04-20 6:14 ` [PATCH 03/17] Add parser for access technology objects Yang Gu
` (15 subsequent siblings)
16 siblings, 1 reply; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]
---
src/stkutil.c | 20 ++++++++++++++++++++
src/stkutil.h | 23 +++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 5b97aeb..0d4be68 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1225,6 +1225,24 @@ static gboolean parse_dataobj_uicc_te_interface(
return TRUE;
}
+/* Defined in TS 102.223 Section 8.60 */
+static gboolean parse_dataobj_aid(struct comprehension_tlv_iter *iter,
+ void *user)
+{
+ struct stk_aid *aid = user;
+ const unsigned char *data;
+ unsigned char len = comprehension_tlv_iter_get_length(iter);
+
+ if ((len > 16) || (len < 12))
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+ aid->len = len;
+ memcpy(aid->aid, 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)
@@ -1373,6 +1391,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_other_address;
case STK_DATA_OBJECT_TYPE_UICC_TE_INTERFACE:
return parse_dataobj_uicc_te_interface;
+ case STK_DATA_OBJECT_TYPE_AID:
+ return parse_dataobj_aid;
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 1c7c970..67e7ef7 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -337,6 +337,18 @@ enum stk_address_type {
STK_ADDRESS_IPV6 = 0x57
};
+enum stk_access_technology_type {
+ STK_ACCESS_TECHNOLOGY_GSM = 0x00,
+ STK_ACCESS_TECHNOLOGY_TIA_EIA_553 = 0x01,
+ STK_ACCESS_TECHNOLOGY_TIA_EIA_136_C = 0x02,
+ STK_ACCESS_TECHNOLOGY_UTRAN = 0x03,
+ STK_ACCESS_TECHNOLOGY_TETRA = 0x04,
+ STK_ACCESS_TECHNOLOGY_TIA_EIA_95 = 0x05,
+ STK_ACCESS_TECHNOLOGY_CDMA2000_1X = 0x06,
+ STK_ACCESS_TECHNOLOGY_CDMA2000_HRPD = 0x07,
+ STK_ACCESS_TECHNOLOGY_EUTRAN = 0x08
+};
+
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
unsigned char *array;
@@ -577,6 +589,17 @@ struct stk_uicc_te_interface {
};
/*
+ * Defined in TS 102.223 Section 8.60.
+ * According to 101.220, Section 4, aid contains two fields RID and PIX.
+ * RID has 5 bytes, while PIX contains information between 7 to 11 bytes.
+ * So the maximum size of aid is 16 bytes.
+ */
+struct stk_aid {
+ unsigned char aid[16];
+ 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
* of CTLVs. Empty attribute options will have len of 0.
--
1.7.0.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 03/17] Add parser for access technology objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
2010-04-20 6:14 ` [PATCH 02/17] Add parser for aid objects Yang Gu
@ 2010-04-20 6:14 ` Yang Gu
2010-04-20 21:53 ` Denis Kenzior
2010-04-20 6:14 ` [PATCH 04/17] Add parser for display parameters objects Yang Gu
` (14 subsequent siblings)
16 siblings, 1 reply; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2027 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 0d4be68..d690f51 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1243,6 +1243,24 @@ static gboolean parse_dataobj_aid(struct comprehension_tlv_iter *iter,
return TRUE;
}
+/* Defined in TS 102.223 Section 8.61 */
+static gboolean parse_dataobj_access_technology(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_access_technology *at = 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);
+ at->len = len;
+ memcpy(at->tech, 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)
@@ -1393,6 +1411,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:
diff --git a/src/stkutil.h b/src/stkutil.h
index 67e7ef7..1e75533 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -600,6 +600,15 @@ struct stk_aid {
};
/*
+ * According to 102.223 Section 8.61 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs.
+ */
+struct stk_access_technology {
+ unsigned char tech[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] 24+ messages in thread* [PATCH 04/17] Add parser for display parameters objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
2010-04-20 6:14 ` [PATCH 02/17] Add parser for aid objects Yang Gu
2010-04-20 6:14 ` [PATCH 03/17] Add parser for access technology objects Yang Gu
@ 2010-04-20 6:14 ` Yang Gu
2010-04-20 6:15 ` [PATCH 05/17] Add parser for service record objects Yang Gu
` (13 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1907 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 d690f51..1d5d1b4 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1261,6 +1261,24 @@ static gboolean parse_dataobj_access_technology(
return TRUE;
}
+/* 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)
@@ -1413,6 +1431,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 1e75533..2cfbc83 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -608,6 +608,13 @@ struct stk_access_technology {
unsigned char 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] 24+ messages in thread* [PATCH 05/17] Add parser for service record objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (2 preceding siblings ...)
2010-04-20 6:14 ` [PATCH 04/17] Add parser for display parameters objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 21:55 ` Denis Kenzior
2010-04-20 6:15 ` [PATCH 06/17] Add parser for device filter objects Yang Gu
` (12 subsequent siblings)
16 siblings, 1 reply; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 1d5d1b4..ecfa32b 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1279,6 +1279,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)
@@ -1433,6 +1459,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 2cfbc83..524d763 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;
@@ -615,6 +623,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] 24+ messages in thread* Re: [PATCH 05/17] Add parser for service record objects
2010-04-20 6:15 ` [PATCH 05/17] Add parser for service record objects Yang Gu
@ 2010-04-20 21:55 ` Denis Kenzior
2010-04-21 5:06 ` Gu, Yang
0 siblings, 1 reply; 24+ messages in thread
From: Denis Kenzior @ 2010-04-20 21:55 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
Hi Yang,
> + sr->serv_rec = g_try_malloc(sr->len);
> + if (sr->serv_rec == NULL)
> + return FALSE;
I suggest not trying to allocate 0 bytes.
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH 05/17] Add parser for service record objects
2010-04-20 21:55 ` Denis Kenzior
@ 2010-04-21 5:06 ` Gu, Yang
0 siblings, 0 replies; 24+ messages in thread
From: Gu, Yang @ 2010-04-21 5:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
Hi Denis,
>-----Original Message-----
>From: ofono-bounces(a)ofono.org [mailto:ofono-bounces(a)ofono.org] On Behalf Of
>Denis Kenzior
>Sent: Wednesday, April 21, 2010 5:56 AM
>To: ofono(a)ofono.org
>Subject: Re: [PATCH 05/17] Add parser for service record objects
>
>Hi Yang,
>
>> + sr->serv_rec = g_try_malloc(sr->len);
>> + if (sr->serv_rec == NULL)
>> + return FALSE;
>
>I suggest not trying to allocate 0 bytes.
The service record field is either meaningful value or "00", so it will never allocate 0 byte. Other patches are modified following this comment.
>
>Regards,
>-Denis
>_______________________________________________
>ofono mailing list
>ofono(a)ofono.org
>http://lists.ofono.org/listinfo/ofono
Regards,
-Yang
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 06/17] Add parser for device filter objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (3 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 05/17] Add parser for service record objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 21:56 ` Denis Kenzior
2010-04-20 6:15 ` [PATCH 07/17] Add parser for service search objects Yang Gu
` (11 subsequent siblings)
16 siblings, 1 reply; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]
---
src/stkutil.c | 26 ++++++++++++++++++++++++++
src/stkutil.h | 7 +++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index ecfa32b..827ea9c 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1305,6 +1305,30 @@ 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 < 2)
+ return FALSE;
+
+ 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)
@@ -1461,6 +1485,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 524d763..96c4363 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -631,6 +631,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] 24+ messages in thread* [PATCH 07/17] Add parser for service search objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (4 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 06/17] Add parser for device filter objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 08/17] Add parser for attribute information objects Yang Gu
` (10 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]
---
src/stkutil.c | 26 ++++++++++++++++++++++++++
src/stkutil.h | 7 +++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 827ea9c..2baaeab 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1329,6 +1329,30 @@ 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 < 2)
+ return FALSE;
+
+ 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)
@@ -1487,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 96c4363..9c4ff20 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -638,6 +638,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] 24+ messages in thread* [PATCH 08/17] Add parser for attribute information objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (5 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 07/17] Add parser for service search objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 09/17] Add parser for service availability objects Yang Gu
` (9 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2031 bytes --]
---
src/stkutil.c | 26 ++++++++++++++++++++++++++
src/stkutil.h | 7 +++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 2baaeab..e320086 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1353,6 +1353,30 @@ 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 < 2)
+ return FALSE;
+
+ 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 +1537,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 9c4ff20..8c5e6f5 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -645,6 +645,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] 24+ messages in thread* [PATCH 09/17] Add parser for service availability objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (6 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 08/17] Add parser for attribute information objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 10/17] Add parser for remote entity address objects Yang Gu
` (8 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 e320086..7209842 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1377,6 +1377,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)
@@ -1539,6 +1547,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] 24+ messages in thread* [PATCH 10/17] Add parser for remote entity address objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (7 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 09/17] Add parser for service availability objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 21:58 ` Denis Kenzior
2010-04-20 6:15 ` [PATCH 11/17] Add parser for esn objects Yang Gu
` (7 subsequent siblings)
16 siblings, 1 reply; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2353 bytes --]
---
src/stkutil.c | 31 +++++++++++++++++++++++++++++++
src/stkutil.h | 10 ++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 7209842..4863989 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1385,6 +1385,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)
@@ -1549,6 +1578,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 8c5e6f5..184c098 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -653,6 +653,16 @@ 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. So the maximum
+ * size of address is 6 bytes.
+ */
+struct stk_remote_entity_address {
+ unsigned char coding_type;
+ unsigned char addr[6];
+};
+
+/*
* 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] 24+ messages in thread* [PATCH 11/17] Add parser for esn objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (8 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 10/17] Add parser for remote entity address objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 12/17] Add parser for network access name objects Yang Gu
` (6 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 4863989..db5b8b8 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1414,6 +1414,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)
@@ -1580,6 +1599,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] 24+ messages in thread* [PATCH 12/17] Add parser for network access name objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (9 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 11/17] Add parser for esn objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 13/17] Add parser for cdma sms tpdu objects Yang Gu
` (5 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 db5b8b8..fd44456 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1433,6 +1433,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)
@@ -1601,6 +1619,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 184c098..01597b3 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -663,6 +663,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] 24+ messages in thread* [PATCH 13/17] Add parser for cdma sms tpdu objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (10 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 12/17] Add parser for network access name objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 14/17] Add parser for item text attribute list objects Yang Gu
` (4 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 fd44456..e6d69ef 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1451,6 +1451,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)
@@ -1621,6 +1629,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] 24+ messages in thread* [PATCH 14/17] Add parser for item text attribute list objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (11 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 13/17] Add parser for cdma sms tpdu objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 15/17] Add parser for imeisv objects Yang Gu
` (3 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 e6d69ef..0f373f9 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1480,6 +1480,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)
@@ -1633,6 +1652,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 01597b3..f9cf34b 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -681,6 +681,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] 24+ messages in thread* [PATCH 15/17] Add parser for imeisv objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (12 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 14/17] Add parser for item text attribute list objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 16/17] Add parser for network search mode objects Yang Gu
` (2 subsequent siblings)
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 0f373f9..17e38d3 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1499,6 +1499,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)
@@ -1654,6 +1697,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] 24+ messages in thread* [PATCH 16/17] Add parser for network search mode objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (13 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 15/17] Add parser for imeisv objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 6:15 ` [PATCH 17/17] Add parser for battery state objects Yang Gu
2010-04-20 22:00 ` [PATCH 01/17] Add parser for item text attribute list objects Denis Kenzior
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 17e38d3..a3c5f47 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1542,6 +1542,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)
@@ -1699,6 +1707,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] 24+ messages in thread* [PATCH 17/17] Add parser for battery state objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (14 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 16/17] Add parser for network search mode objects Yang Gu
@ 2010-04-20 6:15 ` Yang Gu
2010-04-20 22:00 ` [PATCH 01/17] Add parser for item text attribute list objects Denis Kenzior
16 siblings, 0 replies; 24+ messages in thread
From: Yang Gu @ 2010-04-20 6:15 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 a3c5f47..832d2f8 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1550,6 +1550,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)
@@ -1709,6 +1717,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 f9cf34b..6e822f8 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] 24+ messages in thread* Re: [PATCH 01/17] Add parser for item text attribute list objects
2010-04-20 6:14 [PATCH 01/17] Add parser for item text attribute list objects Yang Gu
` (15 preceding siblings ...)
2010-04-20 6:15 ` [PATCH 17/17] Add parser for battery state objects Yang Gu
@ 2010-04-20 22:00 ` Denis Kenzior
16 siblings, 0 replies; 24+ messages in thread
From: Denis Kenzior @ 2010-04-20 22:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
Hi Yang,
> ---
> src/stkutil.c | 20 ++++++++++++++++++++
> src/stkutil.h | 6 ++++++
> 2 files changed, 26 insertions(+), 0 deletions(-)
This patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 24+ messages in thread