summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYang Gu <yang.gu@intel.com>2010-06-13 17:43:19 +0800
committerDenis Kenzior <denkenz@gmail.com>2010-06-16 17:43:11 -0500
commit37afdf1ca524da71e2b0ee889409842e444dbf74 (patch)
tree4f447ae688103d0346d5513ceba093c13c014e9f /src
parentdb941ff556fcc27b66f990fa63ca063a4e12e00e (diff)
downloadofono-37afdf1ca524da71e2b0ee889409842e444dbf74.tar.bz2
stk: Add parser for bcch channel list objects
Diffstat (limited to 'src')
-rw-r--r--src/stkutil.c29
-rw-r--r--src/stkutil.h10
2 files changed, 39 insertions, 0 deletions
diff --git a/src/stkutil.c b/src/stkutil.c
index cda2e8a9..248be70a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -832,6 +832,33 @@ static gboolean parse_dataobj_transaction_id(
return TRUE;
}
+/* Defined in TS 31.111 Section 8.29 */
+static gboolean parse_dataobj_bcch_channel_list(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_bcch_channel_list *bcl = user;
+ const unsigned char *data;
+ unsigned int len = comprehension_tlv_iter_get_length(iter);
+ unsigned int i;
+
+ if (len < 1)
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+
+ bcl->num = len * 8 / 10;
+
+ for (i = 0; i < bcl->num; i++) {
+ unsigned int index = i * 10 / 8;
+ unsigned int occupied = i * 10 % 8;
+
+ bcl->channel[i] = (data[index] << (2 + occupied)) +
+ (data[index + 1] >> (6 - occupied));
+ }
+
+ return TRUE;
+}
+
/* Defined in TS 102.223 Section 8.30 */
static gboolean parse_dataobj_call_control_requested_action(
struct comprehension_tlv_iter *iter, void *user)
@@ -1955,6 +1982,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_location_status;
case STK_DATA_OBJECT_TYPE_TRANSACTION_ID:
return parse_dataobj_transaction_id;
+ case STK_DATA_OBJECT_TYPE_BCCH_CHANNEL_LIST:
+ return parse_dataobj_bcch_channel_list;
case STK_DATA_OBJECT_TYPE_CALL_CONTROL_REQUESTED_ACTION:
return parse_dataobj_call_control_requested_action;
case STK_DATA_OBJECT_TYPE_ICON_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index a6fe6335..278738be 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -710,6 +710,16 @@ struct stk_transaction_id {
};
/*
+ * According to 31.111 Section 8.29 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs. Each channel
+ * is represented as 10 bits, so the maximum number of channel is 127*8/10=101.
+ */
+struct stk_bcch_channel_list {
+ unsigned short channel[101];
+ unsigned int num;
+};
+
+/*
* Defined in TS 102.223 Section 8.31
* Icon ID denotes a file on the SIM filesystem. Since EF cannot have record
* ids of 0, we use icon_id with 0 to denote empty icon_identifier objects