From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 5/5] stk: Add parser for timing advance objects
Date: Thu, 17 Jun 2010 18:35:11 +0800 [thread overview]
Message-ID: <1276770911-8817-5-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1276770911-8817-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 3530 bytes --]
---
src/stkutil.c | 22 ++++++++++++++++++++++
src/stkutil.h | 30 ++++++++++++++++++------------
unit/test-stkutil.c | 2 +-
3 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index f03b25c..6178059 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1151,6 +1151,26 @@ static gboolean parse_dataobj_language(struct comprehension_tlv_iter *iter,
return TRUE;
}
+/* Defined in 31.111 Section 8.46 */
+static gboolean parse_dataobj_timing_advance(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_timing_advance *ta = 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);
+
+ ta->has_value = TRUE;
+ ta->status = data[0];
+ ta->advance = data[1];
+
+ return TRUE;
+}
+
/* Defined in 102.223 Section 8.47 */
static gboolean parse_dataobj_browser_id(struct comprehension_tlv_iter *iter,
void *user)
@@ -2074,6 +2094,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_language;
case STK_DATA_OBJECT_TYPE_BROWSER_ID:
return parse_dataobj_browser_id;
+ case STK_DATA_OBJECT_TYPE_TIMING_ADVANCE:
+ return parse_dataobj_timing_advance;
case STK_DATA_OBJECT_TYPE_URL:
return parse_dataobj_url;
case STK_DATA_OBJECT_TYPE_BEARER:
diff --git a/src/stkutil.h b/src/stkutil.h
index 6fb49e0..c2fcea7 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -552,6 +552,11 @@ enum stk_rejection_cause_code {
STK_CAUSE_EMM_PROTOCOL_ERROR = 0x6f,
};
+enum stk_me_status {
+ STK_ME_STATUS_IDLE = 0x00,
+ STK_ME_STATUS_NOT_IDLE = 0x01
+};
+
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
unsigned char *array;
@@ -801,6 +806,18 @@ struct stk_bc_repeat {
unsigned char value;
};
+/* Defined in TS 31.111 Section 8.46 */
+struct stk_timing_advance {
+ ofono_bool_t has_value;
+ enum stk_me_status status;
+ /*
+ * Contains bit periods number according to 3GPP TS
+ * 44.118 Section 9.3.106 / 3GPP TS 44.018 Section
+ * 10.5.2.40.1, not microseconds
+ */
+ unsigned char advance;
+};
+
/*
* According to 102.223 Section 8.52 the length of CTLV is 1 byte. This means
* that the maximum size is 127 according to the rules of CTLVs. This size also
@@ -1381,18 +1398,7 @@ struct stk_response_local_info {
const char *language;
enum stk_battery_state battery_charge;
enum stk_access_technology_type access_technology;
- struct stk_timing_advance {
- enum {
- STK_TIMING_ADVANCE_ME_IDLE = 0x00,
- STK_TIMING_ADVANCE_ME_NOT_IDLE = 0x01,
- } status;
- /*
- * Contains bit periods number according to 3GPP TS
- * 44.118 Section 9.3.106 / 3GPP TS 44.018 Section
- * 10.5.2.40.1, not microseconds
- */
- int advance;
- } tadv;
+ struct stk_timing_advance tadv;
/* Bits[31:24]: manufacturer, bits[23:0]: serial number */
guint32 esn;
const char *imeisv;
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index e498dd6..dd22912 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -18699,7 +18699,7 @@ static const struct terminal_response_test
},
{ .provide_local_info = {
{ .tadv = {
- .status = STK_TIMING_ADVANCE_ME_IDLE,
+ .status = STK_ME_STATUS_IDLE,
.advance = 0,
}},
}},
--
1.7.0.4
next prev parent reply other threads:[~2010-06-17 10:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 10:35 [PATCH 1/5] stk: Add parser for send ussd commands Yang Gu
2010-06-17 10:35 ` [PATCH 2/5] teststk: Add test for send ussd parser Yang Gu
2010-06-17 10:35 ` [PATCH 3/5] Modify " Yang Gu
2010-06-17 10:35 ` [PATCH 4/5] Refactor " Yang Gu
2010-06-21 14:18 ` Denis Kenzior
2010-06-17 10:35 ` Yang Gu [this message]
2010-06-18 19:04 ` [PATCH 1/5] stk: Add parser for send ussd commands Denis Kenzior
2010-06-20 13:52 ` Gu, Yang
2010-06-20 16:26 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276770911-8817-5-git-send-email-yang.gu@intel.com \
--to=yang.gu@intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.