stk: Add parser for setup idle mode text commands
PATCH 1/8 stk: Add parser for setup idle mode text commands
--- src/stkutil.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 8 ++++++++ 2 files changed, 48 insertions(+), 0 deletions(-)
src/stkutil.c +40 -0
@@ -2710,6 +2710,43 @@ static gboolean parse_timer_mgmt(struct stk_command *command,return TRUE; } +static void destroy_setup_idle_mode_text (struct stk_command *command) +{ +g_free (command->setup_idle_mode_text.text); +} + +static gboolean parse_setup_idle_mode_text (struct stk_command *command, +struct comprehension_tlv_iter *iter) +{ +struct stk_command_setup_idle_mode_text *obj = + &command->setup_idle_mode_text; +gboolean ret; + +if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) +return FALSE; + +if (command->dst !=STK_DEVICE_IDENTITY_TYPE_TERMINAL ) +return FALSE; + + ret =parse_dataobj (iter,STK_DATA_OBJECT_TYPE_TEXT , +DATAOBJ_FLAG_MANDATORY |DATAOBJ_FLAG_MINIMUM , + &obj->text, +STK_DATA_OBJECT_TYPE_ICON_ID ,0 , + &obj->icon_id, +STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE ,0 , + &obj->text_attr, +STK_DATA_OBJECT_TYPE_FRAME_ID ,0 , + &obj->frame_id, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) +return FALSE; + + command->destructor = destroy_setup_idle_mode_text; + +return TRUE; +} +struct stk_command *stk_command_new_from_pdu (const unsigned char *pdu,unsigned int len) {
@@ -2825,6 +2862,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,case STK_COMMAND_TYPE_TIMER_MANAGEMENT : ok =parse_timer_mgmt (command, &iter);break ; +case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT : + ok =parse_setup_idle_mode_text (command, &iter); +break ;default : ok = FALSE;break ;
src/stkutil.h +8 -0
@@ -965,6 +965,13 @@ struct stk_command_timer_mgmt {struct stk_timer_value timer_value; }; +struct stk_command_setup_idle_mode_text { +char *text; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; +struct stk_command {unsigned char number;unsigned char type;
@@ -986,6 +993,7 @@ struct stk_command {struct stk_command_setup_event_list setup_event_list;struct stk_command_perform_card_apdu perform_card_apdu;struct stk_command_timer_mgmt timer_mgmt; +struct stk_command_setup_idle_mode_text setup_idle_mode_text; };void (*destructor)(struct stk_command *command);
Signature · 1 line
1.7.0.4
PATCH 2/8 test-stk: Add test for setup idle mode text parser
--- unit/test-stkutil.c | 793 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 793 insertions(+), 0 deletions(-)
unit/test-stkutil.c +793 -0
@@ -9999,6 +9999,724 @@ static void test_timer_mgmt(gconstpointer data)stk_command_free (command); } +struct setup_idle_mode_text_test { +const unsigned char *pdu; +unsigned int pdu_len; +unsigned char qualifier; +char *text; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; + +static unsigned char setup_idle_mode_text_111[] = {0xD0 ,0x1A ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x0F ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 }; + +static unsigned char setup_idle_mode_text_121[] = {0xD0 ,0x18 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x0D ,0x04 , +0x54 ,0x6F ,0x6F ,0x6C ,0x6B , +0x69 ,0x74 ,0x20 ,0x54 ,0x65 , +0x73 ,0x74 }; + +static unsigned char setup_idle_mode_text_131[] = {0xD0 ,0x0B ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x00 }; + +static unsigned char setup_idle_mode_text_171[] = {0xD0 ,0x81 ,0xFD ,0x81 , +0x03 ,0x01 ,0x28 ,0x00 ,0x82 , +0x02 ,0x81 ,0x82 ,0x8D ,0x81 , +0xF1 ,0x00 ,0x54 ,0x74 ,0x19 , +0x34 ,0x4D ,0x36 ,0x41 ,0x73 , +0x74 ,0x98 ,0xCD ,0x06 ,0xCD , +0xEB ,0x70 ,0x38 ,0x3B ,0x0F , +0x0A ,0x83 ,0xE8 ,0x65 ,0x3C , +0x1D ,0x34 ,0xA7 ,0xCB ,0xD3 , +0xEE ,0x33 ,0x0B ,0x74 ,0x47 , +0xA7 ,0xC7 ,0x68 ,0xD0 ,0x1C , +0x1D ,0x66 ,0xB3 ,0x41 ,0xE2 , +0x32 ,0x88 ,0x9C ,0x9E ,0xC3 , +0xD9 ,0xE1 ,0x7C ,0x99 ,0x0C , +0x12 ,0xE7 ,0x41 ,0x74 ,0x74 , +0x19 ,0xD4 ,0x2C ,0x82 ,0xC2 , +0x73 ,0x50 ,0xD8 ,0x0D ,0x4A , +0x93 ,0xD9 ,0x65 ,0x50 ,0xFB , +0x4D ,0x2E ,0x83 ,0xE8 ,0x65 , +0x3C ,0x1D ,0x94 ,0x36 ,0x83 , +0xE8 ,0xE8 ,0x32 ,0xA8 ,0x59 , +0x04 ,0xA5 ,0xE7 ,0xA0 ,0xB0 , +0x98 ,0x5D ,0x06 ,0xD1 ,0xDF , +0x20 ,0xF2 ,0x1B ,0x94 ,0xA6 , +0xBB ,0xA8 ,0xE8 ,0x32 ,0x08 , +0x2E ,0x2F ,0xCF ,0xCB ,0x6E , +0x7A ,0x98 ,0x9E ,0x7E ,0xBB , +0x41 ,0x73 ,0x7A ,0x9E ,0x5D , +0x06 ,0xA5 ,0xE7 ,0x20 ,0x76 , +0xD9 ,0x4C ,0x07 ,0x85 ,0xE7 , +0xA0 ,0xB0 ,0x1B ,0x94 ,0x6E , +0xC3 ,0xD9 ,0xE5 ,0x76 ,0xD9 , +0x4D ,0x0F ,0xD3 ,0xD3 ,0x6F , +0x37 ,0x88 ,0x5C ,0x1E ,0xA7 , +0xE7 ,0xE9 ,0xB7 ,0x1B ,0x44 , +0x7F ,0x83 ,0xE8 ,0xE8 ,0x32 , +0xA8 ,0x59 ,0x04 ,0xB5 ,0xC3 , +0xEE ,0xBA ,0x39 ,0x3C ,0xA6 , +0xD7 ,0xE5 ,0x65 ,0xB9 ,0x0B , +0x44 ,0x45 ,0x97 ,0x41 ,0x69 , +0x32 ,0xBB ,0x0C ,0x6A ,0xBF , +0xC9 ,0x65 ,0x10 ,0xBD ,0x8C , +0xA7 ,0x83 ,0xE6 ,0xE8 ,0x30 , +0x9B ,0x0D ,0x12 ,0x97 ,0x41 , +0xE4 ,0xF4 ,0x1C ,0xCE ,0x0E , +0xE7 ,0xCB ,0x64 ,0x50 ,0xDA , +0x0D ,0x0A ,0x83 ,0xDA ,0x61 , +0xB7 ,0xBB ,0x2C ,0x07 ,0xD1 , +0xD1 ,0x61 ,0x3A ,0xA8 ,0xEC , +0x9E ,0xD7 ,0xE5 ,0xE5 ,0x39 , +0x88 ,0x8E ,0x0E ,0xD3 ,0x41 , +0xEE ,0x32 }; + +static unsigned char setup_idle_mode_text_211[] = {0xD0 ,0x19 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x0A ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x74 ,0x65 ,0x78 ,0x74 ,0x9E , +0x02 ,0x00 ,0x01 }; + +static unsigned char setup_idle_mode_text_221[] = {0xD0 ,0x19 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x0A ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x74 ,0x65 ,0x78 ,0x74 ,0x9E , +0x02 ,0x01 ,0x01 }; + +static unsigned char setup_idle_mode_text_231[] = {0xD0 ,0x19 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x0A ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x74 ,0x65 ,0x78 ,0x74 ,0x9E , +0x02 ,0x00 ,0x02 }; + +static unsigned char setup_idle_mode_text_241[] = {0xD0 ,0x0F ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x00 ,0x9E , +0x02 ,0x01 ,0x01 }; + +static unsigned char setup_idle_mode_text_311[] = {0xD0 ,0x24 ,0x81 ,0x03 , +0x01 ,0x28 ,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 setup_idle_mode_text_411[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_412[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 }; + +static unsigned char setup_idle_mode_text_421[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x01 ,0xB4 }; + +static unsigned char setup_idle_mode_text_422[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 }; + +static unsigned char setup_idle_mode_text_431[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x02 ,0xB4 }; + +static unsigned char setup_idle_mode_text_432[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 }; + +static unsigned char setup_idle_mode_text_441[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x04 ,0xB4 }; + +static unsigned char setup_idle_mode_text_442[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_443[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_451[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x08 ,0xB4 }; + +static unsigned char setup_idle_mode_text_452[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_453[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_461[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x10 ,0xB4 }; + +static unsigned char setup_idle_mode_text_462[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_463[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_471[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x20 ,0xB4 }; + +static unsigned char setup_idle_mode_text_472[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_473[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_481[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x40 ,0xB4 }; + +static unsigned char setup_idle_mode_text_482[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_483[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_491[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x80 ,0xB4 }; + +static unsigned char setup_idle_mode_text_492[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_493[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x33 }; + +static unsigned char setup_idle_mode_text_4101[] = {0xD0 ,0x22 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x31 ,0xD0 ,0x04 ,0x00 ,0x10 , +0x00 ,0xB4 }; + +static unsigned char setup_idle_mode_text_4102[] = {0xD0 ,0x1C ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x11 ,0x04 , +0x49 ,0x64 ,0x6C ,0x65 ,0x20 , +0x4D ,0x6F ,0x64 ,0x65 ,0x20 , +0x54 ,0x65 ,0x78 ,0x74 ,0x20 , +0x32 }; + +static unsigned char setup_idle_mode_text_511[] = {0xD0 ,0x10 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x05 ,0x08 , +0x4F ,0x60 ,0x59 ,0x7D }; + +static unsigned char setup_idle_mode_text_611[] = {0xD0 ,0x14 ,0x81 ,0x03 , +0x01 ,0x28 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 ,0x8D ,0x09 ,0x08 , +0x00 ,0x38 ,0x00 ,0x30 ,0x30 , +0xEB ,0x00 ,0x30 }; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_111 = { + .pdu = setup_idle_mode_text_111, + .pdu_len =sizeof (setup_idle_mode_text_111), + .qualifier =0x00 , + .text ="Idle Mode Text" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_121 = { + .pdu = setup_idle_mode_text_121, + .pdu_len =sizeof (setup_idle_mode_text_121), + .qualifier =0x00 , + .text ="Toolkit Test" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_131 = { + .pdu = setup_idle_mode_text_131, + .pdu_len =sizeof (setup_idle_mode_text_131), + .qualifier =0x00 +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_171 = { + .pdu = setup_idle_mode_text_171, + .pdu_len =sizeof (setup_idle_mode_text_171), + .qualifier =0x00 , + .text ="The SIM shall supply a text string, which shall be displayed " +"by the ME as an idle mode text if the ME is able to do it." +"The presentation style is left as an implementation decision " +"to the ME manufacturer. The idle mode text shall be displayed " +"in a manner that ensures that ne" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_211 = { + .pdu = setup_idle_mode_text_211, + .pdu_len =sizeof (setup_idle_mode_text_211), + .qualifier =0x00 , + .text ="Idle text" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_221 = { + .pdu = setup_idle_mode_text_221, + .pdu_len =sizeof (setup_idle_mode_text_221), + .qualifier =0x00 , + .text ="Idle text" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_231 = { + .pdu = setup_idle_mode_text_231, + .pdu_len =sizeof (setup_idle_mode_text_231), + .qualifier =0x00 , + .text ="Idle text" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x02 + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_241 = { + .pdu = setup_idle_mode_text_241, + .pdu_len =sizeof (setup_idle_mode_text_241), + .qualifier =0x00 , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_311 = { + .pdu = setup_idle_mode_text_311, + .pdu_len =sizeof (setup_idle_mode_text_311), + .qualifier =0x00 , + .text ="ЗДРАВСТВУЙТЕ" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_411 = { + .pdu = setup_idle_mode_text_411, + .pdu_len =sizeof (setup_idle_mode_text_411), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_412 = { + .pdu = setup_idle_mode_text_412, + .pdu_len =sizeof (setup_idle_mode_text_412), + .qualifier =0x00 , + .text ="Idle Mode Text 2" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_421 = { + .pdu = setup_idle_mode_text_421, + .pdu_len =sizeof (setup_idle_mode_text_421), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x01 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_422 = { + .pdu = setup_idle_mode_text_422, + .pdu_len =sizeof (setup_idle_mode_text_422), + .qualifier =0x00 , + .text ="Idle Mode Text 2" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_431 = { + .pdu = setup_idle_mode_text_431, + .pdu_len =sizeof (setup_idle_mode_text_431), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x02 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_432 = { + .pdu = setup_idle_mode_text_432, + .pdu_len =sizeof (setup_idle_mode_text_432), + .qualifier =0x00 , + .text ="Idle Mode Text 2" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_441 = { + .pdu = setup_idle_mode_text_441, + .pdu_len =sizeof (setup_idle_mode_text_441), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x04 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_442 = { + .pdu = setup_idle_mode_text_442, + .pdu_len =sizeof (setup_idle_mode_text_442), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_443 = { + .pdu = setup_idle_mode_text_443, + .pdu_len =sizeof (setup_idle_mode_text_443), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_451 = { + .pdu = setup_idle_mode_text_451, + .pdu_len =sizeof (setup_idle_mode_text_451), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x08 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_452 = { + .pdu = setup_idle_mode_text_452, + .pdu_len =sizeof (setup_idle_mode_text_452), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_453 = { + .pdu = setup_idle_mode_text_453, + .pdu_len =sizeof (setup_idle_mode_text_453), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_461 = { + .pdu = setup_idle_mode_text_461, + .pdu_len =sizeof (setup_idle_mode_text_461), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x10 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_462 = { + .pdu = setup_idle_mode_text_462, + .pdu_len =sizeof (setup_idle_mode_text_462), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_463 = { + .pdu = setup_idle_mode_text_463, + .pdu_len =sizeof (setup_idle_mode_text_463), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_471 = { + .pdu = setup_idle_mode_text_471, + .pdu_len =sizeof (setup_idle_mode_text_471), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x20 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_472 = { + .pdu = setup_idle_mode_text_472, + .pdu_len =sizeof (setup_idle_mode_text_472), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_473 = { + .pdu = setup_idle_mode_text_473, + .pdu_len =sizeof (setup_idle_mode_text_473), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_481 = { + .pdu = setup_idle_mode_text_481, + .pdu_len =sizeof (setup_idle_mode_text_481), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x40 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_482 = { + .pdu = setup_idle_mode_text_482, + .pdu_len =sizeof (setup_idle_mode_text_482), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_483 = { + .pdu = setup_idle_mode_text_483, + .pdu_len =sizeof (setup_idle_mode_text_483), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_491 = { + .pdu = setup_idle_mode_text_491, + .pdu_len =sizeof (setup_idle_mode_text_491), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x80 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_492 = { + .pdu = setup_idle_mode_text_492, + .pdu_len =sizeof (setup_idle_mode_text_492), + .qualifier =0x00 , + .text ="Idle Mode Text 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_493 = { + .pdu = setup_idle_mode_text_493, + .pdu_len =sizeof (setup_idle_mode_text_493), + .qualifier =0x00 , + .text ="Idle Mode Text 3" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_4101 = { + .pdu = setup_idle_mode_text_4101, + .pdu_len =sizeof (setup_idle_mode_text_4101), + .qualifier =0x00 , + .text ="Idle Mode Text 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_4102 = { + .pdu = setup_idle_mode_text_4102, + .pdu_len =sizeof (setup_idle_mode_text_4102), + .qualifier =0x00 , + .text ="Idle Mode Text 2" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_511 = { + .pdu = setup_idle_mode_text_511, + .pdu_len =sizeof (setup_idle_mode_text_511), + .qualifier =0x00 , + .text ="你好" +}; + +static struct setup_idle_mode_text_test setup_idle_mode_text_data_611 = { + .pdu = setup_idle_mode_text_611, + .pdu_len =sizeof (setup_idle_mode_text_611), + .qualifier =0x00 , + .text ="80ル0" +}; + +static void test_setup_idle_mode_text (gconstpointer data) +{ +const struct setup_idle_mode_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_SETUP_IDLE_MODE_TEXT ); +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_text (command->setup_idle_mode_text.text, test->text); +check_icon_id (&command->setup_idle_mode_text.icon_id, &test->icon_id); +check_text_attr (&command->setup_idle_mode_text.text_attr, + &test->text_attr); +check_frame_id (&command->setup_idle_mode_text.frame_id, + &test->frame_id); + +stk_command_free (command); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -10758,5 +11476,80 @@ int main(int argc, char **argv)g_test_add_data_func ("/teststk/Timer Management 2.2.1" , &timer_mgmt_data_221, test_timer_mgmt); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 1.1.1" , + &setup_idle_mode_text_data_111, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 1.2.1" , + &setup_idle_mode_text_data_121, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 1.3.1" , + &setup_idle_mode_text_data_131, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 1.7.1" , + &setup_idle_mode_text_data_171, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 2.1.1" , + &setup_idle_mode_text_data_211, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 2.2.1" , + &setup_idle_mode_text_data_221, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 2.3.1" , + &setup_idle_mode_text_data_231, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 2.4.1" , + &setup_idle_mode_text_data_241, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 3.1.1" , + &setup_idle_mode_text_data_311, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.1.1" , + &setup_idle_mode_text_data_411, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.1.2" , + &setup_idle_mode_text_data_412, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.2.1" , + &setup_idle_mode_text_data_421, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.2.2" , + &setup_idle_mode_text_data_422, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.3.1" , + &setup_idle_mode_text_data_431, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.3.2" , + &setup_idle_mode_text_data_432, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.4.1" , + &setup_idle_mode_text_data_441, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.4.2" , + &setup_idle_mode_text_data_442, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.4.3" , + &setup_idle_mode_text_data_443, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.5.1" , + &setup_idle_mode_text_data_451, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.5.2" , + &setup_idle_mode_text_data_452, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.5.3" , + &setup_idle_mode_text_data_453, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.6.1" , + &setup_idle_mode_text_data_461, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.6.2" , + &setup_idle_mode_text_data_462, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.6.3" , + &setup_idle_mode_text_data_463, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.7.1" , + &setup_idle_mode_text_data_471, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.7.2" , + &setup_idle_mode_text_data_472, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.7.3" , + &setup_idle_mode_text_data_473, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.8.1" , + &setup_idle_mode_text_data_481, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.8.2" , + &setup_idle_mode_text_data_482, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.8.3" , + &setup_idle_mode_text_data_483, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.9.1" , + &setup_idle_mode_text_data_491, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.9.2" , + &setup_idle_mode_text_data_492, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.9.3" , + &setup_idle_mode_text_data_493, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.10.1" , + &setup_idle_mode_text_data_4101, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 4.10.2" , + &setup_idle_mode_text_data_4102, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 5.1.1" , + &setup_idle_mode_text_data_511, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Setup Idle Mode Text 6.1.1" , + &setup_idle_mode_text_data_611, test_setup_idle_mode_text); +return g_test_run (); }
Signature · 1 line
1.7.0.4
PATCH 3/8 stk: Add parser for run at command commands
In reply to Yang Gu--- src/stkutil.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 51 insertions(+), 0 deletions(-)
src/stkutil.c +42 -0
@@ -2747,6 +2747,45 @@ static gboolean parse_setup_idle_mode_text(struct stk_command *command,return TRUE; } +static void destroy_run_at_command (struct stk_command *command) +{ +g_free (command->run_at_command.alpha_id); +g_free (command->run_at_command.at_command); +} + +static gboolean parse_run_at_command (struct stk_command *command, +struct comprehension_tlv_iter *iter) +{ +struct stk_command_run_at_command *obj = &command->run_at_command; +gboolean ret; + +if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) +return FALSE; + +if (command->dst !=STK_DEVICE_IDENTITY_TYPE_TERMINAL ) +return FALSE; + + ret =parse_dataobj (iter,STK_DATA_OBJECT_TYPE_ALPHA_ID ,0 , + &obj->alpha_id, +STK_DATA_OBJECT_TYPE_AT_COMMAND , +DATAOBJ_FLAG_MANDATORY |DATAOBJ_FLAG_MINIMUM , + &obj->at_command, +STK_DATA_OBJECT_TYPE_ICON_ID ,0 , + &obj->icon_id, +STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE ,0 , + &obj->text_attr, +STK_DATA_OBJECT_TYPE_FRAME_ID ,0 , + &obj->frame_id, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) +return FALSE; + + command->destructor = destroy_run_at_command; + +return TRUE; +} +struct stk_command *stk_command_new_from_pdu (const unsigned char *pdu,unsigned int len) {
@@ -2865,6 +2904,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT : ok =parse_setup_idle_mode_text (command, &iter);break ; +case STK_COMMAND_TYPE_RUN_AT_COMMAND : + ok =parse_run_at_command (command, &iter); +break ;default : ok = FALSE;break ;
src/stkutil.h +9 -0
@@ -972,6 +972,14 @@ struct stk_command_setup_idle_mode_text {struct stk_frame_id frame_id; }; +struct stk_command_run_at_command { +char *alpha_id; +char *at_command; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; +struct stk_command {unsigned char number;unsigned char type;
@@ -994,6 +1002,7 @@ struct stk_command {struct stk_command_perform_card_apdu perform_card_apdu;struct stk_command_timer_mgmt timer_mgmt;struct stk_command_setup_idle_mode_text setup_idle_mode_text; +struct stk_command_run_at_command run_at_command; };void (*destructor)(struct stk_command *command);
Signature · 1 line
1.7.0.4
PATCH 4/8 test-stk: Add test for run at command parser
In reply to Yang Gu--- unit/test-stkutil.c | 834 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 834 insertions(+), 0 deletions(-)
unit/test-stkutil.c +834 -0
@@ -286,6 +286,12 @@ static inline void check_timer_value(const struct stk_timer_value *command,g_assert (command->second == test->second); } +/* Defined in TS 102.223 Section 8.40 */ +static inline void check_at_command (const char *command,const char *test) +{ +check_common_text (command, test); +} +/* Defined in TS 102.223 Section 8.43 */ static inline void check_imm_resp (const unsigned char command,const unsigned char test)
@@ -10717,6 +10723,759 @@ static void test_setup_idle_mode_text(gconstpointer data)stk_command_free (command); } +struct run_at_command_test { +const unsigned char *pdu; +unsigned int pdu_len; +unsigned char qualifier; +char *alpha_id; +char *at_command; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; + +static unsigned char run_at_command_111[] = {0xD0 ,0x12 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0xA8 ,0x07 ,0x41 ,0x54 , +0x2B ,0x43 ,0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_121[] = {0xD0 ,0x14 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x00 ,0xA8 ,0x07 , +0x41 ,0x54 ,0x2B ,0x43 ,0x47 , +0x4D ,0x49 }; + +static unsigned char run_at_command_131[] = {0xD0 ,0x22 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x0E ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0xA8 ,0x07 ,0x41 , +0x54 ,0x2B ,0x43 ,0x47 ,0x4D , +0x49 }; + +static unsigned char run_at_command_211[] = {0xD0 ,0x22 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x0A ,0x42 ,0x61 , +0x73 ,0x69 ,0x63 ,0x20 ,0x49 , +0x63 ,0x6F ,0x6E ,0xA8 ,0x07 , +0x41 ,0x54 ,0x2B ,0x43 ,0x47 , +0x4D ,0x49 ,0x9E ,0x02 ,0x00 , +0x01 }; + +/* The 12th byte should be 0x85, instead of 0xA8 */ +static unsigned char run_at_command_221[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x0B ,0x43 ,0x6F , +0x6C ,0x6F ,0x75 ,0x72 ,0x20 , +0x49 ,0x63 ,0x6F ,0x6E ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0x9E ,0x02 , +0x00 ,0x02 }; + +static unsigned char run_at_command_231[] = {0xD0 ,0x22 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x0A ,0x42 ,0x61 , +0x73 ,0x69 ,0x63 ,0x20 ,0x49 , +0x63 ,0x6F ,0x6E ,0xA8 ,0x07 , +0x41 ,0x54 ,0x2B ,0x43 ,0x47 , +0x4D ,0x49 ,0x9E ,0x02 ,0x01 , +0x01 }; + +static unsigned char run_at_command_241[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x0B ,0x43 ,0x6F , +0x6C ,0x6F ,0x75 ,0x72 ,0x20 , +0x49 ,0x63 ,0x6F ,0x6E ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0x9E ,0x02 , +0x01 ,0x02 }; + +static unsigned char run_at_command_251[] = {0xD0 ,0x16 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0xA8 ,0x07 ,0x41 ,0x54 , +0x2B ,0x43 ,0x47 ,0x4D ,0x49 , +0x9E ,0x02 ,0x01 ,0x01 }; + +static unsigned char run_at_command_311[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_312[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_321[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x01 ,0xB4 }; + +static unsigned char run_at_command_322[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_331[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x02 ,0xB4 }; + +static unsigned char run_at_command_332[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_341[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x04 ,0xB4 }; + +static unsigned char run_at_command_342[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_343[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_351[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x08 ,0xB4 }; + +static unsigned char run_at_command_352[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_353[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_361[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x10 ,0xB4 }; + +static unsigned char run_at_command_362[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_363[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_371[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x20 ,0xB4 }; + +static unsigned char run_at_command_372[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_373[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_381[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x40 ,0xB4 }; + +static unsigned char run_at_command_382[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_383[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_391[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x80 ,0xB4 }; + +static unsigned char run_at_command_392[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_393[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x33 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +static unsigned char run_at_command_3101[] = {0xD0 ,0x2A ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x31 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 ,0xD0 ,0x04 , +0x00 ,0x10 ,0x00 ,0xB4 }; + +static unsigned char run_at_command_3102[] = {0xD0 ,0x24 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x10 ,0x52 ,0x75 , +0x6E ,0x20 ,0x41 ,0x54 ,0x20 , +0x43 ,0x6F ,0x6D ,0x6D ,0x61 , +0x6E ,0x64 ,0x20 ,0x32 ,0xA8 , +0x07 ,0x41 ,0x54 ,0x2B ,0x43 , +0x47 ,0x4D ,0x49 }; + +/* The 2nd byte (total size) should be 0x2D, instead of 0x21 */ +static unsigned char run_at_command_411[] = {0xD0 ,0x2D ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x19 ,0x80 ,0x04 , +0x17 ,0x04 ,0x14 ,0x04 ,0x20 , +0x04 ,0x10 ,0x04 ,0x12 ,0x04 , +0x21 ,0x04 ,0x22 ,0x04 ,0x12 , +0x04 ,0x23 ,0x04 ,0x19 ,0x04 , +0x22 ,0x04 ,0x15 ,0xA8 ,0x07 , +0x41 ,0x54 ,0x2B ,0x43 ,0x47 , +0x4D ,0x49 }; + +static unsigned char run_at_command_511[] = {0xD0 ,0x19 ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x05 ,0x80 ,0x4F , +0x60 ,0x59 ,0x7D ,0xA8 ,0x07 , +0x41 ,0x54 ,0x2B ,0x43 ,0x47 , +0x4D ,0x49 }; + +static unsigned char run_at_command_611[] = {0xD0 ,0x1B ,0x81 ,0x03 ,0x01 , +0x34 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x85 ,0x07 ,0x80 ,0x00 , +0x38 ,0x00 ,0x30 ,0x30 ,0xEB , +0xA8 ,0x07 ,0x41 ,0x54 ,0x2B , +0x43 ,0x47 ,0x4D ,0x49 }; + +static struct run_at_command_test run_at_command_data_111 = { + .pdu = run_at_command_111, + .pdu_len =sizeof (run_at_command_111), + .qualifier =0x00 , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_121 = { + .pdu = run_at_command_121, + .pdu_len =sizeof (run_at_command_121), + .qualifier =0x00 , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_131 = { + .pdu = run_at_command_131, + .pdu_len =sizeof (run_at_command_131), + .qualifier =0x00 , + .alpha_id ="Run AT Command" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_211 = { + .pdu = run_at_command_211, + .pdu_len =sizeof (run_at_command_211), + .qualifier =0x00 , + .alpha_id ="Basic Icon" , + .at_command ="AT+CGMI" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct run_at_command_test run_at_command_data_221 = { + .pdu = run_at_command_221, + .pdu_len =sizeof (run_at_command_221), + .qualifier =0x00 , + .alpha_id ="Colour Icon" , + .at_command ="AT+CGMI" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x02 + } +}; + +static struct run_at_command_test run_at_command_data_231 = { + .pdu = run_at_command_231, + .pdu_len =sizeof (run_at_command_231), + .qualifier =0x00 , + .alpha_id ="Basic Icon" , + .at_command ="AT+CGMI" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +/* The qualifier of icon_id should be non self-explanatory */ +static struct run_at_command_test run_at_command_data_241 = { + .pdu = run_at_command_241, + .pdu_len =sizeof (run_at_command_241), + .qualifier =0x00 , + .alpha_id ="Colour Icon" , + .at_command ="AT+CGMI" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x02 + } +}; + +static struct run_at_command_test run_at_command_data_251 = { + .pdu = run_at_command_251, + .pdu_len =sizeof (run_at_command_251), + .qualifier =0x00 , + .at_command ="AT+CGMI" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct run_at_command_test run_at_command_data_311 = { + .pdu = run_at_command_311, + .pdu_len =sizeof (run_at_command_311), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_312 = { + .pdu = run_at_command_312, + .pdu_len =sizeof (run_at_command_312), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_321 = { + .pdu = run_at_command_321, + .pdu_len =sizeof (run_at_command_321), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x01 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_322 = { + .pdu = run_at_command_322, + .pdu_len =sizeof (run_at_command_322), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_331 = { + .pdu = run_at_command_331, + .pdu_len =sizeof (run_at_command_331), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x02 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_332 = { + .pdu = run_at_command_332, + .pdu_len =sizeof (run_at_command_332), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_341 = { + .pdu = run_at_command_341, + .pdu_len =sizeof (run_at_command_341), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x04 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_342 = { + .pdu = run_at_command_342, + .pdu_len =sizeof (run_at_command_342), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_343 = { + .pdu = run_at_command_343, + .pdu_len =sizeof (run_at_command_343), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_351 = { + .pdu = run_at_command_351, + .pdu_len =sizeof (run_at_command_351), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x08 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_352 = { + .pdu = run_at_command_352, + .pdu_len =sizeof (run_at_command_352), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_353 = { + .pdu = run_at_command_353, + .pdu_len =sizeof (run_at_command_353), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_361 = { + .pdu = run_at_command_361, + .pdu_len =sizeof (run_at_command_361), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x10 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_362 = { + .pdu = run_at_command_362, + .pdu_len =sizeof (run_at_command_362), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_363 = { + .pdu = run_at_command_363, + .pdu_len =sizeof (run_at_command_363), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_371 = { + .pdu = run_at_command_371, + .pdu_len =sizeof (run_at_command_371), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x20 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_372 = { + .pdu = run_at_command_372, + .pdu_len =sizeof (run_at_command_372), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_373 = { + .pdu = run_at_command_373, + .pdu_len =sizeof (run_at_command_373), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_381 = { + .pdu = run_at_command_381, + .pdu_len =sizeof (run_at_command_381), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x40 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_382 = { + .pdu = run_at_command_382, + .pdu_len =sizeof (run_at_command_382), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_383 = { + .pdu = run_at_command_383, + .pdu_len =sizeof (run_at_command_383), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_391 = { + .pdu = run_at_command_391, + .pdu_len =sizeof (run_at_command_391), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x80 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_392 = { + .pdu = run_at_command_392, + .pdu_len =sizeof (run_at_command_392), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_393 = { + .pdu = run_at_command_393, + .pdu_len =sizeof (run_at_command_393), + .qualifier =0x00 , + .alpha_id ="Run AT Command 3" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_3101 = { + .pdu = run_at_command_3101, + .pdu_len =sizeof (run_at_command_3101), + .qualifier =0x00 , + .alpha_id ="Run AT Command 1" , + .at_command ="AT+CGMI" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x10 ,0x00 ,0xB4 } + } +}; + +static struct run_at_command_test run_at_command_data_3102 = { + .pdu = run_at_command_3102, + .pdu_len =sizeof (run_at_command_3102), + .qualifier =0x00 , + .alpha_id ="Run AT Command 2" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_411 = { + .pdu = run_at_command_411, + .pdu_len =sizeof (run_at_command_411), + .qualifier =0x00 , + .alpha_id ="ЗДРАВСТВУЙТЕ" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_511 = { + .pdu = run_at_command_511, + .pdu_len =sizeof (run_at_command_511), + .qualifier =0x00 , + .alpha_id ="你好" , + .at_command ="AT+CGMI" +}; + +static struct run_at_command_test run_at_command_data_611 = { + .pdu = run_at_command_611, + .pdu_len =sizeof (run_at_command_611), + .qualifier =0x00 , + .alpha_id ="80ル" , + .at_command ="AT+CGMI" +}; + +static void test_run_at_command (gconstpointer data) +{ +const struct run_at_command_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_RUN_AT_COMMAND ); +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->run_at_command.alpha_id, test->alpha_id); +check_at_command (command->run_at_command.at_command, test->at_command); +check_icon_id (&command->run_at_command.icon_id, &test->icon_id); +check_text_attr (&command->run_at_command.text_attr, &test->text_attr); +check_frame_id (&command->run_at_command.frame_id, &test->frame_id); + +stk_command_free (command); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -11551,5 +12310,80 @@ int main(int argc, char **argv)g_test_add_data_func ("/teststk/Setup Idle Mode Text 6.1.1" , &setup_idle_mode_text_data_611, test_setup_idle_mode_text); +g_test_add_data_func ("/teststk/Run At Command 1.1.1" , + &run_at_command_data_111, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 1.2.1" , + &run_at_command_data_121, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 1.3.1" , + &run_at_command_data_131, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 2.1.1" , + &run_at_command_data_211, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 2.2.1" , + &run_at_command_data_221, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 2.3.1" , + &run_at_command_data_231, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 2.4.1" , + &run_at_command_data_241, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 2.5.1" , + &run_at_command_data_251, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.1.1" , + &run_at_command_data_311, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.1.2" , + &run_at_command_data_312, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.2.1" , + &run_at_command_data_321, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.2.2" , + &run_at_command_data_322, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.3.1" , + &run_at_command_data_331, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.3.2" , + &run_at_command_data_332, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.4.1" , + &run_at_command_data_341, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.4.2" , + &run_at_command_data_342, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.4.3" , + &run_at_command_data_343, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.5.1" , + &run_at_command_data_351, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.5.2" , + &run_at_command_data_352, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.5.3" , + &run_at_command_data_353, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.6.1" , + &run_at_command_data_361, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.6.2" , + &run_at_command_data_362, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.6.3" , + &run_at_command_data_363, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.7.1" , + &run_at_command_data_371, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.7.2" , + &run_at_command_data_372, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.7.3" , + &run_at_command_data_373, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.8.1" , + &run_at_command_data_381, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.8.2" , + &run_at_command_data_382, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.8.3" , + &run_at_command_data_383, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.9.1" , + &run_at_command_data_391, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.9.2" , + &run_at_command_data_392, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.9.3" , + &run_at_command_data_393, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.10.1" , + &run_at_command_data_3101, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 3.10.2" , + &run_at_command_data_3102, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 4.1.1" , + &run_at_command_data_411, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 5.1.1" , + &run_at_command_data_511, test_run_at_command); +g_test_add_data_func ("/teststk/Run At Command 6.1.1" , + &run_at_command_data_611, test_run_at_command); +return g_test_run (); }
Signature · 1 line
1.7.0.4
PATCH 5/8 stk: Add parser for send dtmf commands
In reply to Yang Gu--- src/stkutil.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 51 insertions(+), 0 deletions(-)
src/stkutil.c +42 -0
@@ -2786,6 +2786,45 @@ static gboolean parse_run_at_command(struct stk_command *command,return TRUE; } +static void destroy_send_dtmf (struct stk_command *command) +{ +g_free (command->send_dtmf.alpha_id); +g_free (command->send_dtmf.dtmf); +} + +static gboolean parse_send_dtmf (struct stk_command *command, +struct comprehension_tlv_iter *iter) +{ +struct stk_command_send_dtmf *obj = &command->send_dtmf; +gboolean ret; + +if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) +return FALSE; + +if (command->dst !=STK_DEVICE_IDENTITY_TYPE_NETWORK ) +return FALSE; + + ret =parse_dataobj (iter,STK_DATA_OBJECT_TYPE_ALPHA_ID ,0 , + &obj->alpha_id, +STK_DATA_OBJECT_TYPE_DTMF_STRING , +DATAOBJ_FLAG_MANDATORY |DATAOBJ_FLAG_MINIMUM , + &obj->dtmf, +STK_DATA_OBJECT_TYPE_ICON_ID ,0 , + &obj->icon_id, +STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE ,0 , + &obj->text_attr, +STK_DATA_OBJECT_TYPE_FRAME_ID ,0 , + &obj->frame_id, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) +return FALSE; + + command->destructor = destroy_send_dtmf; + +return TRUE; +} +struct stk_command *stk_command_new_from_pdu (const unsigned char *pdu,unsigned int len) {
@@ -2907,6 +2946,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,case STK_COMMAND_TYPE_RUN_AT_COMMAND : ok =parse_run_at_command (command, &iter);break ; +case STK_COMMAND_TYPE_SEND_DTMF : + ok =parse_send_dtmf (command, &iter); +break ;default : ok = FALSE;break ;
src/stkutil.h +9 -0
@@ -980,6 +980,14 @@ struct stk_command_run_at_command {struct stk_frame_id frame_id; }; +struct stk_command_send_dtmf { +char *alpha_id; +char *dtmf; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; +struct stk_command {unsigned char number;unsigned char type;
@@ -1003,6 +1011,7 @@ struct stk_command {struct stk_command_timer_mgmt timer_mgmt;struct stk_command_setup_idle_mode_text setup_idle_mode_text;struct stk_command_run_at_command run_at_command; +struct stk_command_send_dtmf send_dtmf; };void (*destructor)(struct stk_command *command);
Signature · 1 line
1.7.0.4
PATCH 6/8 test-stk: Add test for send dtmf parser
In reply to Yang Gu--- unit/test-stkutil.c | 742 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 742 insertions(+), 0 deletions(-)
unit/test-stkutil.c +742 -0
@@ -299,6 +299,12 @@ static inline void check_imm_resp(const unsigned char command,check_common_byte (command, test); } +/* Defined in TS 102.223 Section 8.44 */ +static inline void check_dtmf_string (const char *command,const char *test) +{ +check_common_text (command, test); +} +/* Defined in TS 102.223 Section 8.60 */ static inline void check_aid (const struct stk_aid *command,const struct stk_aid *test)
@@ -11476,6 +11482,671 @@ static void test_run_at_command(gconstpointer data)stk_command_free (command); } +struct send_dtmf_test { +const unsigned char *pdu; +unsigned int pdu_len; +unsigned char qualifier; +char *alpha_id; +char *dtmf; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +}; + +static unsigned char send_dtmf_111[] = {0xD0 ,0x0D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0xAC ,0x02 ,0xC1 ,0xF2 }; + +static unsigned char send_dtmf_121[] = {0xD0 ,0x1B ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x09 ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0xAC ,0x05 ,0x21 ,0x43 , +0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_131[] = {0xD0 ,0x13 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x00 ,0xAC ,0x06 ,0xC1 , +0xCC ,0xCC ,0xCC ,0xCC ,0x2C }; + +static unsigned char send_dtmf_211[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0A ,0x42 ,0x61 ,0x73 , +0x69 ,0x63 ,0x20 ,0x49 ,0x63 , +0x6F ,0x6E ,0xAC ,0x02 ,0xC1 , +0xF2 ,0x9E ,0x02 ,0x00 ,0x01 }; + +static unsigned char send_dtmf_221[] = {0xD0 ,0x1E ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x43 ,0x6F ,0x6C , +0x6F ,0x75 ,0x72 ,0x20 ,0x49 , +0x63 ,0x6F ,0x6E ,0xAC ,0x02 , +0xC1 ,0xF2 ,0x9E ,0x02 ,0x00 , +0x02 }; + +static unsigned char send_dtmf_231[] = {0xD0 ,0x1C ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x09 ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0xAC ,0x02 ,0xC1 ,0xF2 , +0x9E ,0x02 ,0x01 ,0x01 }; + +static unsigned char send_dtmf_311[] = {0xD0 ,0x28 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x19 ,0x80 ,0x04 ,0x17 , +0x04 ,0x14 ,0x04 ,0x20 ,0x04 , +0x10 ,0x04 ,0x12 ,0x04 ,0x21 , +0x04 ,0x22 ,0x04 ,0x12 ,0x04 , +0x23 ,0x04 ,0x19 ,0x04 ,0x22 , +0x04 ,0x15 ,0xAC ,0x02 ,0xC1 , +0xF2 }; + +static unsigned char send_dtmf_411[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_412[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_421[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x01 , +0xB4 }; + +static unsigned char send_dtmf_422[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_431[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0xB0 ,0x02 , +0xB4 }; + +static unsigned char send_dtmf_432[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_441[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x04 , +0xB4 }; + +static unsigned char send_dtmf_442[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_443[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_451[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x08 , +0xB4 }; + +static unsigned char send_dtmf_452[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_453[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +/* The last 0x00 in spec should be removed. */ +static unsigned char send_dtmf_461[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x10 , +0xB4 }; + +static unsigned char send_dtmf_462[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_463[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_471[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x20 , +0xB4 }; + +static unsigned char send_dtmf_472[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_473[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_481[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x40 , +0xB4 }; + +static unsigned char send_dtmf_482[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_483[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +/* The second to the last should be 0x80 */ +static unsigned char send_dtmf_491[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x80 , +0xB4 }; + +static unsigned char send_dtmf_492[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_493[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x33 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_4101[] = {0xD0 ,0x23 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x31 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 , +0xD0 ,0x04 ,0x00 ,0x0B ,0x00 , +0xB4 }; + +static unsigned char send_dtmf_4102[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x0B ,0x53 ,0x65 ,0x6E , +0x64 ,0x20 ,0x44 ,0x54 ,0x4D , +0x46 ,0x20 ,0x32 ,0xAC ,0x05 , +0x21 ,0x43 ,0x65 ,0x87 ,0x09 }; + +static unsigned char send_dtmf_511[] = {0xD0 ,0x14 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x05 ,0x80 ,0x4F ,0x60 , +0x59 ,0x7D ,0xAC ,0x02 ,0xC1 , +0xF2 }; + +static unsigned char send_dtmf_611[] = {0xD0 ,0x12 ,0x81 ,0x03 ,0x01 ,0x14 , +0x00 ,0x82 ,0x02 ,0x81 ,0x83 , +0x85 ,0x03 ,0x80 ,0x30 ,0xEB , +0xAC ,0x02 ,0xC1 ,0xF2 }; + +static struct send_dtmf_test send_dtmf_data_111 = { + .pdu = send_dtmf_111, + .pdu_len =sizeof (send_dtmf_111), + .qualifier =0x00 , + .dtmf ="1a2" +}; + +static struct send_dtmf_test send_dtmf_data_121 = { + .pdu = send_dtmf_121, + .pdu_len =sizeof (send_dtmf_121), + .qualifier =0x00 , + .alpha_id ="Send DTMF" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_131 = { + .pdu = send_dtmf_131, + .pdu_len =sizeof (send_dtmf_131), + .qualifier =0x00 , + .dtmf ="1aaaaaaaaaa2" +}; + +static struct send_dtmf_test send_dtmf_data_211 = { + .pdu = send_dtmf_211, + .pdu_len =sizeof (send_dtmf_211), + .qualifier =0x00 , + .alpha_id ="Basic Icon" , + .dtmf ="1a2" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct send_dtmf_test send_dtmf_data_221 = { + .pdu = send_dtmf_221, + .pdu_len =sizeof (send_dtmf_221), + .qualifier =0x00 , + .alpha_id ="Colour Icon" , + .dtmf ="1a2" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x02 + } +}; + +static struct send_dtmf_test send_dtmf_data_231 = { + .pdu = send_dtmf_231, + .pdu_len =sizeof (send_dtmf_231), + .qualifier =0x00 , + .alpha_id ="Send DTMF" , + .dtmf ="1a2" , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct send_dtmf_test send_dtmf_data_311 = { + .pdu = send_dtmf_311, + .pdu_len =sizeof (send_dtmf_311), + .qualifier =0x00 , + .alpha_id ="ЗДРАВСТВУЙТЕ" , + .dtmf ="1a2" +}; + +static struct send_dtmf_test send_dtmf_data_411 = { + .pdu = send_dtmf_411, + .pdu_len =sizeof (send_dtmf_411), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_412 = { + .pdu = send_dtmf_412, + .pdu_len =sizeof (send_dtmf_412), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_421 = { + .pdu = send_dtmf_421, + .pdu_len =sizeof (send_dtmf_421), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x01 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_422 = { + .pdu = send_dtmf_422, + .pdu_len =sizeof (send_dtmf_422), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_431 = { + .pdu = send_dtmf_431, + .pdu_len =sizeof (send_dtmf_431), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0xB0 ,0x02 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_432 = { + .pdu = send_dtmf_432, + .pdu_len =sizeof (send_dtmf_432), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_441 = { + .pdu = send_dtmf_441, + .pdu_len =sizeof (send_dtmf_441), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x04 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_442 = { + .pdu = send_dtmf_442, + .pdu_len =sizeof (send_dtmf_442), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_443 = { + .pdu = send_dtmf_443, + .pdu_len =sizeof (send_dtmf_443), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_451 = { + .pdu = send_dtmf_451, + .pdu_len =sizeof (send_dtmf_451), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x08 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_452 = { + .pdu = send_dtmf_452, + .pdu_len =sizeof (send_dtmf_452), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_453 = { + .pdu = send_dtmf_453, + .pdu_len =sizeof (send_dtmf_453), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_461 = { + .pdu = send_dtmf_461, + .pdu_len =sizeof (send_dtmf_461), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x10 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_462 = { + .pdu = send_dtmf_462, + .pdu_len =sizeof (send_dtmf_462), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_463 = { + .pdu = send_dtmf_463, + .pdu_len =sizeof (send_dtmf_463), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_471 = { + .pdu = send_dtmf_471, + .pdu_len =sizeof (send_dtmf_471), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x20 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_472 = { + .pdu = send_dtmf_472, + .pdu_len =sizeof (send_dtmf_472), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_473 = { + .pdu = send_dtmf_473, + .pdu_len =sizeof (send_dtmf_473), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_481 = { + .pdu = send_dtmf_481, + .pdu_len =sizeof (send_dtmf_481), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x40 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_482 = { + .pdu = send_dtmf_482, + .pdu_len =sizeof (send_dtmf_482), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_483 = { + .pdu = send_dtmf_483, + .pdu_len =sizeof (send_dtmf_483), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_491 = { + .pdu = send_dtmf_491, + .pdu_len =sizeof (send_dtmf_491), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x80 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_492 = { + .pdu = send_dtmf_492, + .pdu_len =sizeof (send_dtmf_492), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_493 = { + .pdu = send_dtmf_493, + .pdu_len =sizeof (send_dtmf_493), + .qualifier =0x00 , + .alpha_id ="Send DTMF 3" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_4101 = { + .pdu = send_dtmf_4101, + .pdu_len =sizeof (send_dtmf_4101), + .qualifier =0x00 , + .alpha_id ="Send DTMF 1" , + .dtmf ="1234567890" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0B ,0x00 ,0xB4 } + } +}; + +static struct send_dtmf_test send_dtmf_data_4102 = { + .pdu = send_dtmf_4102, + .pdu_len =sizeof (send_dtmf_4102), + .qualifier =0x00 , + .alpha_id ="Send DTMF 2" , + .dtmf ="1234567890" +}; + +static struct send_dtmf_test send_dtmf_data_511 = { + .pdu = send_dtmf_511, + .pdu_len =sizeof (send_dtmf_511), + .qualifier =0x00 , + .alpha_id ="你好" , + .dtmf ="1a2" +}; + +static struct send_dtmf_test send_dtmf_data_611 = { + .pdu = send_dtmf_611, + .pdu_len =sizeof (send_dtmf_611), + .qualifier =0x00 , + .alpha_id ="ル" , + .dtmf ="1a2" +}; + +static void test_send_dtmf (gconstpointer data) +{ +const struct send_dtmf_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_SEND_DTMF ); +g_assert (command->qualifier == test->qualifier); + +g_assert (command->src ==STK_DEVICE_IDENTITY_TYPE_UICC ); +g_assert (command->dst ==STK_DEVICE_IDENTITY_TYPE_NETWORK ); + +check_alpha_id (command->send_dtmf.alpha_id, test->alpha_id); +check_dtmf_string (command->send_dtmf.dtmf, test->dtmf); +check_icon_id (&command->send_dtmf.icon_id, &test->icon_id); +check_text_attr (&command->send_dtmf.text_attr, &test->text_attr); +check_frame_id (&command->send_dtmf.frame_id, &test->frame_id); + +stk_command_free (command); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -12385,5 +13056,76 @@ int main(int argc, char **argv)g_test_add_data_func ("/teststk/Run At Command 6.1.1" , &run_at_command_data_611, test_run_at_command); +g_test_add_data_func ("/teststk/Send DTMF 1.1.1" , + &send_dtmf_data_111, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 1.2.1" , + &send_dtmf_data_121, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 1.3.1" , + &send_dtmf_data_131, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 2.1.1" , + &send_dtmf_data_211, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 2.2.1" , + &send_dtmf_data_221, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 2.3.1" , + &send_dtmf_data_231, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 3.1.1" , + &send_dtmf_data_311, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.1.1" , + &send_dtmf_data_411, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.1.2" , + &send_dtmf_data_412, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.2.1" , + &send_dtmf_data_421, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.2.2" , + &send_dtmf_data_422, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.3.1" , + &send_dtmf_data_431, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.3.2" , + &send_dtmf_data_432, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.4.1" , + &send_dtmf_data_441, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.4.2" , + &send_dtmf_data_442, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.4.3" , + &send_dtmf_data_443, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.5.1" , + &send_dtmf_data_451, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.5.2" , + &send_dtmf_data_452, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.5.3" , + &send_dtmf_data_453, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.6.1" , + &send_dtmf_data_461, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.6.2" , + &send_dtmf_data_462, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.6.3" , + &send_dtmf_data_463, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.7.1" , + &send_dtmf_data_471, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.7.2" , + &send_dtmf_data_472, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.7.3" , + &send_dtmf_data_473, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.8.1" , + &send_dtmf_data_481, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.8.2" , + &send_dtmf_data_482, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.8.3" , + &send_dtmf_data_483, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.9.1" , + &send_dtmf_data_491, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.9.2" , + &send_dtmf_data_492, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.9.3" , + &send_dtmf_data_493, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.10.1" , + &send_dtmf_data_4101, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 4.10.2" , + &send_dtmf_data_4102, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 5.1.1" , + &send_dtmf_data_511, test_send_dtmf); +g_test_add_data_func ("/teststk/Send DTMF 6.1.1" , + &send_dtmf_data_611, test_send_dtmf); +return g_test_run (); }
Signature · 1 line
1.7.0.4
PATCH 7/8 stk: Add parser for language notification commands
In reply to Yang Gu--- src/stkutil.c | 26 ++++++++++++++++++++++++++ src/stkutil.h | 5 +++++ 2 files changed, 31 insertions(+), 0 deletions(-)
src/stkutil.c +26 -0
@@ -2825,6 +2825,29 @@ static gboolean parse_send_dtmf(struct stk_command *command,return TRUE; } +static gboolean parse_language_notification (struct stk_command *command, +struct comprehension_tlv_iter *iter) +{ +struct stk_command_language_notification *obj = + &command->language_notification; +gboolean ret; + +if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) +return FALSE; + +if (command->dst !=STK_DEVICE_IDENTITY_TYPE_TERMINAL ) +return FALSE; + + ret =parse_dataobj (iter,STK_DATA_OBJECT_TYPE_LANGUAGE ,0 , + &obj->language, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) +return FALSE; + +return TRUE; +} +struct stk_command *stk_command_new_from_pdu (const unsigned char *pdu,unsigned int len) {
@@ -2949,6 +2972,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,case STK_COMMAND_TYPE_SEND_DTMF : ok =parse_send_dtmf (command, &iter);break ; +case STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION : + ok =parse_language_notification (command, &iter); +break ;default : ok = FALSE;break ;
src/stkutil.h +5 -0
@@ -988,6 +988,10 @@ struct stk_command_send_dtmf {struct stk_frame_id frame_id; }; +struct stk_command_language_notification { +char language[3 ]; +}; +struct stk_command {unsigned char number;unsigned char type;
@@ -1012,6 +1016,7 @@ struct stk_command {struct stk_command_setup_idle_mode_text setup_idle_mode_text;struct stk_command_run_at_command run_at_command;struct stk_command_send_dtmf send_dtmf; +struct stk_command_language_notification language_notification; };void (*destructor)(struct stk_command *command);
Signature · 1 line
1.7.0.4
PATCH 8/8 teststk: Add test for language notification parser
In reply to Yang Gu--- unit/test-stkutil.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-)
unit/test-stkutil.c +61 -0
@@ -305,6 +305,12 @@ static inline void check_dtmf_string(const char *command, const char *test)check_common_text (command, test); } +/* Defined in TS 102.223 Section 8.45 */ +static inline void check_language (const char *command,const char *test) +{ +check_common_text (command, test); +} +/* Defined in TS 102.223 Section 8.60 */ static inline void check_aid (const struct stk_aid *command,const struct stk_aid *test)
@@ -12147,6 +12153,56 @@ static void test_send_dtmf(gconstpointer data)stk_command_free (command); } +struct language_notification_test { +const unsigned char *pdu; +unsigned int pdu_len; +unsigned char qualifier; +char language[3 ]; +}; + +static unsigned char language_notification_111[] = {0xD0 ,0x0D ,0x81 ,0x03 , +0x01 ,0x35 ,0x01 ,0x82 ,0x02 , +0x81 ,0x82 ,0xAD ,0x02 ,0x73 , +0x65 }; + +static unsigned char language_notification_121[] = {0xD0 ,0x09 ,0x81 ,0x03 , +0x01 ,0x35 ,0x00 ,0x82 ,0x02 , +0x81 ,0x82 }; + +static struct language_notification_test language_notification_data_111 = { + .pdu = language_notification_111, + .pdu_len =sizeof (language_notification_111), + .qualifier =0x01 , + .language ="se" +}; + +static struct language_notification_test language_notification_data_121 = { + .pdu = language_notification_121, + .pdu_len =sizeof (language_notification_121), + .qualifier =0x00 +}; + +static void test_language_notification (gconstpointer data) +{ +const struct language_notification_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_LANGUAGE_NOTIFICATION ); +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_language (command->language_notification.language, test->language); + +stk_command_free (command); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -13127,5 +13183,10 @@ int main(int argc, char **argv)g_test_add_data_func ("/teststk/Send DTMF 6.1.1" , &send_dtmf_data_611, test_send_dtmf); +g_test_add_data_func ("/teststk/Language Notification 1.1.1" , + &language_notification_data_111, test_language_notification); +g_test_add_data_func ("/teststk/Language Notification 1.2.1" , + &language_notification_data_121, test_language_notification); +return g_test_run (); }
Signature · 1 line
1.7.0.4
Hi Yang,
Quoted 4 lines
--- src/stkutil.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 8 ++++++++ 2 files changed, 48 insertions(+), 0 deletions(-)
All 8 patches in this series have been applied.
Thanks,
-Denis