/* * oFono - GSM Telephony Stack for Linux * * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "smsutil.h" #include "stkutil.h" static gboolean g_mem_equal(const unsigned char *v1, const unsigned char *v2, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) if (v1[i] != v2[i]) return FALSE; return TRUE; } static inline void check_common_bool(const ofono_bool_t command, const ofono_bool_t test) { g_assert(command == test); } /* Defined in TS 102.223 Section 8.8 */ static void check_duration(const struct stk_duration *command, const struct stk_duration *test) { g_assert(command->unit == test->unit); g_assert(command->interval == test->interval); } /* Defined in TS 102.223 Section 8.15 */ static inline void check_text(const char *command, const char *test) { g_assert(g_str_equal(command, test)); } /* Defined in TS 102.223 Section 8.31 */ static void check_icon_id(const struct stk_icon_id *command, const struct stk_icon_id *test) { g_assert(command->id == test->id); g_assert(command->qualifier == test->qualifier); } /* Defined in TS 102.223 Section 8.72 */ static void check_text_attr(const struct stk_text_attribute *command, const struct stk_text_attribute *test) { g_assert(command->len == test->len); g_assert(g_mem_equal(command->attributes, test->attributes, test->len)); } /* Defined in TS 102.223 Section 8.80 */ static void check_frame_id(const struct stk_frame_id *command, const struct stk_frame_id *test) { g_assert(command->has_id == test->has_id); if (test->has_id) g_assert(command->id == test->id); } struct display_text_test { const unsigned char *pdu; unsigned int pdu_len; unsigned char qualifier; const char *text; struct stk_icon_id icon_id; ofono_bool_t immediate_response; struct stk_duration duration; struct stk_text_attribute text_attribute; struct stk_frame_id frame_id; }; unsigned char display_text_111[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0F, 0x04, 0x54, 0x6F, 0x6F, 0x6C, 0x6B, 0x69, 0x74, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x31 }; unsigned char display_text_131[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x81, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0F, 0x04, 0x54, 0x6F, 0x6F, 0x6C, 0x6B, 0x69, 0x74, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x32 }; unsigned char display_text_141[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0E, 0x00, 0xD4, 0xF7, 0x9B, 0xBD, 0x4E, 0xD3, 0x41, 0xD4, 0xF2, 0x9C, 0x0E, 0x9A, 0x01 }; unsigned char display_text_151[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x00, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0F, 0x04, 0x54, 0x6F, 0x6F, 0x6C, 0x6B, 0x69, 0x74, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x34 }; unsigned char display_text_161[] = { 0xD0, 0x81, 0xAD, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x81, 0xA1, 0x04, 0x54, 0x68, 0x69, 0x73, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x69, 0x6E, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4D, 0x45, 0x20, 0x74, 0x6F, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6C, 0x61, 0x79, 0x20, 0x61, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2E, 0x20, 0x49, 0x74, 0x20, 0x61, 0x6C, 0x6C, 0x6F, 0x77, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x53, 0x49, 0x4D, 0x20, 0x74, 0x6F, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x69, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2C, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x2E, 0x20, 0x54, 0x77, 0x6F, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x6F, 0x66, 0x20, 0x70, 0x72, 0x69, 0x6F }; unsigned char display_text_171[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0F, 0x04, 0x3C, 0x47, 0x4F, 0x2D, 0x42, 0x41, 0x43, 0x4B, 0x57, 0x41, 0x52, 0x44, 0x53, 0x3E }; unsigned char display_text_511[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0B, 0x04, 0x42, 0x61, 0x73, 0x69, 0x63, 0x20, 0x49, 0x63, 0x6F, 0x6E, 0x9E, 0x02, 0x00, 0x01 }; unsigned char display_text_521[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0C, 0x04, 0x43, 0x6F, 0x6C, 0x6F, 0x75, 0x72, 0x20, 0x49, 0x63, 0x6F, 0x6E, 0x9E, 0x02, 0x00, 0x02 }; unsigned char display_text_531[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0B, 0x04, 0x42, 0x61, 0x73, 0x69, 0x63, 0x20, 0x49, 0x63, 0x6F, 0x6E, 0x9E, 0x02, 0x01, 0x01 }; unsigned char display_text_611[] = { 0xD0, 0x24, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x19, 0x08, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15 }; unsigned char display_text_711[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x0A, 0x04, 0x31, 0x30, 0x20, 0x53, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x84, 0x02, 0x01, 0x0A }; unsigned char display_text_911[] = { 0xD0, 0x10, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x05, 0x08, 0x4F, 0x60, 0x59, 0x7D }; unsigned char display_text_1011[] = { 0xD0, 0x12, 0x81, 0x03, 0x01, 0x21, 0x80, 0x82, 0x02, 0x81, 0x02, 0x8D, 0x07, 0x08, 0x00, 0x38, 0x00, 0x30, 0x30, 0xEB }; static struct display_text_test display_text_data_111 = { .pdu = display_text_111, .pdu_len = sizeof(display_text_111), .qualifier = 0x80, .text = "Toolkit Test 1" }; static struct display_text_test display_text_data_131 = { .pdu = display_text_131, .pdu_len = sizeof(display_text_131), .qualifier = 0x81, .text = "Toolkit Test 2" }; static struct display_text_test display_text_data_141 = { .pdu = display_text_141, .pdu_len = sizeof(display_text_141), .qualifier = 0x80, .text = "Toolkit Test 3" }; static struct display_text_test display_text_data_151 = { .pdu = display_text_151, .pdu_len = sizeof(display_text_151), .qualifier = 0x00, .text = "Toolkit Test 4" }; static struct display_text_test display_text_data_161 = { .pdu = display_text_161, .pdu_len = sizeof(display_text_161), .qualifier = 0x80, .text = "This command instructs the ME to display a text message. " "It allows the SIM to define the priority of that " "message, and the text string format. Two types of " "prio" }; static struct display_text_test display_text_data_171 = { .pdu = display_text_171, .pdu_len = sizeof(display_text_171), .qualifier = 0x80, .text = "" }; static struct display_text_test display_text_data_511 = { .pdu = display_text_511, .pdu_len = sizeof(display_text_511), .qualifier = 0x80, .text = "Basic Icon", .icon_id = { .qualifier = 0x00, .id = 0x01 } }; static struct display_text_test display_text_data_521 = { .pdu = display_text_521, .pdu_len = sizeof(display_text_521), .qualifier = 0x80, .text = "Colour Icon", .icon_id = { .qualifier = 0x00, .id = 0x02 } }; static struct display_text_test display_text_data_531 = { .pdu = display_text_531, .pdu_len = sizeof(display_text_531), .qualifier = 0x80, .text = "Basic Icon", .icon_id = { .qualifier = 0x01, .id = 0x01 } }; static struct display_text_test display_text_data_611 = { .pdu = display_text_611, .pdu_len = sizeof(display_text_611), .qualifier = 0x80, .text = "ЗДРАВСТВУЙТЕ" }; static struct display_text_test display_text_data_711 = { .pdu = display_text_711, .pdu_len = sizeof(display_text_711), .qualifier = 0x80, .text = "10 Second", .duration = { .unit = STK_DURATION_TYPE_SECONDS, .interval = 10, } }; static struct display_text_test display_text_data_911 = { .pdu = display_text_911, .pdu_len = sizeof(display_text_911), .qualifier = 0x80, .text = "你好" }; static struct display_text_test display_text_data_1011 = { .pdu = display_text_1011, .pdu_len = sizeof(display_text_1011), .qualifier = 0x80, .text = "80ル" }; /* Defined in TS 102.384 Section 27.22.4.1 */ static void test_display_text(gconstpointer data) { const struct display_text_test *test = data; struct stk_command *command; command = stk_command_new_from_pdu(test->pdu, test->pdu_len); g_assert(command); g_assert(command->number == 1); g_assert(command->type == STK_COMMAND_TYPE_DISPLAY_TEXT); g_assert(command->qualifier == test->qualifier); g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC); g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_DISPLAY); g_assert(command->display_text.text); check_text(command->display_text.text, test->text); check_icon_id(&command->display_text.icon_id, &test->icon_id); check_common_bool(command->display_text.immediate_response, test->immediate_response); check_duration(&command->display_text.duration, &test->duration); check_text_attr(&command->display_text.text_attribute, &test->text_attribute); check_frame_id(&command->display_text.frame_id, &test->frame_id); stk_command_free(command); } struct get_inkey_test { const unsigned char *pdu; unsigned int pdu_len; unsigned char qualifier; char *text; struct stk_icon_id icon_id; struct stk_duration duration; struct stk_text_attribute text_attr; struct stk_frame_id frame_id; }; static unsigned char get_inkey_111[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22 }; static unsigned char get_inkey_121[] = { 0xD0, 0x14, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x09, 0x00, 0x45, 0x37, 0xBD, 0x2C, 0x07, 0x89, 0x60, 0x22 }; static unsigned char get_inkey_131[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0F, 0x04, 0x3C, 0x47, 0x4F, 0x2D, 0x42, 0x41, 0x43, 0x4B, 0x57, 0x41, 0x52, 0x44, 0x53, 0x3E }; static unsigned char get_inkey_141[] = { 0xD0, 0x13, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x08, 0x04, 0x3C, 0x41, 0x42, 0x4F, 0x52, 0x54, 0x3E }; static unsigned char get_inkey_151[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x01, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x71, 0x22 }; static unsigned char get_inkey_161[] = { 0xD0, 0x81, 0xAD, 0x81, 0x03, 0x01, 0x22, 0x01, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x81, 0xA1, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x78, 0x22, 0x2E, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x69, 0x6E, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4D, 0x45, 0x20, 0x74, 0x6F, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6C, 0x61, 0x79, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2C, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x65, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x2E, 0x20, 0x41, 0x6E, 0x79, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6F, 0x6E, 0x73, 0x65, 0x20, 0x65, 0x6E, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x73, 0x68, 0x61, 0x6C, 0x6C, 0x20, 0x62, 0x65, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x74 }; static unsigned char get_inkey_211[] = { 0xD0, 0x16, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0B, 0x04, 0x3C, 0x54, 0x49, 0x4D, 0x45, 0x2D, 0x4F, 0x55, 0x54, 0x3E }; static unsigned char get_inkey_311[] = { 0xD0, 0x24, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x19, 0x08, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15 }; static unsigned char get_inkey_321[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x81, 0x8D, 0x08, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19, 0x04, 0x22, 0x04, 0x15, 0x04, 0x17, 0x04, 0x14, 0x04, 0x20, 0x04, 0x10, 0x04, 0x12, 0x04, 0x21, 0x04, 0x22, 0x04, 0x12, 0x04, 0x23, 0x04, 0x19 }; static unsigned char get_inkey_411[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x06, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72 }; static unsigned char get_inkey_511[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x04, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x59, 0x45, 0x53 }; static unsigned char get_inkey_512[] = { 0xD0, 0x14, 0x81, 0x03, 0x01, 0x22, 0x04, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x09, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x4E, 0x4F }; static unsigned char get_inkey_611[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x3C, 0x4E, 0x4F, 0x2D, 0x49, 0x43, 0x4F, 0x4E, 0x3E, 0x1E, 0x02, 0x00, 0x01 }; static unsigned char get_inkey_621[] = { 0xD0, 0x1C, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0D, 0x04, 0x3C, 0x42, 0x41, 0x53, 0x49, 0x43, 0x2D, 0x49, 0x43, 0x4F, 0x4E, 0x3E, 0x1E, 0x02, 0x01, 0x01 }; static unsigned char get_inkey_631[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x3C, 0x4E, 0x4F, 0x2D, 0x49, 0x43, 0x4F, 0x4E, 0x3E, 0x1E, 0x02, 0x00, 0x02 }; static unsigned char get_inkey_641[] = { 0xD0, 0x1D, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0E, 0x04, 0x3C, 0x43, 0x4F, 0x4C, 0x4F, 0x55, 0x52, 0x2D, 0x49, 0x43, 0x4F, 0x4E, 0x3E, 0x1E, 0x02, 0x01, 0x02 }; static unsigned char get_inkey_711[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x80, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22 }; static unsigned char get_inkey_712[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x80, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22 }; static unsigned char get_inkey_811[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0x84, 0x02, 0x01, 0x0A }; static unsigned char get_inkey_911[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_912[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_921[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x01, 0xB4 }; static unsigned char get_inkey_922[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_931[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x02, 0xB4 }; static unsigned char get_inkey_932[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_941[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x04, 0xB4 }; static unsigned char get_inkey_942[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_943[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_951[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x08, 0xB4 }; static unsigned char get_inkey_952[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_953[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_961[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x10, 0xB4 }; static unsigned char get_inkey_962[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_963[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_971[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x20, 0xB4 }; static unsigned char get_inkey_972[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_973[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_981[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x40, 0xB4 }; static unsigned char get_inkey_982[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_983[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_991[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x80, 0xB4 }; static unsigned char get_inkey_992a[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_992b[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_993[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_9101[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x2B, 0x22, 0xD0, 0x04, 0x00, 0x09, 0x00, 0xB4 }; static unsigned char get_inkey_9102[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0A, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x22, 0x23, 0x22 }; static unsigned char get_inkey_1011[] = { 0xD0, 0x10, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x05, 0x08, 0x4F, 0x60, 0x59, 0x7D }; static unsigned char get_inkey_1021[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x81, 0x8D, 0x08, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D, 0x4F, 0x60, 0x59, 0x7D }; static unsigned char get_inkey_1111[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x06, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72 }; static unsigned char get_inkey_1211[] = { 0xD0, 0x0E, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x03, 0x08, 0x30, 0xEB }; static unsigned char get_inkey_1221[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x81, 0x8D, 0x08, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB, 0x30, 0xEB }; static unsigned char get_inkey_1311[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x06, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72 }; static struct get_inkey_test get_inkey_data_111 = { .pdu = get_inkey_111, .pdu_len = sizeof(get_inkey_111), .qualifier = 0x00, .text = "Enter \"+\"" }; static struct get_inkey_test get_inkey_data_121 = { .pdu = get_inkey_121, .pdu_len = sizeof(get_inkey_121), .qualifier = 0x00, .text = "Enter \"0\"" }; static struct get_inkey_test get_inkey_data_131 = { .pdu = get_inkey_131, .pdu_len = sizeof(get_inkey_131), .qualifier = 0x00, .text = "" }; static struct get_inkey_test get_inkey_data_141 = { .pdu = get_inkey_141, .pdu_len = sizeof(get_inkey_141), .qualifier = 0x00, .text = "" }; static struct get_inkey_test get_inkey_data_151 = { .pdu = get_inkey_151, .pdu_len = sizeof(get_inkey_151), .qualifier = 0x01, .text = "Enter \"q\"" }; static struct get_inkey_test get_inkey_data_161 = { .pdu = get_inkey_161, .pdu_len = sizeof(get_inkey_161), .qualifier = 0x01, .text = "Enter \"x\". This command instructs the ME to display text, " "and to expect the user to enter a single character. Any " "response entered by the user shall be passed t" }; static struct get_inkey_test get_inkey_data_211 = { .pdu = get_inkey_211, .pdu_len = sizeof(get_inkey_211), .qualifier = 0x00, .text = "" }; static struct get_inkey_test get_inkey_data_311 = { .pdu = get_inkey_311, .pdu_len = sizeof(get_inkey_311), .qualifier = 0x00, .text = "ЗДРАВСТВУЙТЕ" }; static struct get_inkey_test get_inkey_data_321 = { .pdu = get_inkey_321, .pdu_len = sizeof(get_inkey_321), .qualifier = 0x00, .text = "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" }; static struct get_inkey_test get_inkey_data_411 = { .pdu = get_inkey_411, .pdu_len = sizeof(get_inkey_411), .qualifier = 0x03, .text = "Enter" }; static struct get_inkey_test get_inkey_data_511 = { .pdu = get_inkey_511, .pdu_len = sizeof(get_inkey_511), .qualifier = 0x04, .text = "Enter YES" }; static struct get_inkey_test get_inkey_data_512 = { .pdu = get_inkey_512, .pdu_len = sizeof(get_inkey_512), .qualifier = 0x04, .text = "Enter NO" }; static struct get_inkey_test get_inkey_data_611 = { .pdu = get_inkey_611, .pdu_len = sizeof(get_inkey_611), .qualifier = 0x00, .text = "", .icon_id = { .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY, .id = 0x01 } }; static struct get_inkey_test get_inkey_data_621 = { .pdu = get_inkey_621, .pdu_len = sizeof(get_inkey_621), .qualifier = 0x00, .text = "", .icon_id = { .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY, .id = 0x01 } }; static struct get_inkey_test get_inkey_data_631 = { .pdu = get_inkey_631, .pdu_len = sizeof(get_inkey_631), .qualifier = 0x00, .text = "", .icon_id = { .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY, .id = 0x02 } }; static struct get_inkey_test get_inkey_data_641 = { .pdu = get_inkey_641, .pdu_len = sizeof(get_inkey_641), .qualifier = 0x00, .text = "", .icon_id = { .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY, .id = 0x02 } }; static struct get_inkey_test get_inkey_data_711 = { .pdu = get_inkey_711, .pdu_len = sizeof(get_inkey_711), .qualifier = 0x80, .text = "Enter \"+\"" }; static struct get_inkey_test get_inkey_data_712 = { .pdu = get_inkey_712, .pdu_len = sizeof(get_inkey_712), .qualifier = 0x80, .text = "Enter \"+\"" }; static struct get_inkey_test get_inkey_data_811 = { .pdu = get_inkey_811, .pdu_len = sizeof(get_inkey_811), .qualifier = 0x00, .text = "Enter \"+\"", .duration = { .unit = STK_DURATION_TYPE_SECONDS, .interval = 10 } }; static struct get_inkey_test get_inkey_data_911 = { .pdu = get_inkey_911, .pdu_len = sizeof(get_inkey_911), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_912 = { .pdu = get_inkey_912, .pdu_len = sizeof(get_inkey_912), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_921 = { .pdu = get_inkey_921, .pdu_len = sizeof(get_inkey_921), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x01, 0xB4 } } }; static struct get_inkey_test get_inkey_data_922 = { .pdu = get_inkey_922, .pdu_len = sizeof(get_inkey_922), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_931 = { .pdu = get_inkey_931, .pdu_len = sizeof(get_inkey_931), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x02, 0xB4 } } }; static struct get_inkey_test get_inkey_data_932 = { .pdu = get_inkey_932, .pdu_len = sizeof(get_inkey_932), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_941 = { .pdu = get_inkey_941, .pdu_len = sizeof(get_inkey_941), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x04, 0xB4 } } }; static struct get_inkey_test get_inkey_data_942 = { .pdu = get_inkey_942, .pdu_len = sizeof(get_inkey_942), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_943 = { .pdu = get_inkey_943, .pdu_len = sizeof(get_inkey_943), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_951 = { .pdu = get_inkey_951, .pdu_len = sizeof(get_inkey_951), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x08, 0xB4 } } }; static struct get_inkey_test get_inkey_data_952 = { .pdu = get_inkey_952, .pdu_len = sizeof(get_inkey_952), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_953 = { .pdu = get_inkey_953, .pdu_len = sizeof(get_inkey_953), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_961 = { .pdu = get_inkey_961, .pdu_len = sizeof(get_inkey_961), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x10, 0xB4 } } }; static struct get_inkey_test get_inkey_data_962 = { .pdu = get_inkey_962, .pdu_len = sizeof(get_inkey_962), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_963 = { .pdu = get_inkey_963, .pdu_len = sizeof(get_inkey_963), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_971 = { .pdu = get_inkey_971, .pdu_len = sizeof(get_inkey_971), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x20, 0xB4 } } }; static struct get_inkey_test get_inkey_data_972 = { .pdu = get_inkey_972, .pdu_len = sizeof(get_inkey_972), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_973 = { .pdu = get_inkey_973, .pdu_len = sizeof(get_inkey_973), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_981 = { .pdu = get_inkey_981, .pdu_len = sizeof(get_inkey_981), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x40, 0xB4 } } }; static struct get_inkey_test get_inkey_data_982 = { .pdu = get_inkey_982, .pdu_len = sizeof(get_inkey_982), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_983 = { .pdu = get_inkey_983, .pdu_len = sizeof(get_inkey_983), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_991 = { .pdu = get_inkey_991, .pdu_len = sizeof(get_inkey_991), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x80, 0xB4 } } }; static struct get_inkey_test get_inkey_data_992a = { .pdu = get_inkey_992a, .pdu_len = sizeof(get_inkey_992a), .qualifier = 0x00, .text = "Enter \"#\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_992b = { .pdu = get_inkey_992b, .pdu_len = sizeof(get_inkey_992b), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_993 = { .pdu = get_inkey_993, .pdu_len = sizeof(get_inkey_993), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_9101 = { .pdu = get_inkey_9101, .pdu_len = sizeof(get_inkey_9101), .qualifier = 0x00, .text = "Enter \"+\"", .text_attr = { .len = 4, .attributes = { 0x00, 0x09, 0x00, 0xB4 } } }; static struct get_inkey_test get_inkey_data_9102 = { .pdu = get_inkey_9102, .pdu_len = sizeof(get_inkey_9102), .qualifier = 0x00, .text = "Enter \"#\"" }; static struct get_inkey_test get_inkey_data_1011 = { .pdu = get_inkey_1011, .pdu_len = sizeof(get_inkey_1011), .qualifier = 0x00, .text = "你好" }; static struct get_inkey_test get_inkey_data_1021 = { .pdu = get_inkey_1021, .pdu_len = sizeof(get_inkey_1021), .qualifier = 0x00, .text = "你好你好你好你好你好你好你好你好你好你好" "你好你好你好你好你好你好你好你好你好你好" "你好你好你好你好你好你好你好你好你好你好" "你好你好你好你好你好" }; static struct get_inkey_test get_inkey_data_1111 = { .pdu = get_inkey_1111, .pdu_len = sizeof(get_inkey_1111), .qualifier = 0x03, .text = "Enter" }; static struct get_inkey_test get_inkey_data_1211 = { .pdu = get_inkey_1211, .pdu_len = sizeof(get_inkey_1211), .qualifier = 0x00, .text = "ル" }; static struct get_inkey_test get_inkey_data_1221 = { .pdu = get_inkey_1221, .pdu_len = sizeof(get_inkey_1221), .qualifier = 0x00, .text = "ルルルルルルルルルルルルルルルルルルルル" "ルルルルルルルルルルルルルルルルルルルル" "ルルルルルルルルルルルルルルルルルルルル" "ルルルルルルルルルル" }; static struct get_inkey_test get_inkey_data_1311 = { .pdu = get_inkey_1311, .pdu_len = sizeof(get_inkey_1311), .qualifier = 0x03, .text = "Enter" }; /* Defined in TS 102.384 Section 27.22.4.2 */ static void test_get_inkey(gconstpointer data) { const struct get_inkey_test *test = data; struct stk_command *command; command = stk_command_new_from_pdu(test->pdu, test->pdu_len); g_assert(command); g_assert(command->number == 1); g_assert(command->type == STK_COMMAND_TYPE_GET_INKEY); g_assert(command->qualifier == test->qualifier); g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC); g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL); g_assert(command->get_inkey.text); check_text(command->get_inkey.text, test->text); check_icon_id(&command->get_inkey.icon_id, &test->icon_id); check_duration(&command->get_inkey.duration, &test->duration); check_text_attr(&command->get_inkey.text_attr, &test->text_attr); check_frame_id(&command->get_inkey.frame_id, &test->frame_id); stk_command_free(command); } struct get_input_test { const unsigned char *pdu; unsigned int pdu_len; unsigned char qualifier; const char *expected; unsigned char min; unsigned char max; unsigned char icon_qualifier; unsigned char icon_id; }; static unsigned char get_input_111[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x23, 0x00, 0x82, 0x02, 0x81, 0x82, 0x8D, 0x0C, 0x04, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x31, 0x32, 0x33, 0x34, 0x35, 0x91, 0x02, 0x05, 0x05 }; static struct get_input_test get_input_data_111 = { .pdu = get_input_111, .pdu_len = sizeof(get_input_111), .expected = "Enter 12345", .qualifier = 0x00, .min = 5, .max = 5 }; /* Defined in TS 102.384 Section 27.22.4.3 */ static void test_get_input(gconstpointer data) { const struct get_input_test *test = data; struct stk_command *command; command = stk_command_new_from_pdu(test->pdu, test->pdu_len); g_assert(command); g_assert(command->number == 1); g_assert(command->type == STK_COMMAND_TYPE_GET_INPUT); g_assert(command->qualifier == test->qualifier); g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC); g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL); g_assert(command->get_input.text); g_assert(g_str_equal(test->expected, command->get_input.text)); g_assert(command->get_input.response_length.min == test->min); g_assert(command->get_input.response_length.max == test->max); if (test->icon_id > 0) { g_assert(command->get_input.icon_id.id == test->icon_id); g_assert(command->get_input.icon_id.qualifier == test->icon_qualifier); } stk_command_free(command); } struct more_time_test { const unsigned char *pdu; unsigned int pdu_len; unsigned char qualifier; }; static unsigned char more_time_111[] = { 0xD0, 0x09, 0x81, 0x03, 0x01, 0x02, 0x00, 0x82, 0x02, 0x81, 0x82 }; static struct more_time_test more_time_data_111 = { .pdu = more_time_111, .pdu_len = sizeof(more_time_111), .qualifier = 0x00, }; /* Defined in TS 102.384 Section 27.22.4.4 */ static void test_more_time(gconstpointer data) { const struct get_input_test *test = data; struct stk_command *command; command = stk_command_new_from_pdu(test->pdu, test->pdu_len); g_assert(command); g_assert(command->number == 1); g_assert(command->type == STK_COMMAND_TYPE_MORE_TIME); 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 send_sms_test { const unsigned char *pdu; unsigned int pdu_len; unsigned char qualifier; const char *alpha_id; unsigned char ton_npi; const char *address; unsigned char sms_mr; const char *sms_address; unsigned char sms_udl; const char *sms_ud; }; /* 3GPP TS 31.124 Section 27.22.4.10.1.4.2 */ static unsigned char send_sms_11[] = { 0xD0, 0x37, 0x81, 0x03, 0x01, 0x13, 0x00, 0x82, 0x02, 0x81, 0x83, 0x85, 0x07, 0x53, 0x65, 0x6E, 0x64, 0x20, 0x53, 0x4D, 0x86, 0x09, 0x91, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0xF8, 0x8B, 0x18, 0x01, 0x00, 0x09, 0x91, 0x10, 0x32, 0x54, 0x76, 0xF8, 0x40, 0xF4, 0x0C, 0x54, 0x65, 0x73, 0x74, 0x20, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65 }; static struct send_sms_test send_sms_data_11 = { .pdu = send_sms_11, .pdu_len = sizeof(send_sms_11), .qualifier = 0x00, .alpha_id = "Send SM", .ton_npi = 0x91, .address = "112233445566778", .sms_mr = 0x00, .sms_address = "012345678", .sms_udl = 12, .sms_ud = "Test Message", }; static void test_send_sms(gconstpointer data) { const struct send_sms_test *test = data; struct stk_command *command; int i; command = stk_command_new_from_pdu(test->pdu, test->pdu_len); g_assert(command); g_assert(command->number == 1); g_assert(command->type == STK_COMMAND_TYPE_SEND_SMS); g_assert(command->qualifier == test->qualifier); g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC); g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_NETWORK); if (test->alpha_id) g_assert(g_str_equal(test->alpha_id, command->send_sms.alpha_id)); if (test->address) { g_assert(test->ton_npi == command->send_sms.address.ton_npi); g_assert(g_str_equal(test->address, command->send_sms.address.number)); } g_assert(test->sms_mr == command->send_sms.gsm_sms.submit.mr); g_assert(test->sms_udl == command->send_sms.gsm_sms.submit.udl); g_assert(g_str_equal(test->sms_address, command->send_sms.gsm_sms.submit.daddr.address)); for (i = 0; i < test->sms_udl; i++) g_assert(test->sms_ud[i] == command->send_sms.gsm_sms.submit.ud[i]); stk_command_free(command); } int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); g_test_add_data_func("/teststk/Display Text 1.1.1", &display_text_data_111, test_display_text); g_test_add_data_func("/teststk/Display Text 1.3.1", &display_text_data_131, test_display_text); g_test_add_data_func("/teststk/Display Text 1.4.1", &display_text_data_141, test_display_text); g_test_add_data_func("/teststk/Display Text 1.5.1", &display_text_data_151, test_display_text); g_test_add_data_func("/teststk/Display Text 1.6.1", &display_text_data_161, test_display_text); g_test_add_data_func("/teststk/Display Text 1.7.1", &display_text_data_171, test_display_text); g_test_add_data_func("/teststk/Display Text 5.1.1", &display_text_data_511, test_display_text); g_test_add_data_func("/teststk/Display Text 5.2.1", &display_text_data_521, test_display_text); g_test_add_data_func("/teststk/Display Text 5.3.1", &display_text_data_531, test_display_text); g_test_add_data_func("/teststk/Display Text 6.1.1", &display_text_data_611, test_display_text); g_test_add_data_func("/teststk/Display Text 7.1.1", &display_text_data_711, test_display_text); g_test_add_data_func("/teststk/Display Text 9.1.1", &display_text_data_911, test_display_text); g_test_add_data_func("/teststk/Display Text 10.1.1", &display_text_data_1011, test_display_text); g_test_add_data_func("/teststk/Get Inkey 1.1.1", &get_inkey_data_111, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 1.2.1", &get_inkey_data_121, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 1.3.1", &get_inkey_data_131, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 1.4.1", &get_inkey_data_141, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 1.5.1", &get_inkey_data_151, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 1.6.1", &get_inkey_data_161, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 2.1.1", &get_inkey_data_211, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 3.1.1", &get_inkey_data_311, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 3.2.1", &get_inkey_data_321, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 4.1.1", &get_inkey_data_411, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 5.1.1", &get_inkey_data_511, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 5.1.2", &get_inkey_data_512, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 6.1.1", &get_inkey_data_611, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 6.2.1", &get_inkey_data_621, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 6.3.1", &get_inkey_data_631, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 6.4.1", &get_inkey_data_641, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 7.1.1", &get_inkey_data_711, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 7.1.2", &get_inkey_data_712, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 8.1.1", &get_inkey_data_811, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.1.1", &get_inkey_data_911, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.1.2", &get_inkey_data_912, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.2.1", &get_inkey_data_921, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.2.2", &get_inkey_data_922, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.3.1", &get_inkey_data_931, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.3.2", &get_inkey_data_932, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.4.1", &get_inkey_data_941, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.4.2", &get_inkey_data_942, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.4.3", &get_inkey_data_943, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.5.1", &get_inkey_data_951, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.5.2", &get_inkey_data_952, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.5.3", &get_inkey_data_953, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.6.1", &get_inkey_data_961, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.6.2", &get_inkey_data_962, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.6.3", &get_inkey_data_963, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.7.1", &get_inkey_data_971, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.7.2", &get_inkey_data_972, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.7.3", &get_inkey_data_973, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.8.1", &get_inkey_data_981, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.8.2", &get_inkey_data_982, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.8.3", &get_inkey_data_983, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.9.1", &get_inkey_data_991, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.9.2a", &get_inkey_data_992a, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.9.2b", &get_inkey_data_992b, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.9.3", &get_inkey_data_993, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.10.1", &get_inkey_data_9101, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 9.10.2", &get_inkey_data_9102, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 10.1.1", &get_inkey_data_1011, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 10.2.1", &get_inkey_data_1021, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 11.1.1", &get_inkey_data_1111, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 12.1.1", &get_inkey_data_1211, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 12.2.1", &get_inkey_data_1221, test_get_inkey); g_test_add_data_func("/teststk/Get Inkey 13.1.1", &get_inkey_data_1311, test_get_inkey); g_test_add_data_func("/teststk/Get Input 1.1.1", &get_input_data_111, test_get_input); g_test_add_data_func("/teststk/More Time 1.1.1", &more_time_data_111, test_more_time); g_test_add_data_func("/teststk/Send SMS 1.1", &send_sms_data_11, test_send_sms); return g_test_run(); }