* [PATCH 02/20] test-stkutil: Add Set Up Call response tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 03/20] stkutil: Add Polling Off response builder support Andrzej Zaborowski
` (18 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 9544 bytes --]
---
unit/test-stkutil.c | 262 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 262 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 7793f3a..34fc63e 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -15956,6 +15956,234 @@ static const struct terminal_response_test select_item_response_data_811 = {
},
};
+static const unsigned char set_up_call_response_111[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test set_up_call_response_data_111 = {
+ .pdu = set_up_call_response_111,
+ .pdu_len = sizeof(set_up_call_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x00, /* Only if not busy on another call */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_121[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x22,
+};
+
+static const struct terminal_response_test set_up_call_response_data_121 = {
+ .pdu = set_up_call_response_121,
+ .pdu_len = sizeof(set_up_call_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x00, /* Only if not busy on another call */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_USER_REJECT,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_141[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test set_up_call_response_data_141 = {
+ .pdu = set_up_call_response_141,
+ .pdu_len = sizeof(set_up_call_response_141),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x02, /* Put all other calls on hold */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_151[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x04, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test set_up_call_response_data_151 = {
+ .pdu = set_up_call_response_151,
+ .pdu_len = sizeof(set_up_call_response_151),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x04, /* Disconnect all other calls */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_161[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x20, 0x02,
+};
+
+static const struct terminal_response_test set_up_call_response_data_161 = {
+ .pdu = set_up_call_response_161,
+ .pdu_len = sizeof(set_up_call_response_161),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x00, /* Only if not busy on another call */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TERMINAL_BUSY,
+ .additional_len = 1, /* ME currently busy on call */
+ .additional = (unsigned char[1]) { 0x02 },
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_171a[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x21, 0x00,
+};
+
+static const struct terminal_response_test set_up_call_response_data_171a = {
+ .pdu = set_up_call_response_171a,
+ .pdu_len = sizeof(set_up_call_response_171a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x02, /* Put all other calls on hold */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE,
+ .additional_len = 1, /* No specific cause given */
+ .additional = (unsigned char[1]) { 0x00 },
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_171b[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x21, 0x9d,
+};
+
+static const struct terminal_response_test set_up_call_response_data_171b = {
+ .pdu = set_up_call_response_171b,
+ .pdu_len = sizeof(set_up_call_response_171b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x02, /* Put all other calls on hold */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE,
+ .additional_len = 1, /* Facility rejected */
+ .additional = (unsigned char[1]) { 0x9d },
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_1101[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test set_up_call_response_data_1101 = {
+ .pdu = set_up_call_response_1101,
+ .pdu_len = sizeof(set_up_call_response_1101),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x01, /* Only if not busy, with redial */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_1111b[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x30,
+};
+
+static const struct terminal_response_test set_up_call_response_data_1111b = {
+ .pdu = set_up_call_response_1111b,
+ .pdu_len = sizeof(set_up_call_response_1111b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x00, /* Only if not busy on another call */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NOT_CAPABLE,
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_1121[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x21, 0x91,
+};
+
+static const struct terminal_response_test set_up_call_response_data_1121 = {
+ .pdu = set_up_call_response_1121,
+ .pdu_len = sizeof(set_up_call_response_1121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x01, /* Only if not busy, with redial */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE,
+ .additional_len = 1, /* User busy */
+ .additional = (unsigned char[1]) { 0x91 },
+ },
+ },
+};
+
+static const unsigned char set_up_call_response_311b[] = {
+ 0x81, 0x03, 0x01, 0x10, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04,
+};
+
+static const struct terminal_response_test set_up_call_response_data_311b = {
+ .pdu = set_up_call_response_311b,
+ .pdu_len = sizeof(set_up_call_response_311b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_CALL,
+ .qualifier = 0x00, /* Only if not busy on another call */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -16897,6 +17125,40 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Setup Call 7.2.1",
&setup_call_data_721, test_setup_call);
+ g_test_add_data_func("/teststk/Set Up Call response 1.1.1",
+ &set_up_call_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.2.1",
+ &set_up_call_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.4.1",
+ &set_up_call_response_data_141,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.5.1",
+ &set_up_call_response_data_151,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.6.1",
+ &set_up_call_response_data_161,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.7.1A",
+ &set_up_call_response_data_171a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.7.1B",
+ &set_up_call_response_data_171b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.10.1",
+ &set_up_call_response_data_1101,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.11.1B",
+ &set_up_call_response_data_1111b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 1.12.1",
+ &set_up_call_response_data_1121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Call response 3.1.1B",
+ &set_up_call_response_data_311b,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Refresh 1.2.1",
&refresh_data_121, test_refresh);
g_test_add_data_func("/teststk/Refresh 1.5.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 03/20] stkutil: Add Polling Off response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 02/20] test-stkutil: Add Set Up Call response tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 04/20] test-stkutil: Add a Polling Off response test Andrzej Zaborowski
` (17 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
---
src/stkutil.c | 2 ++
src/stkutil.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index c9b9511..1f477db 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3532,6 +3532,8 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
case STK_COMMAND_TYPE_SETUP_CALL:
ok = build_set_up_call(&builder, response);
break;
+ case STK_COMMAND_TYPE_POLLING_OFF:
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 3245a90..82384c4 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1096,6 +1096,7 @@ struct stk_response {
struct stk_response_select_item select_item;
struct stk_response_generic send_sms;
struct stk_response_set_up_call set_up_call;
+ struct stk_response_generic polling_off;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 04/20] test-stkutil: Add a Polling Off response test
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 02/20] test-stkutil: Add Set Up Call response tests Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 03/20] stkutil: Add Polling Off response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 05/20] stkutil: Add the Provide Local Info response builder Andrzej Zaborowski
` (16 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
---
unit/test-stkutil.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 34fc63e..35301f3 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -16184,6 +16184,26 @@ static const struct terminal_response_test set_up_call_response_data_311b = {
},
};
+static const unsigned char polling_off_response_112[] = {
+ 0x81, 0x03, 0x01, 0x04, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test polling_off_response_data_112 = {
+ .pdu = polling_off_response_112,
+ .pdu_len = sizeof(polling_off_response_112),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_POLLING_OFF,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -17207,6 +17227,10 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Polling off 1.1.2",
&polling_off_data_112, test_polling_off);
+ g_test_add_data_func("/teststk/Polling off response 1.1.2",
+ &polling_off_response_data_112,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Provide Local Info 1.2.1",
&provide_local_info_data_121, test_provide_local_info);
g_test_add_data_func("/teststk/Provide Local Info 1.4.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 05/20] stkutil: Add the Provide Local Info response builder
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (2 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 04/20] test-stkutil: Add a Polling Off response test Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 06/20] test-stkutil: Add Provide Local Info response tests Andrzej Zaborowski
` (15 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 18088 bytes --]
---
src/stkutil.c | 447 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/stkutil.h | 53 +++++++
2 files changed, 500 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 1f477db..422a786 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3165,6 +3165,17 @@ static gboolean stk_tlv_builder_append_byte(struct stk_tlv_builder *iter,
return TRUE;
}
+static gboolean stk_tlv_builder_append_short(struct stk_tlv_builder *iter,
+ unsigned short num)
+{
+ if (iter->len + 2 > iter->max_len)
+ return FALSE;
+
+ iter->value[iter->len++] = num >> 8;
+ iter->value[iter->len++] = num & 0xff;
+ return TRUE;
+}
+
static gboolean stk_tlv_builder_append_gsm_packed(struct stk_tlv_builder *iter,
const char *text)
{
@@ -3383,6 +3394,118 @@ static gboolean build_dataobj_text(struct stk_tlv_builder *tlv,
return stk_tlv_builder_close_container(tlv);
}
+/* Described in TS 102.223 Section 8.19 */
+static gboolean build_dataobj_location_info(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_location_info *li = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_LOCATION_INFO;
+ guint8 mccmnc[3];
+
+ if (li->mcc[0] == 0)
+ /*
+ * "If no location information is available for an access
+ * technology, the respective data object shall have
+ * length zero."
+ */
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_close_container(tlv);
+
+ sim_encode_mcc_mnc(mccmnc, li->mcc, li->mnc);
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, mccmnc, 3) &&
+ stk_tlv_builder_append_short(tlv, li->lac_tac) &&
+ (li->has_ci == FALSE ||
+ stk_tlv_builder_append_short(tlv, li->ci)) &&
+ (li->has_ext_ci == FALSE ||
+ stk_tlv_builder_append_short(tlv, li->ext_ci)) &&
+ (li->has_eutran_ci == FALSE ||
+ (stk_tlv_builder_append_short(tlv, li->eutran_ci >> 12) &&
+ stk_tlv_builder_append_short(tlv,
+ (li->eutran_ci << 4) | 0xf))) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.20
+ *
+ * See format note in parse_dataobj_imei.
+ */
+static gboolean build_dataobj_imei(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ char byte0[3];
+ const char *imei = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_IMEI;
+ unsigned char value[8];
+
+ if (imei == NULL)
+ return TRUE;
+
+ if (strlen(imei) != 15)
+ return FALSE;
+
+ byte0[0] = '*';
+ byte0[1] = imei[0];
+ byte0[2] = '\0';
+ sim_encode_bcd_number(byte0, value);
+ sim_encode_bcd_number(imei + 1, value + 1);
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, value, 8) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.22 */
+static gboolean build_dataobj_network_measurement_results(
+ struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_common_byte_array *nmr = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_NETWORK_MEASUREMENT_RESULTS;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ (nmr->len == 0 ||
+ stk_tlv_builder_append_bytes(tlv, nmr->array, nmr->len)) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in 3GPP 31.111 Section 8.29 */
+static gboolean build_dataobj_bcch_channel_list(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_bcch_ch_list *list = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_BCCH_CHANNEL_LIST;
+ int i, bytes, pos, shift;
+ unsigned char value;
+
+ /* To distinguish between no BCCH Channel List data object and
+ * an empty object in a sequence of empty and non-empty objects,
+ * .channels must be non-NULL in objects in sequences. */
+ if (list->channels == NULL)
+ return TRUE;
+
+ if (stk_tlv_builder_open_container(tlv, cr, tag, TRUE) != TRUE)
+ return FALSE;
+
+ bytes = (list->length * 10 + 7) / 8;
+ for (i = 0; i < bytes; i++) {
+ pos = (i * 8 + 7) / 10;
+ shift = pos * 10 + 10 - i * 8 - 8;
+
+ value = 0;
+ if (pos < list->length)
+ value |= list->channels[pos] >> shift;
+ if (shift > 2)
+ value |= list->channels[pos - 1] << (10 - shift);
+
+ if (stk_tlv_builder_append_byte(tlv, value) != TRUE)
+ return FALSE;
+ }
+
+ return stk_tlv_builder_close_container(tlv);
+}
+
/* Described in TS 102.223 Section 8.30 */
static gboolean build_dataobj_cc_requested_action(struct stk_tlv_builder *tlv,
const void *data, gboolean cr)
@@ -3397,6 +3520,195 @@ static gboolean build_dataobj_cc_requested_action(struct stk_tlv_builder *tlv,
stk_tlv_builder_close_container(tlv));
}
+/* Described in TS 102.223 Section 8.39 */
+static gboolean build_dataobj_datetime_timezone(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct sms_scts *scts = data;
+ struct sms_scts timestamp;
+ unsigned char value[7];
+ int offset = 0;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_DATETIME_TIMEZONE;
+
+ if (scts->month == 0 && scts->day == 0)
+ return TRUE;
+
+ /* Time zone information is optional */
+ if (scts->timezone == (gint8) 0xff) {
+ memcpy(×tamp, scts, sizeof(timestamp));
+ timestamp.timezone = 0;
+ if (sms_encode_scts(×tamp, value, &offset) != TRUE)
+ return FALSE;
+ value[6] = 0xff;
+ } else
+ if (sms_encode_scts(scts, value, &offset) != TRUE)
+ return FALSE;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, value, 7) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.45 */
+static gboolean build_dataobj_language(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ unsigned char tag = STK_DATA_OBJECT_TYPE_LANGUAGE;
+
+ if (data == NULL)
+ return TRUE;
+
+ /*
+ * Coded as two GSM 7-bit characters with eighth bit clear. Since
+ * ISO 639-2 codes use only english alphabet letters, no conversion
+ * from UTF-8 to GSM is needed.
+ */
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, data, 2) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in 3GPP TS 31.111 Section 8.46 */
+static gboolean build_dataobj_timing_advance(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_timing_advance *tadv = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_TIMING_ADVANCE;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_byte(tlv, tadv->status) &&
+ stk_tlv_builder_append_byte(tlv, tadv->advance) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.61 */
+static gboolean build_dataobj_access_technologies(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_access_technologies *techs = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_ACCESS_TECHNOLOGY;
+ int i;
+
+ if (stk_tlv_builder_open_container(tlv, cr, tag, FALSE) != TRUE)
+ return FALSE;
+
+ for (i = 0; i < techs->length; i++)
+ if (stk_tlv_builder_append_byte(tlv, techs->techs[i]) != TRUE)
+ return FALSE;
+
+ return stk_tlv_builder_close_container(tlv);
+}
+
+/* Shortcut for a single Access Technology */
+static gboolean build_dataobj_access_technology(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ return build_dataobj_access_technologies(tlv,
+ &(const struct stk_access_technologies) {
+ .techs = data, .length = 1 }, cr);
+}
+
+/* Described in TS 102.223 Section 8.69 */
+static gboolean build_dataobj_esn(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const guint32 *esn = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_ESN;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_short(tlv, *esn >> 16) &&
+ stk_tlv_builder_append_short(tlv, *esn >> 0) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.74
+ *
+ * See format note in parse_dataobj_imeisv.
+ */
+static gboolean build_dataobj_imeisv(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ char byte0[3];
+ const char *imeisv = data;
+ unsigned char value[9];
+ unsigned char tag = STK_DATA_OBJECT_TYPE_IMEISV;
+
+ if (imeisv == NULL)
+ return TRUE;
+
+ if (strlen(imeisv) != 16)
+ return FALSE;
+
+ byte0[0] = '3';
+ byte0[1] = imeisv[0];
+ byte0[2] = '\0';
+ sim_encode_bcd_number(byte0, value);
+ sim_encode_bcd_number(imeisv + 1, value + 1);
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, value, 9) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.75 */
+static gboolean build_dataobj_network_search_mode(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const enum stk_network_search_mode *mode = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_NETWORK_SEARCH_MODE;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_byte(tlv, *mode) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.76 */
+static gboolean build_dataobj_battery_state(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const enum stk_battery_state *state = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_BATTERY_STATE;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_byte(tlv, *state) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.81 */
+static gboolean build_dataobj_meid(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const char *meid = data;
+ unsigned char value[8];
+ unsigned char tag = STK_DATA_OBJECT_TYPE_MEID;
+
+ if (meid == NULL)
+ return TRUE;
+
+ if (strlen(meid) != 16)
+ return FALSE;
+
+ sim_encode_bcd_number(meid, value);
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_bytes(tlv, value, 8) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
+/* Described in TS 102.223 Section 8.90 */
+static gboolean build_dataobj_broadcast_network_information(
+ struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_broadcast_network_information *bni = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_BROADCAST_NETWORK_INFO;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_byte(tlv, bni->tech) &&
+ stk_tlv_builder_append_bytes(tlv, bni->loc_info, bni->len) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
static gboolean build_dataobj(struct stk_tlv_builder *tlv,
dataobj_writer builder_func, ...)
{
@@ -3438,6 +3750,138 @@ static gboolean build_set_up_call(struct stk_tlv_builder *builder,
NULL);
}
+static gboolean build_local_info(struct stk_tlv_builder *builder,
+ const struct stk_response *response)
+{
+ const struct stk_response_local_info *info =
+ &response->provide_local_info;
+ int i;
+
+ switch (response->qualifier) {
+ case 0x00: /* Location Information according to current NAA */
+ return build_dataobj(builder,
+ build_dataobj_location_info,
+ DATAOBJ_FLAG_CR, &info->location,
+ NULL);
+
+ case 0x01: /* IMEI of the terminal */
+ return build_dataobj(builder,
+ build_dataobj_imei,
+ DATAOBJ_FLAG_CR, info->imei,
+ NULL);
+
+ case 0x02: /* Network Measurement results according to current NAA */
+ return build_dataobj(builder,
+ build_dataobj_network_measurement_results,
+ DATAOBJ_FLAG_CR, &info->nmr.nmr,
+ build_dataobj_bcch_channel_list,
+ DATAOBJ_FLAG_CR, &info->nmr.bcch_ch_list,
+ NULL);
+
+ case 0x03: /* Date, time and time zone */
+ return build_dataobj(builder,
+ build_dataobj_datetime_timezone,
+ DATAOBJ_FLAG_CR, &info->datetime,
+ NULL);
+
+ case 0x04: /* Language setting */
+ return build_dataobj(builder,
+ build_dataobj_language,
+ DATAOBJ_FLAG_CR, info->language,
+ NULL);
+
+ case 0x05: /* Timing Advance */
+ return build_dataobj(builder,
+ build_dataobj_timing_advance,
+ DATAOBJ_FLAG_CR, &info->tadv,
+ NULL);
+
+ case 0x06: /* Access Technology (single access technology) */
+ return build_dataobj(builder,
+ build_dataobj_access_technology,
+ 0, &info->access_technology,
+ NULL);
+
+ case 0x07: /* ESN of the terminal */
+ return build_dataobj(builder,
+ build_dataobj_esn,
+ DATAOBJ_FLAG_CR, &info->esn,
+ NULL);
+
+ case 0x08: /* IMEISV of the terminal */
+ return build_dataobj(builder,
+ build_dataobj_imeisv,
+ DATAOBJ_FLAG_CR, info->imeisv,
+ NULL);
+
+ case 0x09: /* Search Mode */
+ return build_dataobj(builder,
+ build_dataobj_network_search_mode,
+ 0, &info->search_mode,
+ NULL);
+
+ case 0x0a: /* Charge State of the Battery */
+ return build_dataobj(builder,
+ build_dataobj_battery_state,
+ DATAOBJ_FLAG_CR, &info->battery_charge,
+ NULL);
+
+ case 0x0b: /* MEID of the terminal */
+ return build_dataobj(builder,
+ build_dataobj_meid,
+ 0, info->meid,
+ NULL);
+
+ case 0x0d: /* Broadcast Network Information according to current tech */
+ return build_dataobj(builder,
+ build_dataobj_broadcast_network_information,
+ 0, &info->broadcast_network_info,
+ NULL);
+
+ case 0x0e: /* Multiple Access Technologies */
+ return build_dataobj(builder,
+ build_dataobj_access_technologies,
+ 0, &info->access_technologies,
+ NULL);
+
+ case 0x0f: /* Location Information for multiple NAAs */
+ if (build_dataobj(builder,
+ build_dataobj_access_technologies,
+ 0, &info->location_infos.access_techs,
+ NULL) != TRUE)
+ return FALSE;
+
+ for (i = 0; i < info->location_infos.access_techs.length; i++)
+ if (build_dataobj(builder,
+ build_dataobj_location_info,
+ 0, &info->location_infos.locations[i],
+ NULL) != TRUE)
+ return FALSE;
+
+ return TRUE;
+
+ case 0x10: /* Network Measurement results for multiple NAAs */
+ if (build_dataobj(builder,
+ build_dataobj_access_technologies,
+ 0, &info->nmrs.access_techs,
+ NULL) != TRUE)
+ return FALSE;
+
+ for (i = 0; i < info->nmrs.access_techs.length; i++)
+ if (build_dataobj(builder,
+ build_dataobj_network_measurement_results,
+ 0, &info->nmrs.nmrs[i].nmr,
+ build_dataobj_bcch_channel_list,
+ 0, &info->nmrs.nmrs[i].bcch_ch_list,
+ NULL) != TRUE)
+ return FALSE;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
unsigned int stk_pdu_from_response(const struct stk_response *response,
unsigned char *pdu, unsigned int size)
{
@@ -3534,6 +3978,9 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
break;
case STK_COMMAND_TYPE_POLLING_OFF:
break;
+ case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
+ ok = build_local_info(&builder, response);
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 82384c4..013341c 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -110,6 +110,7 @@ enum stk_data_object_type {
STK_DATA_OBJECT_TYPE_CAUSE = 0x1A,
STK_DATA_OBJECT_TYPE_LOCATION_STATUS = 0x1B,
STK_DATA_OBJECT_TYPE_TRANSACTION_ID = 0x1C,
+ STK_DATA_OBJECT_TYPE_BCCH_CHANNEL_LIST = 0x1D,
STK_DATA_OBJECT_TYPE_ICON_ID = 0x1E,
STK_DATA_OBJECT_TYPE_ITEM_ICON_ID_LIST = 0x1F,
STK_DATA_OBJECT_TYPE_CARD_READER_STATUS = 0x20,
@@ -544,6 +545,8 @@ struct stk_location_info {
unsigned short ci;
ofono_bool_t has_ext_ci;
unsigned short ext_ci;
+ ofono_bool_t has_eutran_ci;
+ guint32 eutran_ci;
};
/*
@@ -1077,6 +1080,55 @@ struct stk_response_set_up_call {
} modified_result;
};
+struct stk_response_local_info {
+ union {
+ struct stk_location_info location;
+ const char *imei;
+ struct stk_network_measurement_results {
+ struct stk_common_byte_array nmr;
+ struct stk_bcch_ch_list {
+ const short *channels;
+ int length;
+ } bcch_ch_list;
+ } nmr;
+ struct sms_scts datetime;
+ 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;
+ /* Bits[31:24]: manufacturer, bits[23:0]: serial number */
+ guint32 esn;
+ const char *imeisv;
+ enum stk_network_search_mode {
+ STK_NETWORK_SEARCH_MODE_MANUAL = 0x00,
+ STK_NETWORK_SEARCH_MODE_AUTOMATIC = 0x01,
+ } search_mode;
+ const char *meid;
+ struct stk_broadcast_network_information broadcast_network_info;
+ struct stk_access_technologies {
+ const enum stk_access_technology_type *techs;
+ int length;
+ } access_technologies;
+ struct {
+ struct stk_access_technologies access_techs;
+ struct stk_location_info *locations;
+ } location_infos;
+ struct {
+ struct stk_access_technologies access_techs;
+ struct stk_network_measurement_results *nmrs;
+ } nmrs;
+ };
+};
+
struct stk_response {
unsigned char number;
unsigned char type;
@@ -1097,6 +1149,7 @@ struct stk_response {
struct stk_response_generic send_sms;
struct stk_response_set_up_call set_up_call;
struct stk_response_generic polling_off;
+ struct stk_response_local_info provide_local_info;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 06/20] test-stkutil: Add Provide Local Info response tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (3 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 05/20] stkutil: Add the Provide Local Info response builder Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 07/20] stkutil: Add Set Up Event List response builder support Andrzej Zaborowski
` (14 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 18508 bytes --]
---
unit/test-stkutil.c | 555 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 555 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 35301f3..45f47d1 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -16204,6 +16204,509 @@ static const struct terminal_response_test polling_off_response_data_112 = {
},
};
+static const unsigned char provide_local_info_response_111a[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x93, 0x07, 0x00, 0xf1,
+ 0x10, 0x00, 0x01, 0x00, 0x01,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_111a = {
+ .pdu = provide_local_info_response_111a,
+ .pdu_len = sizeof(provide_local_info_response_111a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .location = {
+ .mcc = "001",
+ .mnc = "01",
+ .lac_tac = 0x0001,
+ .has_ci = TRUE,
+ .ci = 0x0001,
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_111b[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x93, 0x07, 0x00, 0x11,
+ 0x10, 0x00, 0x01, 0x00, 0x01,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_111b = {
+ .pdu = provide_local_info_response_111b,
+ .pdu_len = sizeof(provide_local_info_response_111b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .location = {
+ .mcc = "001",
+ .mnc = "011",
+ .lac_tac = 0x0001,
+ .has_ci = TRUE,
+ .ci = 0x0001,
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_121[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x94, 0x08, 0x1a, 0x32,
+ 0x54, 0x76, 0x98, 0x10, 0x32, 0x54, /* Typo in TS 102 384? */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_121 = {
+ .pdu = provide_local_info_response_121,
+ .pdu_len = sizeof(provide_local_info_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x01, /* IMEI of the Terminal */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .imei = "123456789012345", }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_131[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x96, 0x10, 0x34, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x0d,
+ 0x8c, 0x63, 0x58, 0xe2, 0x39, 0x8f, 0x63, 0xf9,
+ 0x06, 0x45, 0x91, 0xa4, 0x90,
+};
+
+static const short bcch_channels_131[] = {
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_131 = {
+ .pdu = provide_local_info_response_131,
+ .pdu_len = sizeof(provide_local_info_response_131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x02, /* Network Measurement Results */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .nmr = {
+ .nmr = {
+ /* RXLEV-FULL-SERVING-CELL=52, no BA,
+ * no DTX */
+ .array = (unsigned char[16]) {
+ 0x34, 0x34, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ .len = 16,
+ },
+ .bcch_ch_list = {
+ .channels = (short[]) {
+ 561, 565, 568, 569, 573,
+ 575, 577, 581, 582, 585,
+ },
+ .length = 10,
+ },
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_141[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x03, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa6, 0x07, 0x20, 0x50,
+ 0x70, 0x41, 0x80, 0x71, 0xff,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_141 = {
+ .pdu = provide_local_info_response_141,
+ .pdu_len = sizeof(provide_local_info_response_141),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x03, /* Date Time and Time Zone */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .datetime = {
+ .year = 2, /* 2002 - 1900 - 100 */
+ .month = 5,
+ .day = 7,
+ .hour = 14,
+ .minute = 8,
+ .second = 17,
+ .timezone = 0xff, /* No information */
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_151[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x04, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xad, 0x02, 0x65, 0x6e,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_151 = {
+ .pdu = provide_local_info_response_151,
+ .pdu_len = sizeof(provide_local_info_response_151),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x04, /* Language setting */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .language = "en", }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_161[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x05, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xae, 0x02, 0x00, 0x00,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_161 = {
+ .pdu = provide_local_info_response_161,
+ .pdu_len = sizeof(provide_local_info_response_161),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x05, /* Timing Advance */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .tadv = {
+ .status = STK_TIMING_ADVANCE_ME_IDLE,
+ .advance = 0,
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_171[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x06, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x3f, 0x01, 0x03,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_171 = {
+ .pdu = provide_local_info_response_171,
+ .pdu_len = sizeof(provide_local_info_response_171),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x06, /* Access technology */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .access_technology = STK_ACCESS_TECHNOLOGY_UTRAN, }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_181[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x07, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xc6, 0x04, 0x01, 0x02,
+ 0x03, 0x04,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_181 = {
+ .pdu = provide_local_info_response_181,
+ .pdu_len = sizeof(provide_local_info_response_181),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x07, /* ESN of the terminal */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .esn = 0x01020304, }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_191[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x08, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xe2, 0x09, 0x13, 0x32,
+ 0x54, 0x76, 0x98, 0x10, 0x32, 0x54, 0xf6,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_191 = {
+ .pdu = provide_local_info_response_191,
+ .pdu_len = sizeof(provide_local_info_response_191),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x08, /* IMEISV of the terminal */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .imeisv = "1234567890123456", }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1111[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x0a, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xe3, 0x01, 0x04,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1111 = {
+ .pdu = provide_local_info_response_1111,
+ .pdu_len = sizeof(provide_local_info_response_1111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x0a, /* Charge state of the battery */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .battery_charge = STK_BATTERY_FULL, }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1121[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x00,
+ /* Intra-frequency UTRAN Measurement report in ASN.1 goes here */
+ /* "The remaining bytes shall not be verified" */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1121 = {
+ .pdu = provide_local_info_response_1121,
+ .pdu_len = sizeof(provide_local_info_response_1121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x02, /* Network Measurement Results */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .nmr = {
+ .nmr = {
+ .array = (unsigned char[2])
+ { 0x80, 0x00 },
+ .len = 2,
+ },
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1131[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x11,
+ /* Inter-frequency UTRAN Measurement report in ASN.1 goes here */
+ /* "The remaining bytes shall not be verified" */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1131 = {
+ .pdu = provide_local_info_response_1131,
+ .pdu_len = sizeof(provide_local_info_response_1131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x02, /* Network Measurement Results */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .nmr = {
+ .nmr = {
+ .array = (unsigned char[2])
+ { 0x80, 0x11},
+ .len = 2,
+ },
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1141[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x06, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x3f, 0x01, 0x08,
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1141 = {
+ .pdu = provide_local_info_response_1141,
+ .pdu_len = sizeof(provide_local_info_response_1141),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x06, /* Access technology */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .access_technology = STK_ACCESS_TECHNOLOGY_EUTRAN, }
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1151[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x00,
+ /* Intra-frequency E-UTRAN Measurement report in ASN.1 goes here */
+ /* "The remaining bytes shall not be verified" */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1151 = {
+ .pdu = provide_local_info_response_1151,
+ .pdu_len = sizeof(provide_local_info_response_1151),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x02, /* Network Measurement Results */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .nmr = {
+ .nmr = {
+ .array = (unsigned char[2])
+ { 0x80, 0x00},
+ .len = 2,
+ },
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1161[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x11,
+ /* Inter-frequency E-UTRAN Measurement report in ASN.1 goes here */
+ /* "The remaining bytes shall not be verified" */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1161 = {
+ .pdu = provide_local_info_response_1161,
+ .pdu_len = sizeof(provide_local_info_response_1161),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x02, /* Network Measurement Results */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .nmr = {
+ .nmr = {
+ .array = (unsigned char[2])
+ { 0x80, 0x11},
+ .len = 2,
+ },
+ }},
+ }},
+ },
+};
+
+static const unsigned char provide_local_info_response_1171[] = {
+ 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x93, 0x09, 0x00, 0xf1,
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1f,
+ /* Typo in TS 102 223? Byte 18 changed to 01 here */
+};
+
+static const struct terminal_response_test
+ provide_local_info_response_data_1171 = {
+ .pdu = provide_local_info_response_1171,
+ .pdu_len = sizeof(provide_local_info_response_1171),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO,
+ .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .provide_local_info = {
+ { .location = {
+ .mcc = "001",
+ .mnc = "01",
+ .lac_tac = 0x0001,
+ .has_eutran_ci = TRUE,
+ .eutran_ci = 0x0000001,
+ }},
+ }},
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -17244,6 +17747,58 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Provide Local Info 1.11.1",
&provide_local_info_data_1111, test_provide_local_info);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.1.1A",
+ &provide_local_info_response_data_111a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.1.1B",
+ &provide_local_info_response_data_111b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.2.1",
+ &provide_local_info_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.3.1",
+ &provide_local_info_response_data_131,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.4.1",
+ &provide_local_info_response_data_141,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.5.1",
+ &provide_local_info_response_data_151,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.6.1",
+ &provide_local_info_response_data_161,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.7.1",
+ &provide_local_info_response_data_171,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.8.1",
+ &provide_local_info_response_data_181,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.9.1",
+ &provide_local_info_response_data_191,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.11.1",
+ &provide_local_info_response_data_1111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.12.1",
+ &provide_local_info_response_data_1121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.13.1",
+ &provide_local_info_response_data_1131,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.14.1",
+ &provide_local_info_response_data_1141,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.15.1",
+ &provide_local_info_response_data_1151,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.16.1",
+ &provide_local_info_response_data_1161,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Provide Local Info response 1.17.1",
+ &provide_local_info_response_data_1171,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Setup Event List 1.1.1",
&setup_event_list_data_111, test_setup_event_list);
g_test_add_data_func("/teststk/Setup Event List 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 07/20] stkutil: Add Set Up Event List response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (4 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 06/20] test-stkutil: Add Provide Local Info response tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 08/20] test-stkutil: Add a Set Up Event List response test Andrzej Zaborowski
` (13 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
---
src/stkutil.c | 2 ++
src/stkutil.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 422a786..819156d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3981,6 +3981,8 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
ok = build_local_info(&builder, response);
break;
+ case STK_COMMAND_TYPE_SETUP_EVENT_LIST:
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 013341c..caadf65 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1150,6 +1150,7 @@ struct stk_response {
struct stk_response_set_up_call set_up_call;
struct stk_response_generic polling_off;
struct stk_response_local_info provide_local_info;
+ struct stk_response_generic set_up_event_list;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 08/20] test-stkutil: Add a Set Up Event List response test
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (5 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 07/20] stkutil: Add Set Up Event List response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 09/20] stkutil: Add the Timer Management response builder Andrzej Zaborowski
` (12 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
---
unit/test-stkutil.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 45f47d1..8256f4e 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -16707,6 +16707,27 @@ static const struct terminal_response_test
},
};
+static const unsigned char set_up_event_list_response_111[] = {
+ 0x81, 0x03, 0x01, 0x05, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test
+ set_up_event_list_response_data_111 = {
+ .pdu = set_up_event_list_response_111,
+ .pdu_len = sizeof(set_up_event_list_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_EVENT_LIST,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -17812,6 +17833,10 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Setup Event List 1.4.1",
&setup_event_list_data_141, test_setup_event_list);
+ g_test_add_data_func("/teststk/Set Up Event List response 1.1.1",
+ &set_up_event_list_response_data_111,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Perform Card APDU 1.1.1",
&perform_card_apdu_data_111, test_perform_card_apdu);
g_test_add_data_func("/teststk/Perform Card APDU 1.1.2",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 09/20] stkutil: Add the Timer Management response builder
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (6 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 08/20] test-stkutil: Add a Set Up Event List response test Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 10/20] test-stkutil: Add Timer Management response tests Andrzej Zaborowski
` (11 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3385 bytes --]
---
src/stkutil.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/stkutil.h | 7 +++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 819156d..42bc488 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -947,6 +947,7 @@ static gboolean parse_dataobj_timer_value(struct comprehension_tlv_iter *iter,
tv->hour = sms_decode_semi_octet(data[0]);
tv->minute = sms_decode_semi_octet(data[1]);
tv->second = sms_decode_semi_octet(data[2]);
+ tv->has_value = TRUE;
return TRUE;
}
@@ -3520,6 +3521,36 @@ static gboolean build_dataobj_cc_requested_action(struct stk_tlv_builder *tlv,
stk_tlv_builder_close_container(tlv));
}
+/* Described in TS 102.223 Section 8.37 */
+static gboolean build_dataobj_timer_id(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const unsigned char *id = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_TIMER_ID;
+
+ return id[0] == 0 ||
+ (stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_append_byte(tlv, id[0]) &&
+ stk_tlv_builder_close_container(tlv));
+}
+
+/* Described in TS 102.223 Section 8.38 */
+static gboolean build_dataobj_timer_value(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ const struct stk_timer_value *value = data;
+ unsigned char tag = STK_DATA_OBJECT_TYPE_TIMER_VALUE;
+
+ return value->has_value == FALSE ||
+ (stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+#define TO_BCD(bin) ((((bin) / 10) & 0xf) | (((bin) % 10) << 4))
+ stk_tlv_builder_append_byte(tlv, TO_BCD(value->hour)) &&
+ stk_tlv_builder_append_byte(tlv, TO_BCD(value->minute)) &&
+ stk_tlv_builder_append_byte(tlv, TO_BCD(value->second)) &&
+#undef TO_BCD
+ stk_tlv_builder_close_container(tlv));
+}
+
/* Described in TS 102.223 Section 8.39 */
static gboolean build_dataobj_datetime_timezone(struct stk_tlv_builder *tlv,
const void *data, gboolean cr)
@@ -3983,6 +4014,16 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
break;
case STK_COMMAND_TYPE_SETUP_EVENT_LIST:
break;
+ case STK_COMMAND_TYPE_TIMER_MANAGEMENT:
+ ok = build_dataobj(&builder,
+ build_dataobj_timer_id,
+ DATAOBJ_FLAG_CR,
+ &response->timer_mgmt.id,
+ build_dataobj_timer_value,
+ DATAOBJ_FLAG_CR,
+ &response->timer_mgmt.value,
+ NULL);
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index caadf65..153da65 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -643,6 +643,7 @@ struct stk_r_apdu {
/* Defined in TS 102.223 Section 8.38 */
struct stk_timer_value {
+ ofono_bool_t has_value;
unsigned char hour;
unsigned char minute;
unsigned char second;
@@ -1129,6 +1130,11 @@ struct stk_response_local_info {
};
};
+struct stk_response_timer_mgmt {
+ unsigned char id;
+ struct stk_timer_value value;
+};
+
struct stk_response {
unsigned char number;
unsigned char type;
@@ -1151,6 +1157,7 @@ struct stk_response {
struct stk_response_generic polling_off;
struct stk_response_local_info provide_local_info;
struct stk_response_generic set_up_event_list;
+ struct stk_response_timer_mgmt timer_mgmt;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 10/20] test-stkutil: Add Timer Management response tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (7 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 09/20] stkutil: Add the Timer Management response builder Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 11/20] stkutil: Add Set Up Idle Mode Text response builder support Andrzej Zaborowski
` (10 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 27504 bytes --]
---
unit/test-stkutil.c | 862 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 862 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 8256f4e..092e343 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -16728,6 +16728,771 @@ static const struct terminal_response_test
},
};
+static const unsigned char timer_mgmt_response_111[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x01,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_111 = {
+ .pdu = timer_mgmt_response_111,
+ .pdu_len = sizeof(timer_mgmt_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 1,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_112[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x01, 0xa5,
+ 0x03, 0x00, 0x30, 0x95,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_112 = {
+ .pdu = timer_mgmt_response_112,
+ .pdu_len = sizeof(timer_mgmt_response_112),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 1,
+ .value = {
+ .minute = 3,
+ .second = 59,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_114[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x01, 0xa5,
+ 0x03, 0x00, 0x00, 0x95,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_114 = {
+ .pdu = timer_mgmt_response_114,
+ .pdu_len = sizeof(timer_mgmt_response_114),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 1,
+ .value = {
+ .second = 59,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_121[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x02,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_121 = {
+ .pdu = timer_mgmt_response_121,
+ .pdu_len = sizeof(timer_mgmt_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 2,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_122[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x02, 0xa5,
+ 0x03, 0x32, 0x85, 0x85,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_122 = {
+ .pdu = timer_mgmt_response_122,
+ .pdu_len = sizeof(timer_mgmt_response_122),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 2,
+ .value = {
+ .hour = 23,
+ .minute = 58,
+ .second = 58,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_124[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x02, 0xa5,
+ 0x03, 0x00, 0x00, 0x95,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_124 = {
+ .pdu = timer_mgmt_response_124,
+ .pdu_len = sizeof(timer_mgmt_response_124),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 2,
+ .value = {
+ .second = 59,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_131[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x08,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_131 = {
+ .pdu = timer_mgmt_response_131,
+ .pdu_len = sizeof(timer_mgmt_response_131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 8,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_132[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x08, 0xa5,
+ 0x03, 0x00, 0x81, 0x95,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_132 = {
+ .pdu = timer_mgmt_response_132,
+ .pdu_len = sizeof(timer_mgmt_response_132),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 8,
+ .value = {
+ .minute = 18,
+ .second = 59,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_134[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x08, 0xa5,
+ 0x03, 0x00, 0x95, 0x92,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_134 = {
+ .pdu = timer_mgmt_response_134,
+ .pdu_len = sizeof(timer_mgmt_response_134),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 8,
+ .value = {
+ .minute = 59,
+ .second = 29,
+ .has_value = TRUE,
+ },
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_141a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x01,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_141a = {
+ .pdu = timer_mgmt_response_141a,
+ .pdu_len = sizeof(timer_mgmt_response_141a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 1,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_141b[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_141b = {
+ .pdu = timer_mgmt_response_141b,
+ .pdu_len = sizeof(timer_mgmt_response_141b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ },
+};
+
+static const unsigned char timer_mgmt_response_142a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x02,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_142a = {
+ .pdu = timer_mgmt_response_142a,
+ .pdu_len = sizeof(timer_mgmt_response_142a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 2,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_143a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x03,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_143a = {
+ .pdu = timer_mgmt_response_143a,
+ .pdu_len = sizeof(timer_mgmt_response_143a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 3,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_144a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x04,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_144a = {
+ .pdu = timer_mgmt_response_144a,
+ .pdu_len = sizeof(timer_mgmt_response_144a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 4,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_145a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x05,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_145a = {
+ .pdu = timer_mgmt_response_145a,
+ .pdu_len = sizeof(timer_mgmt_response_145a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 5,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_146a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x06,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_146a = {
+ .pdu = timer_mgmt_response_146a,
+ .pdu_len = sizeof(timer_mgmt_response_146a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 6,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_147a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x07,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_147a = {
+ .pdu = timer_mgmt_response_147a,
+ .pdu_len = sizeof(timer_mgmt_response_147a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 7,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_148a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x08,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_148a = {
+ .pdu = timer_mgmt_response_148a,
+ .pdu_len = sizeof(timer_mgmt_response_148a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x02, /* Get the current value of the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 8,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_151a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x01,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_151a = {
+ .pdu = timer_mgmt_response_151a,
+ .pdu_len = sizeof(timer_mgmt_response_151a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 1,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_151b[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_151b = {
+ .pdu = timer_mgmt_response_151b,
+ .pdu_len = sizeof(timer_mgmt_response_151b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ },
+};
+
+static const unsigned char timer_mgmt_response_152a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x02,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_152a = {
+ .pdu = timer_mgmt_response_152a,
+ .pdu_len = sizeof(timer_mgmt_response_152a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 2,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_153a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x03,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_153a = {
+ .pdu = timer_mgmt_response_153a,
+ .pdu_len = sizeof(timer_mgmt_response_153a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 3,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_154a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x04,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_154a = {
+ .pdu = timer_mgmt_response_154a,
+ .pdu_len = sizeof(timer_mgmt_response_154a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 4,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_155a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x05,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_155a = {
+ .pdu = timer_mgmt_response_155a,
+ .pdu_len = sizeof(timer_mgmt_response_155a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 5,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_156a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x06,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_156a = {
+ .pdu = timer_mgmt_response_156a,
+ .pdu_len = sizeof(timer_mgmt_response_156a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 6,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_157a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x07,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_157a = {
+ .pdu = timer_mgmt_response_157a,
+ .pdu_len = sizeof(timer_mgmt_response_157a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 7,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_158a[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x24, 0xa4, 0x01, 0x08,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_158a = {
+ .pdu = timer_mgmt_response_158a,
+ .pdu_len = sizeof(timer_mgmt_response_158a),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x01, /* Deactivate the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TIMER_CONFLICT,
+ },
+ { .timer_mgmt = {
+ .id = 8,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_163[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x03,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_163 = {
+ .pdu = timer_mgmt_response_163,
+ .pdu_len = sizeof(timer_mgmt_response_163),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 3,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_164[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x04,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_164 = {
+ .pdu = timer_mgmt_response_164,
+ .pdu_len = sizeof(timer_mgmt_response_164),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 4,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_165[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x05,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_165 = {
+ .pdu = timer_mgmt_response_165,
+ .pdu_len = sizeof(timer_mgmt_response_165),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 5,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_166[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x06,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_166 = {
+ .pdu = timer_mgmt_response_166,
+ .pdu_len = sizeof(timer_mgmt_response_166),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 6,
+ }},
+ },
+};
+
+static const unsigned char timer_mgmt_response_167[] = {
+ 0x81, 0x03, 0x01, 0x27, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xa4, 0x01, 0x07,
+};
+
+static const struct terminal_response_test timer_mgmt_response_data_167 = {
+ .pdu = timer_mgmt_response_167,
+ .pdu_len = sizeof(timer_mgmt_response_167),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_TIMER_MANAGEMENT,
+ .qualifier = 0x00, /* Start the Timer */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .timer_mgmt = {
+ .id = 7,
+ }},
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -17936,6 +18701,103 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Timer Management 2.2.1",
&timer_mgmt_data_221, test_timer_mgmt);
+ g_test_add_data_func("/teststk/Timer Management response 1.1.1",
+ &timer_mgmt_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.1.2",
+ &timer_mgmt_response_data_112,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.1.4",
+ &timer_mgmt_response_data_114,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.2.1",
+ &timer_mgmt_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.2.2",
+ &timer_mgmt_response_data_122,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.2.4",
+ &timer_mgmt_response_data_124,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.3.1",
+ &timer_mgmt_response_data_131,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.3.2",
+ &timer_mgmt_response_data_132,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.3.4",
+ &timer_mgmt_response_data_134,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.1A",
+ &timer_mgmt_response_data_141a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.1B",
+ &timer_mgmt_response_data_141b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.2A",
+ &timer_mgmt_response_data_142a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.3A",
+ &timer_mgmt_response_data_143a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.4A",
+ &timer_mgmt_response_data_144a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.5A",
+ &timer_mgmt_response_data_145a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.6A",
+ &timer_mgmt_response_data_146a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.7A",
+ &timer_mgmt_response_data_147a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.4.8A",
+ &timer_mgmt_response_data_148a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.1A",
+ &timer_mgmt_response_data_151a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.1B",
+ &timer_mgmt_response_data_151b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.2A",
+ &timer_mgmt_response_data_152a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.3A",
+ &timer_mgmt_response_data_153a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.4A",
+ &timer_mgmt_response_data_154a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.5A",
+ &timer_mgmt_response_data_155a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.6A",
+ &timer_mgmt_response_data_156a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.7A",
+ &timer_mgmt_response_data_157a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.5.8A",
+ &timer_mgmt_response_data_158a,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.6.3",
+ &timer_mgmt_response_data_163,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.6.4",
+ &timer_mgmt_response_data_164,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.6.5",
+ &timer_mgmt_response_data_165,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.6.6",
+ &timer_mgmt_response_data_166,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Timer Management response 1.6.7",
+ &timer_mgmt_response_data_167,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Setup Idle Mode Text 1.1.1",
&setup_idle_mode_text_data_111, test_setup_idle_mode_text);
g_test_add_data_func("/teststk/Setup Idle Mode Text 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 11/20] stkutil: Add Set Up Idle Mode Text response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (8 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 10/20] test-stkutil: Add Timer Management response tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 12/20] test-stkutil: Add Set Up Idle Mode response builder tests Andrzej Zaborowski
` (9 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 935 bytes --]
---
src/stkutil.c | 2 ++
src/stkutil.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 42bc488..35db34c 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -4024,6 +4024,8 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
&response->timer_mgmt.value,
NULL);
break;
+ case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT:
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 153da65..8c1b0db 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1158,6 +1158,7 @@ struct stk_response {
struct stk_response_local_info provide_local_info;
struct stk_response_generic set_up_event_list;
struct stk_response_timer_mgmt timer_mgmt;
+ struct stk_response_generic set_up_idle_mode_text;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 12/20] test-stkutil: Add Set Up Idle Mode response builder tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (9 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 11/20] stkutil: Add Set Up Idle Mode Text response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 13/20] stkutil: Add the Run AT Command response builder Andrzej Zaborowski
` (8 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3226 bytes --]
---
unit/test-stkutil.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 092e343..2dfb0c5 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -17493,6 +17493,69 @@ static const struct terminal_response_test timer_mgmt_response_data_167 = {
},
};
+static const unsigned char set_up_idle_mode_text_response_111[] = {
+ 0x81, 0x03, 0x01, 0x28, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test
+ set_up_idle_mode_text_response_data_111 = {
+ .pdu = set_up_idle_mode_text_response_111,
+ .pdu_len = sizeof(set_up_idle_mode_text_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char set_up_idle_mode_text_response_211b[] = {
+ 0x81, 0x03, 0x01, 0x28, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04,
+};
+
+static const struct terminal_response_test
+ set_up_idle_mode_text_response_data_211b = {
+ .pdu = set_up_idle_mode_text_response_211b,
+ .pdu_len = sizeof(set_up_idle_mode_text_response_211b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ },
+ },
+};
+
+static const unsigned char set_up_idle_mode_text_response_241[] = {
+ 0x81, 0x03, 0x01, 0x28, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x32,
+};
+
+static const struct terminal_response_test
+ set_up_idle_mode_text_response_data_241 = {
+ .pdu = set_up_idle_mode_text_response_241,
+ .pdu_len = sizeof(set_up_idle_mode_text_response_241),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -18873,6 +18936,16 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Setup Idle Mode Text 6.1.1",
&setup_idle_mode_text_data_611, test_setup_idle_mode_text);
+ g_test_add_data_func("/teststk/Set Up Idle Mode Text response 1.1.1",
+ &set_up_idle_mode_text_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Idle Mode Text response 2.1.1B",
+ &set_up_idle_mode_text_response_data_211b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Set Up Idle Mode Text response 2.4.1",
+ &set_up_idle_mode_text_response_data_241,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Run At Command 1.1.1",
&run_at_command_data_111, test_run_at_command);
g_test_add_data_func("/teststk/Run At Command 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 13/20] stkutil: Add the Run AT Command response builder
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (10 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 12/20] test-stkutil: Add Set Up Idle Mode response builder tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 14/20] test-stkutil: Add Run AT Command response builder tests Andrzej Zaborowski
` (7 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]
---
src/stkutil.c | 29 +++++++++++++++++++++++++++++
src/stkutil.h | 5 +++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 35db34c..5a53fc6 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3580,6 +3580,28 @@ static gboolean build_dataobj_datetime_timezone(struct stk_tlv_builder *tlv,
stk_tlv_builder_close_container(tlv);
}
+/* Described in TS 102.223 Section 8.41 */
+static gboolean build_dataobj_at_response(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ unsigned char tag = STK_DATA_OBJECT_TYPE_AT_RESPONSE;
+ int len;
+
+ if (data == NULL)
+ return TRUE;
+
+ /* "If the AT Response string is longer than the maximum length
+ * capable of being transmitted to the UICC then the AT Response
+ * string shall be truncated to this length by the terminal." */
+ len = strlen(data);
+ if (len > 240) /* Safe pick */
+ len = 240;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, TRUE) &&
+ stk_tlv_builder_append_bytes(tlv, data, len) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
/* Described in TS 102.223 Section 8.45 */
static gboolean build_dataobj_language(struct stk_tlv_builder *tlv,
const void *data, gboolean cr)
@@ -4026,6 +4048,13 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
break;
case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT:
break;
+ case STK_COMMAND_TYPE_RUN_AT_COMMAND:
+ ok = build_dataobj(&builder,
+ build_dataobj_at_response,
+ DATAOBJ_FLAG_CR,
+ response->run_at_command.at_response,
+ NULL);
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 8c1b0db..ac462e0 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1135,6 +1135,10 @@ struct stk_response_timer_mgmt {
struct stk_timer_value value;
};
+struct stk_response_run_at_command {
+ const char *at_response;
+};
+
struct stk_response {
unsigned char number;
unsigned char type;
@@ -1159,6 +1163,7 @@ struct stk_response {
struct stk_response_generic set_up_event_list;
struct stk_response_timer_mgmt timer_mgmt;
struct stk_response_generic set_up_idle_mode_text;
+ struct stk_response_run_at_command run_at_command;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 14/20] test-stkutil: Add Run AT Command response builder tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (11 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 13/20] stkutil: Add the Run AT Command response builder Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 15/20] stkutil: Add Send DTMF response builder support Andrzej Zaborowski
` (6 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3216 bytes --]
---
unit/test-stkutil.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 2dfb0c5..c25c0b2 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -17556,6 +17556,74 @@ static const struct terminal_response_test
},
};
+static const unsigned char run_at_command_response_111[] = {
+ 0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0xA9, 0x05, 0x2b, 0x43,
+ 0x47, 0x4d, 0x49,
+};
+
+static const struct terminal_response_test run_at_command_response_data_111 = {
+ .pdu = run_at_command_response_111,
+ .pdu_len = sizeof(run_at_command_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .run_at_command = {
+ .at_response = "+CGMI",
+ }},
+ },
+};
+
+static const unsigned char run_at_command_response_211b[] = {
+ 0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04, 0xA9, 0x05, 0x2b, 0x43,
+ 0x47, 0x4d, 0x49,
+};
+
+static const struct terminal_response_test run_at_command_response_data_211b = {
+ .pdu = run_at_command_response_211b,
+ .pdu_len = sizeof(run_at_command_response_211b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ },
+ { .run_at_command = {
+ .at_response = "+CGMI",
+ }},
+ },
+};
+
+static const unsigned char run_at_command_response_251[] = {
+ 0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x32,
+};
+
+static const struct terminal_response_test run_at_command_response_data_251 = {
+ .pdu = run_at_command_response_251,
+ .pdu_len = sizeof(run_at_command_response_251),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -19021,6 +19089,16 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Run At Command 6.1.1",
&run_at_command_data_611, test_run_at_command);
+ g_test_add_data_func("/teststk/Run AT Command response 1.1.1",
+ &run_at_command_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Run AT Command response 2.1.1B",
+ &run_at_command_response_data_211b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Run AT Command response 2.5.1",
+ &run_at_command_response_data_251,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Send DTMF 1.1.1",
&send_dtmf_data_111, test_send_dtmf);
g_test_add_data_func("/teststk/Send DTMF 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 15/20] stkutil: Add Send DTMF response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (12 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 14/20] test-stkutil: Add Run AT Command response builder tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 16/20] test-stkutil: Add the Send DTMF response tests Andrzej Zaborowski
` (5 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 925 bytes --]
---
src/stkutil.c | 2 ++
src/stkutil.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 5a53fc6..f27a777 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -4055,6 +4055,8 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
response->run_at_command.at_response,
NULL);
break;
+ case STK_COMMAND_TYPE_SEND_DTMF:
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index ac462e0..4a7a82d 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1164,6 +1164,7 @@ struct stk_response {
struct stk_response_timer_mgmt timer_mgmt;
struct stk_response_generic set_up_idle_mode_text;
struct stk_response_run_at_command run_at_command;
+ struct stk_response_generic send_dtmf;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 16/20] test-stkutil: Add the Send DTMF response tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (13 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 15/20] stkutil: Add Send DTMF response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 17/20] stkutil: Add Language Notification response builder support Andrzej Zaborowski
` (4 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3063 bytes --]
---
unit/test-stkutil.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index c25c0b2..b411df3 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -17624,6 +17624,68 @@ static const struct terminal_response_test run_at_command_response_data_251 = {
},
};
+static const unsigned char send_dtmf_response_111[] = {
+ 0x81, 0x03, 0x01, 0x14, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test send_dtmf_response_data_111 = {
+ .pdu = send_dtmf_response_111,
+ .pdu_len = sizeof(send_dtmf_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DTMF,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char send_dtmf_response_141[] = {
+ 0x81, 0x03, 0x01, 0x14, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x20, 0x07,
+};
+
+static const struct terminal_response_test send_dtmf_response_data_141 = {
+ .pdu = send_dtmf_response_141,
+ .pdu_len = sizeof(send_dtmf_response_141),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DTMF,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_TERMINAL_BUSY,
+ .additional_len = 1, /* Not in speech call */
+ .additional = (unsigned char[1]) { 0x07 },
+ },
+ },
+};
+
+static const unsigned char send_dtmf_response_211b[] = {
+ 0x81, 0x03, 0x01, 0x14, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04,
+};
+
+static const struct terminal_response_test send_dtmf_response_data_211b = {
+ .pdu = send_dtmf_response_211b,
+ .pdu_len = sizeof(send_dtmf_response_211b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DTMF,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -19170,6 +19232,16 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Send DTMF 6.1.1",
&send_dtmf_data_611, test_send_dtmf);
+ g_test_add_data_func("/teststk/Send DTMF response 1.1.1",
+ &send_dtmf_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Send DTMF response 1.4.1",
+ &send_dtmf_response_data_141,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Send DTMF response 2.1.1B",
+ &send_dtmf_response_data_211b,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Language Notification 1.1.1",
&language_notification_data_111, test_language_notification);
g_test_add_data_func("/teststk/Language Notification 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 17/20] stkutil: Add Language Notification response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (14 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 16/20] test-stkutil: Add the Send DTMF response tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 18/20] test-stkutil: Add Language Notification response tests Andrzej Zaborowski
` (3 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
---
src/stkutil.c | 1 +
src/stkutil.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index f27a777..affbcae 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -4056,6 +4056,7 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
NULL);
break;
case STK_COMMAND_TYPE_SEND_DTMF:
+ case STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION:
break;
default:
return 0;
diff --git a/src/stkutil.h b/src/stkutil.h
index 4a7a82d..cd9ef46 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1165,6 +1165,7 @@ struct stk_response {
struct stk_response_generic set_up_idle_mode_text;
struct stk_response_run_at_command run_at_command;
struct stk_response_generic send_dtmf;
+ struct stk_response_generic language_notification;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 18/20] test-stkutil: Add Language Notification response tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (15 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 17/20] stkutil: Add Language Notification response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 19/20] stkutil: Add Launch Browser response builder support Andrzej Zaborowski
` (2 subsequent siblings)
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]
---
unit/test-stkutil.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index b411df3..3eab970 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -17686,6 +17686,48 @@ static const struct terminal_response_test send_dtmf_response_data_211b = {
},
};
+static const unsigned char language_notification_response_111[] = {
+ 0x81, 0x03, 0x01, 0x35, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test
+ language_notification_response_data_111 = {
+ .pdu = language_notification_response_111,
+ .pdu_len = sizeof(language_notification_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION,
+ .qualifier = 0x01,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char language_notification_response_121[] = {
+ 0x81, 0x03, 0x01, 0x35, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test
+ language_notification_response_data_121 = {
+ .pdu = language_notification_response_121,
+ .pdu_len = sizeof(language_notification_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -19247,6 +19289,13 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Language Notification 1.2.1",
&language_notification_data_121, test_language_notification);
+ g_test_add_data_func("/teststk/Language Notification response 1.1.1",
+ &language_notification_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Language Notification response 1.2.1",
+ &language_notification_response_data_121,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Launch Browser 1.1.1",
&launch_browser_data_111, test_launch_browser);
g_test_add_data_func("/teststk/Launch Browser 1.2.1",
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 19/20] stkutil: Add Launch Browser response builder support
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (16 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 18/20] test-stkutil: Add Language Notification response tests Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-27 4:59 ` [PATCH 20/20] test-stkutil: Add Launch Browser response builder tests Andrzej Zaborowski
2010-05-28 16:42 ` [PATCH 01/20] stkutil: Add Set Up Call response builder Denis Kenzior
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
---
src/stkutil.c | 1 +
src/stkutil.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index affbcae..b6dab66 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -4057,6 +4057,7 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
break;
case STK_COMMAND_TYPE_SEND_DTMF:
case STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION:
+ case STK_COMMAND_TYPE_LAUNCH_BROWSER:
break;
default:
return 0;
diff --git a/src/stkutil.h b/src/stkutil.h
index cd9ef46..cc5801c 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1166,6 +1166,7 @@ struct stk_response {
struct stk_response_run_at_command run_at_command;
struct stk_response_generic send_dtmf;
struct stk_response_generic language_notification;
+ struct stk_response_generic launch_browser;
};
void (*destructor)(struct stk_response *response);
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 20/20] test-stkutil: Add Launch Browser response builder tests
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (17 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 19/20] stkutil: Add Launch Browser response builder support Andrzej Zaborowski
@ 2010-05-27 4:59 ` Andrzej Zaborowski
2010-05-28 16:42 ` [PATCH 01/20] stkutil: Add Set Up Call response builder Denis Kenzior
19 siblings, 0 replies; 21+ messages in thread
From: Andrzej Zaborowski @ 2010-05-27 4:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4621 bytes --]
---
unit/test-stkutil.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 118 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 3eab970..0a47187 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -17728,6 +17728,108 @@ static const struct terminal_response_test
},
};
+static const unsigned char launch_browser_response_111[] = {
+ 0x81, 0x03, 0x01, 0x15, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test launch_browser_response_data_111 = {
+ .pdu = launch_browser_response_111,
+ .pdu_len = sizeof(launch_browser_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LAUNCH_BROWSER,
+ .qualifier = 0x00, /* Launch browser, if not running */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char launch_browser_response_211[] = {
+ 0x81, 0x03, 0x01, 0x15, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test launch_browser_response_data_211 = {
+ .pdu = launch_browser_response_211,
+ .pdu_len = sizeof(launch_browser_response_211),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LAUNCH_BROWSER,
+ .qualifier = 0x02, /* Use the existing browser */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char launch_browser_response_221[] = {
+ 0x81, 0x03, 0x01, 0x15, 0x03, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00,
+};
+
+static const struct terminal_response_test launch_browser_response_data_221 = {
+ .pdu = launch_browser_response_221,
+ .pdu_len = sizeof(launch_browser_response_221),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LAUNCH_BROWSER,
+ .qualifier = 0x03, /* Re-start browser session */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ },
+};
+
+static const unsigned char launch_browser_response_231[] = {
+ 0x81, 0x03, 0x01, 0x15, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x02, 0x26, 0x02,
+};
+
+static const struct terminal_response_test launch_browser_response_data_231 = {
+ .pdu = launch_browser_response_231,
+ .pdu_len = sizeof(launch_browser_response_231),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LAUNCH_BROWSER,
+ .qualifier = 0x00, /* Launch browser, if not running */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_BROWSER_TEMPORARY,
+ .additional_len = 1, /* Browser unavailable */
+ .additional = (unsigned char[1]) { 0x02 },
+ },
+ },
+};
+
+static const unsigned char launch_browser_response_411b[] = {
+ 0x81, 0x03, 0x01, 0x15, 0x02, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04,
+};
+
+static const struct terminal_response_test launch_browser_response_data_411b = {
+ .pdu = launch_browser_response_411b,
+ .pdu_len = sizeof(launch_browser_response_411b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_LAUNCH_BROWSER,
+ .qualifier = 0x02, /* Use the existing browser */
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ },
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -19373,5 +19475,21 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Launch Browser 7.1.1",
&launch_browser_data_711, test_launch_browser);
+ g_test_add_data_func("/teststk/Launch Browser response 1.1.1",
+ &launch_browser_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Launch Browser response 2.1.1",
+ &launch_browser_response_data_211,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Launch Browser response 2.2.1",
+ &launch_browser_response_data_221,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Launch Browser response 2.3.1",
+ &launch_browser_response_data_231,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Launch Browser response 4.1.1B",
+ &launch_browser_response_data_411b,
+ test_terminal_response_encoding);
+
return g_test_run();
}
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 01/20] stkutil: Add Set Up Call response builder
2010-05-27 4:59 [PATCH 01/20] stkutil: Add Set Up Call response builder Andrzej Zaborowski
` (18 preceding siblings ...)
2010-05-27 4:59 ` [PATCH 20/20] test-stkutil: Add Launch Browser response builder tests Andrzej Zaborowski
@ 2010-05-28 16:42 ` Denis Kenzior
19 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2010-05-28 16:42 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
Hi Andrew,
> ---
> src/stkutil.c | 37 +++++++++++++++++++++++++++++++++++++
> src/stkutil.h | 9 +++++++++
> 2 files changed, 46 insertions(+), 0 deletions(-)
All 20 patches in this series have now been pushed with some style fixes in
between.
Thanks,
-Denis
^ permalink raw reply [flat|nested] 21+ messages in thread