isimodem: remove atoms that fail to probe
by Mika Liljeberg
Hi,
Here's a patch to immediately free any atoms that failed
to probe.
Br,
MikaL
[PATCH 1/1] isimodem: remove atoms that fail to probe
drivers/isimodem/audio-settings.c | 4 +++-
drivers/isimodem/call-barring.c | 4 +++-
drivers/isimodem/call-forwarding.c | 4 +++-
drivers/isimodem/call-settings.c | 4 +++-
drivers/isimodem/cbs.c | 5 ++++-
drivers/isimodem/devinfo.c | 4 +++-
drivers/isimodem/gprs-context.c | 6 ++++--
drivers/isimodem/gprs.c | 1 +
drivers/isimodem/network-registration.c | 7 +++----
drivers/isimodem/phonebook.c | 4 +++-
drivers/isimodem/radio-settings.c | 4 +++-
drivers/isimodem/sim.c | 1 +
drivers/isimodem/sms.c | 5 ++++-
drivers/isimodem/ussd.c | 4 +++-
drivers/isimodem/voicecall.c | 4 +++-
15 files changed, 44 insertions(+), 17 deletions(-)
11 years, 1 month
[PATCH 05/18] gatppp: add g_at_ppp_set_suspend_function() definition
by Guillaume Zajac
---
gatchat/gatppp.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 993b5ea..9df6b8e 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -467,6 +467,14 @@ void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data)
ppp->debug_data = user_data;
}
+void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func, gpointer user_data)
+{
+ if (ppp == NULL)
+ return;
+
+ g_at_hdlc_set_suspend_function(ppp->hdlc, func, user_data);
+}
+
void g_at_ppp_shutdown(GAtPPP *ppp)
{
if (ppp->phase == PPP_PHASE_DEAD || ppp->phase == PPP_PHASE_TERMINATION)
--
1.7.1
11 years, 1 month
[PATCH] stkutil: Add typo/cleaning modifications
by Philippe Nunes
---
src/stkutil.c | 4 ++--
src/stkutil.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index c64cb7a..3418b4b 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -5493,7 +5493,7 @@ const unsigned char *stk_pdu_from_response(const struct stk_response *response,
* Min = N.
*
* However comprehension required is set for many of the TLVs in
- * TS 102 384 conformace tests so we set it per command and per
+ * TS 102 384 conformance tests so we set it per command and per
* data object type.
*/
tag = STK_DATA_OBJECT_TYPE_DEVICE_IDENTITIES;
@@ -6269,7 +6269,7 @@ char *stk_image_to_xpm(const unsigned char *img, unsigned int len,
/*
* space needed:
- * header line
+ * header line
* declaration and beginning of assignment line
* values - max length of 19
* colors - ncolors * (cpp + whitespace + deliminators + color)
diff --git a/src/stkutil.h b/src/stkutil.h
index f2df23f..1b38dec 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -245,7 +245,7 @@ enum stk_result_type {
STK_RESULT_TYPE_USER_REJECT = 0x22,
STK_RESULT_TYPE_USER_CANCEL = 0x23,
STK_RESULT_TYPE_TIMER_CONFLICT = 0x24,
- STK_RESULT_TYPE_CALL_CONTROL_TEMPORARY = 0x25,
+ STK_RESULT_TYPE_CALL_CONTROL_TEMPORARY = 0x25,
STK_RESULT_TYPE_BROWSER_TEMPORARY = 0x26,
STK_RESULT_TYPE_MMS_TEMPORARY = 0x27,
--
1.7.1
11 years, 1 month
[PATCH v2 2/2] test-stkutil: Add unit tests for BIP commands
by Philippe Nunes
---
unit/test-stkutil.c | 1170 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 1153 insertions(+), 17 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index aa62aac..1706f1d 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -470,6 +470,59 @@ static void check_provisioning_file_references(GSList *command,
g_assert(test[i].len == 0);
}
+/* Defined in TS 102.223 Section 8.52 */
+static void check_bearer_desc(const struct stk_bearer_description *command,
+ const struct stk_bearer_description *test)
+{
+ g_assert(command->type == test->type);
+
+ if (test->type == STK_BEARER_TYPE_GPRS_UTRAN) {
+
+ check_common_byte(command->gprs.precedence,
+ test->gprs.precedence);
+ check_common_byte(command->gprs.delay,
+ test->gprs.delay);
+ check_common_byte(command->gprs.reliability,
+ test->gprs.reliability);
+ check_common_byte(command->gprs.peak,
+ test->gprs.peak);
+ check_common_byte(command->gprs.mean,
+ test->gprs.mean);
+ check_common_byte(command->gprs.pdp_type,
+ test->gprs.pdp_type);
+ return;
+ }
+}
+
+/* Defined in TS 102.223 Section 8.53 */
+static inline void check_channel_data(
+ const struct stk_common_byte_array *command,
+ const struct stk_common_byte_array *test)
+{
+ check_common_byte_array(command, test);
+}
+
+/* Defined in TS 102.223 Section 8.58 */
+static inline void check_other_address(
+ const struct stk_other_address *command,
+ const struct stk_other_address *test)
+{
+ check_common_byte(command->type, test->type);
+
+ if (test->type == STK_ADDRESS_IPV4)
+ g_assert(command->addr.ipv4 == test->addr.ipv4);
+ else
+ g_assert(g_mem_equal(command->addr.ipv6, test->addr.ipv6, 16));
+}
+
+/* Defined in TS 102.223 Section 8.59 */
+static void check_uicc_te_interface(const struct stk_uicc_te_interface *command,
+ const struct stk_uicc_te_interface *test)
+{
+ check_common_byte(command->protocol, test->protocol);
+ g_assert(command->port == test->port);
+}
+
/* Defined in TS 102.223 Section 8.60 */
static inline void check_aid(const struct stk_aid *command,
const struct stk_aid *test)
@@ -477,6 +530,13 @@ static inline void check_aid(const struct stk_aid *command,
g_assert(g_mem_equal(command->aid, test->aid, test->len));
}
+/* Defined in TS 102.223 Section 8.70 */
+static inline void check_network_access_name(const char *command,
+ const char *test)
+{
+ check_common_text(command, test);
+}
+
/* Defined in TS 102.223 Section 8.71 */
static inline void check_cdma_sms_tpdu(
const struct stk_common_byte_array *command,
@@ -16913,6 +16973,639 @@ static void test_launch_browser(gconstpointer data)
stk_command_free(command);
}
+struct open_channel_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+ char *alpha_id;
+ struct stk_icon_id icon_id;
+ struct stk_bearer_description bearer_desc;
+ unsigned short buf_size;
+ char *apn;
+ struct stk_other_address local_addr;
+ char *text_usr;
+ char *text_passwd;
+ struct stk_uicc_te_interface uti;
+ struct stk_other_address data_dest_addr;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
+static unsigned char open_channel_211[] = { 0xD0, 0x36, 0x81, 0x03, 0x01, 0x40,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x35, 0x07, 0x02, 0x03, 0x04,
+ 0x03, 0x04, 0x1F, 0x02, 0x39,
+ 0x02, 0x05, 0x78, 0x0D, 0x08,
+ 0xF4, 0x55, 0x73, 0x65, 0x72,
+ 0x4C, 0x6F, 0x67, 0x0D, 0x08,
+ 0xF4, 0x55, 0x73, 0x65, 0x72,
+ 0x50, 0x77, 0x64, 0x3C, 0x03,
+ 0x01, 0xAD, 0x9C, 0x3E, 0x05,
+ 0x21, 0x01, 0x01, 0x01, 0x01 };
+
+static unsigned char open_channel_221[] = { 0xD0, 0x42, 0x81, 0x03, 0x01, 0x40,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x35, 0x07, 0x02, 0x03, 0x04,
+ 0x03, 0x04, 0x1F, 0x02, 0x39,
+ 0x02, 0x05, 0x78, 0x47, 0x0A,
+ 0x06, 0x54, 0x65, 0x73, 0x74,
+ 0x47, 0x70, 0x02, 0x72, 0x73,
+ 0x0D, 0x08, 0xF4, 0x55, 0x73,
+ 0x65, 0x72, 0x4C, 0x6F, 0x67,
+ 0x0D, 0x08, 0xF4, 0x55, 0x73,
+ 0x65, 0x72, 0x50, 0x77, 0x64,
+ 0x3C, 0x03, 0x01, 0xAD, 0x9C,
+ 0x3E, 0x05, 0x21, 0x01, 0x01,
+ 0x01, 0x01 };
+
+static unsigned char open_channel_231[] = { 0xD0, 0x4B, 0x81, 0x03, 0x01, 0x40,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x05, 0x07, 0x4F, 0x70, 0x65,
+ 0x6E, 0x20, 0x49, 0x44, 0x35,
+ 0x07, 0x02, 0x03, 0x04, 0x03,
+ 0x04, 0x1F, 0x02, 0x39, 0x02,
+ 0x05, 0x78, 0x47, 0x0A, 0x06,
+ 0x54, 0x65, 0x73, 0x74, 0x47,
+ 0x70, 0x02, 0x72, 0x73, 0x0D,
+ 0x08, 0xF4, 0x55, 0x73, 0x65,
+ 0x72, 0x4C, 0x6F, 0x67, 0x0D,
+ 0x08, 0xF4, 0x55, 0x73, 0x65,
+ 0x72, 0x50, 0x77, 0x64, 0x3C,
+ 0x03, 0x01, 0xAD, 0x9C, 0x3E,
+ 0x05, 0x21, 0x01, 0x01, 0x01,
+ 0x01 };
+
+static unsigned char open_channel_241[] = { 0xD0, 0x44, 0x81, 0x03, 0x01, 0x40,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x05, 0x00, 0x35, 0x07, 0x02,
+ 0x03, 0x04, 0x03, 0x04, 0x1F,
+ 0x02, 0x39, 0x02, 0x05, 0x78,
+ 0x47, 0x0A, 0x06, 0x54, 0x65,
+ 0x73, 0x74, 0x47, 0x70, 0x02,
+ 0x72, 0x73, 0x0D, 0x08, 0xF4,
+ 0x55, 0x73, 0x65, 0x72, 0x4C,
+ 0x6F, 0x67, 0x0D, 0x08, 0xF4,
+ 0x55, 0x73, 0x65, 0x72, 0x50,
+ 0x77, 0x64, 0x3C, 0x03, 0x01,
+ 0xAD, 0x9C, 0x3E, 0x05, 0x21,
+ 0x01, 0x01, 0x01, 0x01 };
+
+static unsigned char open_channel_511[] = { 0xD0, 0x53, 0x81, 0x03, 0x01, 0x40,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x05, 0x09, 0x4F, 0x70, 0x65,
+ 0x6E, 0x20, 0x49, 0x44, 0x20,
+ 0x31, 0x35, 0x07, 0x02, 0x03,
+ 0x04, 0x03, 0x04, 0x1F, 0x02,
+ 0x39, 0x02, 0x05, 0x78, 0x47,
+ 0x0A, 0x06, 0x54, 0x65, 0x73,
+ 0x74, 0x47, 0x70, 0x02, 0x72,
+ 0x73, 0x0D, 0x08, 0xF4, 0x55,
+ 0x73, 0x65, 0x72, 0x4C, 0x6F,
+ 0x67, 0x0D, 0x08, 0xF4, 0x55,
+ 0x73, 0x65, 0x72, 0x50, 0x77,
+ 0x64, 0x3C, 0x03, 0x01, 0xAD,
+ 0x9C, 0x3E, 0x05, 0x21, 0x01,
+ 0x01, 0x01, 0x01, 0xD0, 0x04,
+ 0x00, 0x09, 0x00, 0xB4 };
+
+static struct open_channel_test open_channel_data_211 = {
+ /*
+ * OPEN CHANNEL, immediate link establishment, GPRS, no local address
+ * no alpha identifier, no network access name
+ */
+ .pdu = open_channel_211,
+ .pdu_len = sizeof(open_channel_211),
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ .text_usr = "UserLog",
+ .text_passwd = "UserPwd",
+ .uti = {
+ .protocol = STK_TRANSPORT_PROTOCOL_UDP_CLIENT_REMOTE,
+ .port = 44444,
+ },
+ .data_dest_addr = {
+ .type = STK_ADDRESS_IPV4,
+ .addr = {
+ .ipv4 = 0x01010101,
+ },
+ },
+};
+
+static struct open_channel_test open_channel_data_221 = {
+ /*
+ * OPEN CHANNEL, immediate link establishment GPRS,
+ * no alpha identifier, with network access name
+ */
+ .pdu = open_channel_221,
+ .pdu_len = sizeof(open_channel_221),
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ .apn = "TestGp.rs",
+ .text_usr = "UserLog",
+ .text_passwd = "UserPwd",
+ .uti = {
+ .protocol = STK_TRANSPORT_PROTOCOL_UDP_CLIENT_REMOTE,
+ .port = 44444,
+ },
+ .data_dest_addr = {
+ .type = STK_ADDRESS_IPV4,
+ .addr = {
+ .ipv4 = 0x01010101,
+ },
+ },
+};
+
+static struct open_channel_test open_channel_data_231 = {
+ /*
+ * OPEN CHANNEL, immediate link establishment, GPRS
+ * with alpha identifier
+ */
+ .pdu = open_channel_231,
+ .pdu_len = sizeof(open_channel_231),
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .alpha_id = "Open ID",
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ .apn = "TestGp.rs",
+ .text_usr = "UserLog",
+ .text_passwd = "UserPwd",
+ .uti = {
+ .protocol = STK_TRANSPORT_PROTOCOL_UDP_CLIENT_REMOTE,
+ .port = 44444,
+ },
+ .data_dest_addr = {
+ .type = STK_ADDRESS_IPV4,
+ .addr = {
+ .ipv4 = 0x01010101,
+ },
+ },
+};
+
+static struct open_channel_test open_channel_data_241 = {
+ /*
+ * OPEN CHANNEL, immediate link establishment, GPRS,
+ * with null alpha identifier
+ */
+ .pdu = open_channel_241,
+ .pdu_len = sizeof(open_channel_241),
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .alpha_id = "",
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ .apn = "TestGp.rs",
+ .text_usr = "UserLog",
+ .text_passwd = "UserPwd",
+ .uti = {
+ .protocol = STK_TRANSPORT_PROTOCOL_UDP_CLIENT_REMOTE,
+ .port = 44444,
+ },
+ .data_dest_addr = {
+ .type = STK_ADDRESS_IPV4,
+ .addr = {
+ .ipv4 = 0x01010101,
+ },
+ },
+};
+
+static struct open_channel_test open_channel_data_511 = {
+ /*
+ * OPEN CHANNEL, immediate link establishment, GPRS
+ * Text Attribute – Left Alignment
+ */
+ .pdu = open_channel_511,
+ .pdu_len = sizeof(open_channel_511),
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .alpha_id = "Open ID 1",
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ .apn = "TestGp.rs",
+ .text_usr = "UserLog",
+ .text_passwd = "UserPwd",
+ .uti = {
+ .protocol = STK_TRANSPORT_PROTOCOL_UDP_CLIENT_REMOTE,
+ .port = 44444,
+ },
+ .data_dest_addr = {
+ .type = STK_ADDRESS_IPV4,
+ .addr = {
+ .ipv4 = 0x01010101,
+ },
+ },
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x09, 0x00, 0xB4 }
+ },
+};
+
+static void test_open_channel(gconstpointer data)
+{
+ const struct open_channel_test *test = data;
+ struct stk_command *command;
+
+ command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+ g_assert(command);
+ g_assert(command->status == STK_PARSE_RESULT_OK);
+
+ g_assert(command->number == 1);
+ g_assert(command->type == STK_COMMAND_TYPE_OPEN_CHANNEL);
+ g_assert(command->qualifier == test->qualifier);
+
+ g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+ g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL);
+
+ check_alpha_id(command->open_channel.alpha_id, test->alpha_id);
+ check_icon_id(&command->open_channel.icon_id, &test->icon_id);
+ check_bearer_desc(&command->open_channel.bearer_desc,
+ &test->bearer_desc);
+ g_assert(command->open_channel.buf_size == test->buf_size);
+ check_network_access_name(command->open_channel.apn, test->apn);
+ check_other_address(&command->open_channel.local_addr,
+ &test->local_addr);
+ check_text(command->open_channel.text_usr, test->text_usr);
+ check_text(command->open_channel.text_passwd, test->text_passwd);
+ check_uicc_te_interface(&command->open_channel.uti, &test->uti);
+ check_other_address(&command->open_channel.data_dest_addr,
+ &test->data_dest_addr);
+ check_text_attr(&command->open_channel.text_attr, &test->text_attr);
+ check_frame_id(&command->open_channel.frame_id, &test->frame_id);
+
+ stk_command_free(command);
+}
+
+struct close_channel_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+ enum stk_device_identity_type dst;
+ char *alpha_id;
+ struct stk_icon_id icon_id;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
+static unsigned char close_channel_111[] = { 0xD0, 0x09, 0x81, 0x03, 0x01, 0x41,
+ 0x00, 0x82, 0x02, 0x81, 0x21 };
+
+static struct close_channel_test close_channel_data_111 = {
+ .pdu = close_channel_111,
+ .pdu_len = sizeof(close_channel_111),
+ .qualifier = 0x00,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+};
+
+static unsigned char close_channel_211[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x41,
+ 0x00, 0x82, 0x02, 0x81, 0x21,
+ 0x85, 0x0A, 0x43, 0x6C, 0x6F,
+ 0x73, 0x65, 0x20, 0x49, 0x44,
+ 0x20, 0x31, 0xD0, 0x04, 0x00,
+ 0x0A, 0x00, 0xB4,
+ };
+
+static struct close_channel_test close_channel_data_211 = {
+ .pdu = close_channel_211,
+ .pdu_len = sizeof(close_channel_211),
+ .qualifier = 0x00,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .alpha_id = "Close ID 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x0A, 0x00, 0xB4 }
+ },
+};
+
+static void test_close_channel(gconstpointer data)
+{
+ const struct close_channel_test *test = data;
+ struct stk_command *command;
+
+ command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+ g_assert(command);
+ g_assert(command->status == STK_PARSE_RESULT_OK);
+
+ g_assert(command->number == 1);
+ g_assert(command->type == STK_COMMAND_TYPE_CLOSE_CHANNEL);
+ g_assert(command->qualifier == test->qualifier);
+
+ g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+ g_assert(command->dst == test->dst);
+
+ check_alpha_id(command->close_channel.alpha_id, test->alpha_id);
+ check_icon_id(&command->close_channel.icon_id, &test->icon_id);
+ check_text_attr(&command->close_channel.text_attr, &test->text_attr);
+ check_frame_id(&command->close_channel.frame_id, &test->frame_id);
+
+ stk_command_free(command);
+}
+
+struct receive_data_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+ enum stk_device_identity_type dst;
+ char *alpha_id;
+ struct stk_icon_id icon_id;
+ unsigned char data_len;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
+static unsigned char receive_data_111[] = { 0xD0, 0x0C, 0x81, 0x03, 0x01, 0x42,
+ 0x00, 0x82, 0x02, 0x81, 0x21,
+ 0xB7, 0x01, 0xC8 };
+
+static struct receive_data_test receive_data_data_111 = {
+ .pdu = receive_data_111,
+ .pdu_len = sizeof(receive_data_111),
+ .qualifier = 0x00,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .data_len = 200,
+};
+
+static unsigned char receive_data_211[] = { 0xD0, 0x22, 0x81, 0x03, 0x01, 0x42,
+ 0x00, 0x82, 0x02, 0x81, 0x21,
+ 0x85, 0x0E, 0x52, 0x65, 0x63,
+ 0x65, 0x69, 0x76, 0x65, 0x20,
+ 0x44, 0x61, 0x74, 0x61, 0x20,
+ 0x31, 0xB7, 0x01, 0xC8, 0xD0,
+ 0x04, 0x00, 0x0E, 0x00, 0xB4 };
+
+static struct receive_data_test receive_data_data_211 = {
+ .pdu = receive_data_211,
+ .pdu_len = sizeof(receive_data_211),
+ .qualifier = 0x00,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .data_len = 200,
+ .alpha_id = "Receive Data 1",
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x0E, 0x00, 0xB4 }
+ },
+};
+
+
+static void test_receive_data(gconstpointer data)
+{
+ const struct receive_data_test *test = data;
+ struct stk_command *command;
+
+ command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+ g_assert(command);
+ g_assert(command->status == STK_PARSE_RESULT_OK);
+
+ g_assert(command->number == 1);
+ g_assert(command->type == STK_COMMAND_TYPE_RECEIVE_DATA);
+ g_assert(command->qualifier == test->qualifier);
+
+ g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+ g_assert(command->dst == test->dst);
+
+ check_alpha_id(command->receive_data.alpha_id, test->alpha_id);
+ check_icon_id(&command->receive_data.icon_id, &test->icon_id);
+ check_common_byte(command->receive_data.data_len, test->data_len);
+ check_text_attr(&command->receive_data.text_attr, &test->text_attr);
+ check_frame_id(&command->receive_data.frame_id, &test->frame_id);
+
+ stk_command_free(command);
+}
+
+struct send_data_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+ enum stk_device_identity_type dst;
+ char *alpha_id;
+ struct stk_icon_id icon_id;
+ struct stk_common_byte_array data;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
+static unsigned char send_data_111[] = { 0xD0, 0x13, 0x81, 0x03, 0x01, 0x43,
+ 0x01, 0x82, 0x02, 0x81, 0x21,
+ 0xB6, 0x08, 0x00, 0x01, 0x02,
+ 0x03, 0x04, 0x05, 0x06, 0x07 };
+
+static struct send_data_test send_data_data_111 = {
+ .pdu = send_data_111,
+ .pdu_len = sizeof(send_data_111),
+ .qualifier = STK_SEND_DATA_IMMEDIATELY,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .data = {
+ .array = (unsigned char[8]) {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+ },
+ .len = 8,
+ },
+};
+
+static unsigned char send_data_121[] = {
+ 0xD0, 0x81, 0xD4, 0x81, 0x03, 0x01, 0x43, 0x00,
+ 0x82, 0x02, 0x81, 0x21, 0xB6, 0x81, 0xC8, 0x00,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
+ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+ 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
+ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
+ 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
+ 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
+ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
+ 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
+ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
+
+static struct send_data_test send_data_data_121 = {
+ .pdu = send_data_121,
+ .pdu_len = sizeof(send_data_121),
+ .qualifier = STK_SEND_DATA_STORE_DATA,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .data = {
+ .array = (unsigned char[200]) {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ },
+ .len = 200,
+ },
+};
+static unsigned char send_data_211[] = {
+ 0xD0, 0x26, 0x81, 0x03, 0x01, 0x43, 0x01, 0x82,
+ 0x02, 0x81, 0x21, 0x85, 0x0B, 0x53, 0x65, 0x6E,
+ 0x64, 0x20, 0x44, 0x61, 0x74, 0x61, 0x20, 0x31,
+ 0xB6, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0xD0, 0x04, 0x00, 0x0B, 0x00, 0xB4,
+ };
+
+static struct send_data_test send_data_data_211 = {
+ .pdu = send_data_211,
+ .pdu_len = sizeof(send_data_211),
+ .qualifier = STK_SEND_DATA_IMMEDIATELY,
+ .dst = STK_DEVICE_IDENTITY_TYPE_CHANNEL_1,
+ .alpha_id = "Send Data 1",
+ .data = {
+ .array = (unsigned char[8]) {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+ },
+ .len = 8,
+ },
+ .text_attr = {
+ .len = 4,
+ .attributes = { 0x00, 0x0B, 0x00, 0xB4 }
+ },
+};
+
+static void test_send_data(gconstpointer data)
+{
+ const struct send_data_test *test = data;
+ struct stk_command *command;
+
+ command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+ g_assert(command);
+ g_assert(command->status == STK_PARSE_RESULT_OK);
+
+ g_assert(command->number == 1);
+ g_assert(command->type == STK_COMMAND_TYPE_SEND_DATA);
+ g_assert(command->qualifier == test->qualifier);
+
+ g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+ g_assert(command->dst == test->dst);
+
+ check_alpha_id(command->send_data.alpha_id, test->alpha_id);
+ check_icon_id(&command->send_data.icon_id, &test->icon_id);
+ check_channel_data(&command->send_data.data, &test->data);
+ check_text_attr(&command->send_data.text_attr, &test->text_attr);
+ check_frame_id(&command->send_data.frame_id, &test->frame_id);
+
+ stk_command_free(command);
+}
+
+struct get_channel_status_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+};
+
+static unsigned char get_channel_status_111[] = { 0xD0, 0x09, 0x81, 0x03, 0x01,
+ 0x44, 0x00, 0x82, 0x02,
+ 0x81, 0x82 };
+
+static struct get_channel_status_test get_channel_status_data_111 = {
+ .pdu = get_channel_status_111,
+ .pdu_len = sizeof(get_channel_status_111),
+ .qualifier = 0x00,
+};
+
+static void test_get_channel_status(gconstpointer data)
+{
+ const struct get_channel_status_test *test = data;
+ struct stk_command *command;
+
+ command = stk_command_new_from_pdu(test->pdu, test->pdu_len);
+
+ g_assert(command);
+ g_assert(command->status == STK_PARSE_RESULT_OK);
+
+ g_assert(command->number == 1);
+ g_assert(command->type == STK_COMMAND_TYPE_GET_CHANNEL_STATUS);
+ g_assert(command->qualifier == test->qualifier);
+
+ g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+ g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL);
+
+ stk_command_free(command);
+}
+
struct terminal_response_test {
const unsigned char *pdu;
unsigned int pdu_len;
@@ -20884,6 +21577,366 @@ static const struct terminal_response_test launch_browser_response_data_411b = {
},
};
+static const unsigned char open_channel_response_211[] = {
+ 0x81, 0x03, 0x01, 0x40, 0x01, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0x38, 0x02, 0x81, 0x00, 0x35, 0x07, 0x02, 0x03,
+ 0x04, 0x03, 0x04, 0x1F, 0x02, 0x39, 0x02, 0x05, 0x78,
+};
+
+static const struct terminal_response_test open_channel_response_data_211 = {
+ .pdu = open_channel_response_211,
+ .pdu_len = sizeof(open_channel_response_211),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_OPEN_CHANNEL,
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .open_channel = {
+ .channel = {
+ .id = 1,
+ .status = STK_CHANNEL_PACKET_DATA_SERVICE_ACTIVATED,
+ },
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ } },
+ },
+};
+
+static const unsigned char open_channel_response_271[] = {
+ 0x81, 0x03, 0x01, 0x40, 0x01, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x22, 0x35, 0x07, 0x02, 0x03, 0x04, 0x03, 0x04, 0x1F,
+ 0x02, 0x39, 0x02, 0x05, 0x78,
+};
+
+static const struct terminal_response_test open_channel_response_data_271 = {
+ .pdu = open_channel_response_271,
+ .pdu_len = sizeof(open_channel_response_271),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_OPEN_CHANNEL,
+ .qualifier = STK_OPEN_CHANNEL_IMMEDIATE,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_USER_REJECT,
+ },
+ { .open_channel = {
+ .bearer_desc = {
+ .type = STK_BEARER_TYPE_GPRS_UTRAN,
+ .gprs = {
+ .precedence = 3,
+ .delay = 4,
+ .reliability = 3,
+ .peak = 4,
+ .mean = 31,
+ .pdp_type = 2,
+ },
+ },
+ .buf_size = 1400,
+ } },
+ },
+};
+
+static const unsigned char close_channel_response_121[] = {
+ 0x81, 0x03, 0x01, 0x41, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x02, 0x3A, 0x03,
+};
+
+static const struct terminal_response_test close_channel_response_data_121 = {
+ .pdu = close_channel_response_121,
+ .pdu_len = sizeof(close_channel_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_CLOSE_CHANNEL,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_BIP_ERROR,
+ .additional_len = 1, /* Channel identifier not valid */
+ .additional = (unsigned char[1]) { 0x03 },
+ },
+ },
+};
+
+static const unsigned char close_channel_response_131[] = {
+ 0x81, 0x03, 0x01, 0x41, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x02, 0x3A, 0x02,
+};
+
+static const struct terminal_response_test close_channel_response_data_131 = {
+ .pdu = close_channel_response_131,
+ .pdu_len = sizeof(close_channel_response_131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_CLOSE_CHANNEL,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_BIP_ERROR,
+ .additional_len = 1, /* Channel already closed */
+ .additional = (unsigned char[1]) { 0x02 },
+ },
+ },
+};
+
+static const unsigned char receive_data_response_111[] = {
+ 0x81, 0x03, 0x01, 0x42, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB6, 0x81, 0xC8, 0xc8, 0xc9, 0xca, 0xcb, 0xcc,
+ 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
+ 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
+ 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+ 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,
+ 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
+ 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
+ 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c,
+ 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,
+ 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44,
+ 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e,
+ 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62,
+ 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+ 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
+ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
+ 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0xB7, 0x01, 0xFF,
+};
+
+static const struct terminal_response_test receive_data_response_data_111 = {
+ .pdu = receive_data_response_111,
+ .pdu_len = sizeof(receive_data_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_RECEIVE_DATA,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .receive_data = {
+ .rx_data = {
+ .array = (unsigned char[200]) {
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd,
+ 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
+ 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
+ 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5,
+ 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
+ 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,
+ 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd,
+ 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+ 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
+ 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21,
+ 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
+ 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
+ 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
+ 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+ 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
+ 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
+ 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
+ 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
+ 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
+ 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,
+ 0x8e, 0x8f,
+ },
+ .len = 200,
+ },
+ .rx_remaining = 0xFF,
+ } },
+ },
+};
+
+static const unsigned char send_data_response_111[] = {
+ 0x81, 0x03, 0x01, 0x43, 0x01, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB7, 0x01, 0xFF,
+};
+
+static const struct terminal_response_test send_data_response_data_111 = {
+ .pdu = send_data_response_111,
+ .pdu_len = sizeof(send_data_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DATA,
+ .qualifier = STK_SEND_DATA_IMMEDIATELY,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .send_data = {
+ /* More than 255 bytes of space available */
+ .tx_avail = 0xFF,
+ } },
+ },
+};
+
+static const unsigned char send_data_response_121[] = {
+ 0x81, 0x03, 0x01, 0x43, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB7, 0x01, 0xFF,
+};
+
+static const struct terminal_response_test send_data_response_data_121 = {
+ .pdu = send_data_response_121,
+ .pdu_len = sizeof(send_data_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DATA,
+ .qualifier = STK_SEND_DATA_STORE_DATA,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .send_data = {
+ /* More than 255 bytes of space available */
+ .tx_avail = 0xFF,
+ } },
+ },
+};
+
+static const unsigned char send_data_response_151[] = {
+ 0x81, 0x03, 0x01, 0x43, 0x01, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x02, 0x3A, 0x03,
+};
+
+static const struct terminal_response_test send_data_response_data_151 = {
+ .pdu = send_data_response_151,
+ .pdu_len = sizeof(send_data_response_151),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_SEND_DATA,
+ .qualifier = STK_SEND_DATA_IMMEDIATELY,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_BIP_ERROR,
+ .additional_len = 1, /* Channel identifier not valid */
+ .additional = (unsigned char[1]) { 0x03 },
+ },
+ },
+};
+
+static const unsigned char get_channel_status_response_111[] = {
+ 0x81, 0x03, 0x01, 0x44, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB8, 0x02, 0x00, 0x00,
+};
+
+static const struct terminal_response_test
+ get_channel_status_response_data_111 = {
+ .pdu = get_channel_status_response_111,
+ .pdu_len = sizeof(get_channel_status_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_CHANNEL_STATUS,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .channel_status = {
+ /*
+ * No Channel available, link not established or
+ * PDP context not activated
+ */
+ .channel = {
+ .id = 0,
+ .status =
+ STK_CHANNEL_PACKET_DATA_SERVICE_NOT_ACTIVATED,
+ }
+ } },
+ },
+};
+
+static const unsigned char get_channel_status_response_121[] = {
+ 0x81, 0x03, 0x01, 0x44, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB8, 0x02, 0x81, 0x00,
+};
+
+static const struct terminal_response_test
+ get_channel_status_response_data_121 = {
+ .pdu = get_channel_status_response_121,
+ .pdu_len = sizeof(get_channel_status_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_CHANNEL_STATUS,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .channel_status = {
+ /* Channel 1 open, link established or PDP context activated */
+ .channel = {
+ .id = 1,
+ .status =
+ STK_CHANNEL_PACKET_DATA_SERVICE_ACTIVATED,
+ },
+ } },
+ },
+};
+
+static const unsigned char get_channel_status_response_131[] = {
+ 0x81, 0x03, 0x01, 0x44, 0x00, 0x82, 0x02, 0x82, 0x81, 0x83,
+ 0x01, 0x00, 0xB8, 0x02, 0x01, 0x05,
+};
+
+static const struct terminal_response_test
+ get_channel_status_response_data_131 = {
+ .pdu = get_channel_status_response_131,
+ .pdu_len = sizeof(get_channel_status_response_131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_CHANNEL_STATUS,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ },
+ { .channel_status = {
+ /* Channel 1, link dropped */
+ .channel = {
+ .id = 1,
+ .status = STK_CHANNEL_LINK_DROPPED,
+ },
+ } },
+
+ },
+};
+
struct envelope_test {
const unsigned char *pdu;
unsigned int pdu_len;
@@ -22428,16 +23481,20 @@ static const struct envelope_test event_download_data_available_data_111 = {
.type = STK_EVENT_TYPE_DATA_AVAILABLE,
{ .data_available = {
/* Channel 1 open, Link established */
- .channel_status = { 0x81, 0x00 },
+ .channel = {
+ .id = 1,
+ .status =
+ STK_CHANNEL_PACKET_DATA_SERVICE_ACTIVATED,
+ },
.channel_data_len = 255,
- }},
- }},
+ } },
+ } },
},
};
static const unsigned char event_download_data_available_211[] = {
0xd6, 0x0e, 0x99, 0x01, 0x09, 0x82, 0x02, 0x82,
- 0x81, 0xb8, 0x02, 0x81, 0x01, 0xb7, 0x01, 0xff,
+ 0x81, 0xb8, 0x02, 0x81, 0x00, 0xb7, 0x01, 0xff,
};
static const struct envelope_test event_download_data_available_data_211 = {
@@ -22451,10 +23508,14 @@ static const struct envelope_test event_download_data_available_data_211 = {
.type = STK_EVENT_TYPE_DATA_AVAILABLE,
{ .data_available = {
/* Channel 1 open, Link established */
- .channel_status = { 0x81, 0x01 },
+ .channel = {
+ .id = 1,
+ .status =
+ STK_CHANNEL_PACKET_DATA_SERVICE_ACTIVATED,
+ },
.channel_data_len = 255,
- }},
- }},
+ } },
+ } },
},
};
@@ -22474,9 +23535,12 @@ static const struct envelope_test event_download_channel_status_data_131 = {
.type = STK_EVENT_TYPE_CHANNEL_STATUS,
{ .channel_status = {
/* Channel 1, Link dropped */
- .status = { 0x01, 0x05 },
- }},
- }},
+ .channel = {
+ .id = 1,
+ .status = STK_CHANNEL_LINK_DROPPED,
+ },
+ } },
+ } },
},
};
@@ -22500,15 +23564,18 @@ static const struct envelope_test event_download_channel_status_data_211 = {
.type = STK_EVENT_TYPE_CHANNEL_STATUS,
{ .channel_status = {
/* Channel 1, TCP in LISTEN state */
- .status = { 0x41, 0x00 },
- }},
- }},
+ .channel = {
+ .id = 1,
+ .status = STK_CHANNEL_TCP_IN_LISTEN_STATE,
+ },
+ } },
+ } },
},
};
static const unsigned char event_download_channel_status_221[] = {
0xd6, 0x0b, 0x99, 0x01, 0x0a, 0x82, 0x02, 0x82,
- 0x81, 0xb8, 0x02, 0x81, 0x01,
+ 0x81, 0xb8, 0x02, 0x81, 0x00,
/*
* Byte 10 changed to 0xb8 (Comprehension Required should be
* set according to TS 102 223 7.5.11.2)
@@ -22526,9 +23593,13 @@ static const struct envelope_test event_download_channel_status_data_221 = {
.type = STK_EVENT_TYPE_CHANNEL_STATUS,
{ .channel_status = {
/* Channel 1 open, TCP Link established */
- .status = { 0x81, 0x01 },
- }},
- }},
+ .channel = {
+ .id = 1,
+ .status =
+ STK_CHANNEL_PACKET_DATA_SERVICE_ACTIVATED,
+ },
+ } },
+ } },
},
};
@@ -24790,6 +25861,71 @@ int main(int argc, char **argv)
&launch_browser_response_data_411b,
test_terminal_response_encoding);
+
+ g_test_add_data_func("/teststk/Open channel 2.1.1",
+ &open_channel_data_211, test_open_channel);
+ g_test_add_data_func("/teststk/Open channel 2.2.1",
+ &open_channel_data_221, test_open_channel);
+ g_test_add_data_func("/teststk/Open channel 2.3.1",
+ &open_channel_data_231, test_open_channel);
+ g_test_add_data_func("/teststk/Open channel 2.4.1",
+ &open_channel_data_241, test_open_channel);
+ g_test_add_data_func("/teststk/Open channel 5.1.1",
+ &open_channel_data_511, test_open_channel);
+ g_test_add_data_func("/teststk/Open channel response 2.1.1",
+ &open_channel_response_data_211,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Open channel response 2.7.1",
+ &open_channel_response_data_271,
+ test_terminal_response_encoding);
+
+ g_test_add_data_func("/teststk/Close channel 1.1.1",
+ &close_channel_data_111, test_close_channel);
+ g_test_add_data_func("/teststk/Close channel 2.1.1",
+ &close_channel_data_211, test_close_channel);
+ g_test_add_data_func("/teststk/Close channel response 1.2.1",
+ &close_channel_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Close channel response 1.3.1",
+ &close_channel_response_data_131,
+ test_terminal_response_encoding);
+
+ g_test_add_data_func("/teststk/Receive data 1.1.1",
+ &receive_data_data_111, test_receive_data);
+ g_test_add_data_func("/teststk/Receive data 2.1.1",
+ &receive_data_data_211, test_receive_data);
+ g_test_add_data_func("/teststk/Receive data response 1.1.1",
+ &receive_data_response_data_111,
+ test_terminal_response_encoding);
+
+ g_test_add_data_func("/teststk/Send data 1.1.1",
+ &send_data_data_111, test_send_data);
+ g_test_add_data_func("/teststk/Send data 1.2.1",
+ &send_data_data_121, test_send_data);
+ g_test_add_data_func("/teststk/Send data 2.1.1",
+ &send_data_data_211, test_send_data);
+ g_test_add_data_func("/teststk/Send data response 1.1.1",
+ &send_data_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Send data response 1.2.1",
+ &send_data_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Send data response 1.5.1",
+ &send_data_response_data_151,
+ test_terminal_response_encoding);
+
+ g_test_add_data_func("/teststk/Get Channel status 1.1.1",
+ &get_channel_status_data_111, test_get_channel_status);
+ g_test_add_data_func("/teststk/Get Channel status response 1.1.1",
+ &get_channel_status_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Channel status response 1.2.1",
+ &get_channel_status_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Channel status response 1.3.1",
+ &get_channel_status_response_data_131,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/SMS-PP data download 1.6.1",
&sms_pp_data_download_data_161,
test_envelope_encoding);
--
1.7.1
11 years, 1 month
[PATCH] sim: add +CNUM support for HFP emulator
by Frédéric Danis
---
src/sim.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index 98d4cc4..a9e73e6 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -106,6 +106,7 @@ struct ofono_sim {
const struct ofono_sim_driver *driver;
void *driver_data;
struct ofono_atom *atom;
+ unsigned int hfp_watch;
};
struct msisdn_set_request {
@@ -2519,6 +2520,56 @@ struct ofono_sim *ofono_sim_create(struct ofono_modem *modem,
return sim;
}
+static void emulator_cnum_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+ struct ofono_error result;
+ GSList *l;
+ const char *phone;
+ /*
+ * '+CNUM: ,"+",,,4' + phone number + phone type on 3 digits max
+ * + terminating null
+ */
+ char buf[OFONO_MAX_PHONE_NUMBER_LENGTH + 18 + 1];
+
+ result.error = 0;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY:
+ for (l = sim->own_numbers; l; l = l->next) {
+ struct ofono_phone_number *ph = l->data;
+
+ phone = phone_number_to_string(ph);
+ sprintf(buf, "+CNUM: ,\"%s\",%d,,4", phone, ph->type);
+ ofono_emulator_send_info(em, buf, TRUE);
+ }
+
+ result.type = OFONO_ERROR_TYPE_NO_ERROR;
+ ofono_emulator_send_final(em, &result);
+ break;
+
+ default:
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+ ofono_emulator_send_final(em, &result);
+ };
+}
+
+static void emulator_hfp_init(struct ofono_atom *atom, void *data)
+{
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ ofono_emulator_add_handler(em, "+CNUM", emulator_cnum_cb, data, NULL);
+}
+
+static void emulator_hfp_watch(struct ofono_atom *atom,
+ enum ofono_atom_watch_condition cond,
+ void *data)
+{
+ if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED)
+ emulator_hfp_init(atom, data);
+}
+
void ofono_sim_register(struct ofono_sim *sim)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -2545,6 +2596,13 @@ void ofono_sim_register(struct ofono_sim *sim)
if (sim->state > OFONO_SIM_STATE_NOT_PRESENT)
sim_initialize(sim);
+
+ sim->hfp_watch = __ofono_modem_add_atom_watch(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_hfp_watch, sim, NULL);
+
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_hfp_init, sim);
}
void ofono_sim_remove(struct ofono_sim *sim)
--
1.7.1
11 years, 1 month
[PATCH 0/3] atom watch cleanup
by Mika Liljeberg
Hi,
This patch set simplifies atom watch registration and removes
redundant code.
This approach also correctly handles the case when there are
multiple atoms of the same type (e.g. parallel probing of
alternate drivers or GPRS context drivers).
Br,
MikaL
[PATCH 1/3] core: notify watches of already registered atoms
[PATCH 2/3] core: remove redundant code
[PATCH 3/3] atmodem: remove redundant code
drivers/atmodem/sim-poll.c | 13 +------------
src/call-barring.c | 7 -------
src/call-forwarding.c | 7 -------
src/call-settings.c | 7 -------
src/cbs.c | 7 -------
src/gprs.c | 7 -------
src/modem.c | 16 +++++++++++++++-
src/sms.c | 11 -----------
src/voicecall.c | 6 ------
9 files changed, 16 insertions(+), 65 deletions(-)
11 years, 1 month
[PATCH v2 1/4] stk-api.txt: Introduce the new API DisplayAction
by Philippe Nunes
---
doc/stk-api.txt | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index f8a115e..0bcc6b5 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -252,6 +252,7 @@ Methods byte RequestSelection(string title, byte icon_id,
Possible Errors: [service].Error.SimToolkit.EndSession
void DisplayActionInformation(string text, byte icon_id)
+ [noreply]
Supplies a text string and/or icon concerning the
current activity in the terminal and UICC. The
@@ -267,6 +268,16 @@ Methods byte RequestSelection(string title, byte icon_id,
confirmation message to oFono and then should open
the launch browser with the given url.
+ void DisplayAction(string text, byte icon_id)
+
+ Supplies a text string and/or icon concerning the
+ current activity in the terminal and UICC. The
+ text should be displayed to the user on screen
+ until the call is canceled using Cancel() or until the
+ user decides to end the session.
+
+ Possible Errors: [service].Error.SimToolkit.EndSession
+
void Cancel() [noreply]
Asks the agent to cancel any ongoing operation in
--
1.7.1
11 years, 1 month
[PATCH v2 0/4] Support for emergency number list from network/modem
by Jeevaka Badrappan
Hi,
Following set of patch adds the emergency number list update from
the network/modem. Upon emergency number list update from modem, ofono
core will be updated which will result in dbus property change signal
as well. With this patch, even if the emergency number list maintained
in ofono matches with the received emergency number list from modem,
dbus property change will be signalled. If this should be avoided,
then it needs to be decided whether the check should be added in core
or for each modem.
Regards,
Jeevaka
Jeevaka Badrappan (4):
include: Add ofono_voicecall_en_list_notify api
voicecall: refactor emergency number list handling
voicecall: network emergency number list support
ifxmodem: emergency number list support
drivers/ifxmodem/voicecall.c | 98 ++++++++++++++++++++++++++++++++++++++++++
include/voicecall.h | 3 +
src/voicecall.c | 45 ++++++++++++++++---
3 files changed, 138 insertions(+), 8 deletions(-)
11 years, 1 month
[PATCHv2] doc: add dialup-overview.txt
by Guillaume Zajac
---
doc/dialup-overview.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
create mode 100644 doc/dialup-overview.txt
diff --git a/doc/dialup-overview.txt b/doc/dialup-overview.txt
new file mode 100644
index 0000000..f407560
--- /dev/null
+++ b/doc/dialup-overview.txt
@@ -0,0 +1,47 @@
+DialUp Networking diagram
+=========================
+
+This diagram explains how oFono and ConnMan are interacting to
+handle a data call from a DUN client.
+1) GAtServer receive ATD*99#.
+2) The GAtPPP server is setup.
+3) oFono through GAtPPP notify ConnMan that he needs a TUN/TAP interface.
+4) oFono is notified that TUN/TAP interface is created and can start exchanging
+PPP packets with DUN client. Those PPP packets are converted into IP stream
+and transmitted to/received from TUN/TAP interface.
+5) ConnMan is selecting which interface to send IP packets (WiFi, 3G, ethX, ...).
+
+*----------------* *----------------*
+| | ATD*99# | |
+| DUN Client |----------->| GAtServer |
+| |<---* | |
+*----------------* | *----------------*
+ | |
+ PPP | | setup_ppp()
+ Packets | |
+ | |
+ | V Need
+ | *----------------* /dev/net/tun *----------------*
+ *--->| | interface | |
+ | GAtPPP |<-------------->| ConnMan |
+ *--->| | interface | |
+ | *----------------* created *----------------*
+ IP | |
+ Stream | |Create
+ | *------------------------* |/dev/net/tun
+ | | | |interface
+ *--->| TUN/TAP interface |<-----------*
+ | |
+ *------------------------*
+ IP | Stream
+ routed with | ConnMan rules
+ *---------------------*--------------------*
+ | | |
+ | | |
+ V V V
+ *-------------* *-------------* *-------------*
+ | | | | | |
+ | WiFi | | Modem | | EthX |
+ | | | | | |
+ *-------------* *-------------* *-------------*
+
--
1.7.1
11 years, 1 month
[PATCH] emulator: add AT hook_control_cb() CB and register it
by Guillaume Zajac
---
src/emulator.c | 44 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index c84f0a9..586c7ec 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -177,6 +177,41 @@ error:
g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
}
+static void hook_control_cb(GAtServer *server, GAtServerRequestType type,
+ GAtResult *result, gpointer user_data)
+{
+ struct ofono_emulator *em = user_data;
+ GAtResultIter iter;
+ int val;
+
+ DBG("");
+
+ if (type != G_AT_SERVER_REQUEST_TYPE_SET)
+ goto error;
+
+ if (em->ppp == NULL)
+ goto error;
+
+ g_at_result_iter_init(&iter, result);
+ g_at_result_iter_next(&iter, "");
+
+ if (g_at_result_iter_next_number(&iter, &val) == FALSE)
+ goto error;
+
+ if (val != 0)
+ goto error;
+
+ g_at_ppp_unref(em->ppp);
+ em->ppp = NULL;
+
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+
+ return;
+
+error:
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+}
+
static void brsf_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data)
{
@@ -466,10 +501,13 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
__ofono_atom_register(em->atom, emulator_unregister);
- if (em->type == OFONO_EMULATOR_TYPE_DUN)
+ if (em->type == OFONO_EMULATOR_TYPE_DUN) {
g_at_server_register(em->server, "D", dial_cb, em, NULL);
- else if (em->type == OFONO_EMULATOR_TYPE_HFP)
- g_at_server_set_echo(em->server, FALSE);
+ g_at_server_register(em->server, "H", hook_control_cb, em, NULL);
+ } else {
+ if (em->type == OFONO_EMULATOR_TYPE_HFP)
+ g_at_server_set_echo(em->server, FALSE);
+ }
}
static void emulator_remove(struct ofono_atom *atom)
--
1.7.1
11 years, 1 month