From 058d3d0cd4030960d5633fdd7348770ff5b02630 Mon Sep 17 00:00:00 2001 From: Yang Gu Date: Fri, 9 Jul 2010 22:52:08 +0800 Subject: [PATCH] Interpret "" Alpha Id as empty data object There needs to be a way to distinguish between no alphaid and "empty data object" because on some occasions they have different meanings. In the Call Control envelope, no Alpha Identifier means the terminal can inform the user about the call being modified by SIM while empty data object means no hint should be given. --- src/stkutil.c | 4 +++- unit/test-stkutil.c | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/stkutil.c b/src/stkutil.c index 94ff182f..c45f9854 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -297,8 +297,10 @@ static gboolean parse_dataobj_alpha_id(struct comprehension_tlv_iter *iter, char *utf8; len = comprehension_tlv_iter_get_length(iter); - if (len == 0) + if (len == 0) { + *alpha_id = g_try_malloc0(1); return TRUE; + } data = comprehension_tlv_iter_get_data(iter); utf8 = sim_string_to_utf8(data, len); diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c index 0b952653..dbd5b5e5 100644 --- a/unit/test-stkutil.c +++ b/unit/test-stkutil.c @@ -4974,7 +4974,8 @@ static struct setup_menu_test setup_menu_data_112 = { static struct setup_menu_test setup_menu_data_113 = { .pdu = setup_menu_113, .pdu_len = sizeof(setup_menu_113), - .qualifier = 0x00 + .qualifier = 0x00, + .alpha_id = "" }; static struct setup_menu_test setup_menu_data_121 = { @@ -5442,7 +5443,8 @@ static struct setup_menu_test setup_menu_data_712 = { static struct setup_menu_test setup_menu_data_713 = { .pdu = setup_menu_713, .pdu_len = sizeof(setup_menu_713), - .qualifier = 0x00 + .qualifier = 0x00, + .alpha_id = "" }; static struct setup_menu_test setup_menu_data_811 = { @@ -5472,7 +5474,8 @@ static struct setup_menu_test setup_menu_data_812 = { static struct setup_menu_test setup_menu_data_813 = { .pdu = setup_menu_813, .pdu_len = sizeof(setup_menu_813), - .qualifier = 0x00 + .qualifier = 0x00, + .alpha_id = "" }; static struct setup_menu_test setup_menu_data_911 = { @@ -5502,7 +5505,8 @@ static struct setup_menu_test setup_menu_data_912 = { static struct setup_menu_test setup_menu_data_913 = { .pdu = setup_menu_913, .pdu_len = sizeof(setup_menu_913), - .qualifier = 0x00 + .qualifier = 0x00, + .alpha_id = "" }; static struct setup_menu_test setup_menu_data_neg_1 = { @@ -7957,6 +7961,7 @@ static struct send_sms_test send_sms_data_171 = { .pdu = send_sms_171, .pdu_len = sizeof(send_sms_171), .qualifier = 0x00, + .alpha_id = "", .gsm_sms = { { .number_type = SMS_NUMBER_TYPE_INTERNATIONAL, @@ -9474,6 +9479,7 @@ static struct send_ss_test send_ss_data_161 = { .pdu = send_ss_161, .pdu_len = sizeof(send_ss_161), .qualifier = 0x00, + .alpha_id = "", .ss = { .ton_npi = 0x91, .ss = "**21*01234567890123456789*10#" @@ -10774,6 +10780,7 @@ static struct send_ussd_test send_ussd_data_181 = { .pdu = send_ussd_181, .pdu_len = sizeof(send_ussd_181), .qualifier = 0x00, + .alpha_id = "", .ussd = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-" "1234567890" }; @@ -14621,6 +14628,7 @@ static struct run_at_command_test run_at_command_data_121 = { .pdu = run_at_command_121, .pdu_len = sizeof(run_at_command_121), .qualifier = 0x00, + .alpha_id = "", .at_command = "AT+CGMI" }; @@ -15319,6 +15327,7 @@ static struct send_dtmf_test send_dtmf_data_131 = { .pdu = send_dtmf_131, .pdu_len = sizeof(send_dtmf_131), .qualifier = 0x00, + .alpha_id = "", .dtmf = "1cccccccccc2" }; @@ -16039,6 +16048,7 @@ static struct launch_browser_test launch_browser_data_121 = { .pdu = launch_browser_121, .pdu_len = sizeof(launch_browser_121), .qualifier = 0x00, + .alpha_id = "", .url = "http://xxx.yyy.zzz" };