diff options
author | Yang Gu <yang.gu@intel.com> | 2010-05-13 18:48:27 +0800 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-05-13 13:47:22 -0500 |
commit | 783bb70599e29f075321258fef3890c940924980 (patch) | |
tree | 6c45bf31b753bab2b139092d2bb2a53ee1507fae /src | |
parent | 847539b39daa491cdf7e76d5e045ec4b5b8ad5e3 (diff) | |
download | ofono-783bb70599e29f075321258fef3890c940924980.tar.bz2 |
stkutil: Add setup call proactive command parser
Diffstat (limited to 'src')
-rw-r--r-- | src/stkutil.c | 55 | ||||
-rw-r--r-- | src/stkutil.h | 15 |
2 files changed, 70 insertions, 0 deletions
diff --git a/src/stkutil.c b/src/stkutil.c index 9968c83e..315cf6ae 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -2468,6 +2468,58 @@ static gboolean parse_send_sms(struct stk_command *command, return TRUE; } +static void destroy_setup_call(struct stk_command *command) +{ + g_free(command->setup_call.alpha_id_usr_cfm); + g_free(command->setup_call.addr.number); + g_free(command->setup_call.alpha_id_call_setup); +} + +static gboolean parse_setup_call(struct stk_command *command, + struct comprehension_tlv_iter *iter) +{ + struct stk_command_setup_call *obj = &command->setup_call; + 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_usr_cfm, + STK_DATA_OBJECT_TYPE_ADDRESS, + DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM, + &obj->addr, + STK_DATA_OBJECT_TYPE_CCP, 0, + &obj->ccp, + STK_DATA_OBJECT_TYPE_SUBADDRESS, 0, + &obj->subaddr, + STK_DATA_OBJECT_TYPE_DURATION, 0, + &obj->duration, + STK_DATA_OBJECT_TYPE_ICON_ID, 0, + &obj->icon_id_usr_cfm, + STK_DATA_OBJECT_TYPE_ALPHA_ID, 0, + &obj->alpha_id_call_setup, + STK_DATA_OBJECT_TYPE_ICON_ID, 0, + &obj->icon_id_call_setup, + STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0, + &obj->text_attr_usr_cfm, + STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0, + &obj->text_attr_call_setup, + STK_DATA_OBJECT_TYPE_FRAME_ID, 0, + &obj->frame_id, + STK_DATA_OBJECT_TYPE_INVALID); + + if (ret == FALSE) + return FALSE; + + command->destructor = destroy_setup_call; + + return TRUE; +} + struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu, unsigned int len) { @@ -2553,6 +2605,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu, case STK_COMMAND_TYPE_SEND_SMS: ok = parse_send_sms(command, &iter); break; + case STK_COMMAND_TYPE_SETUP_CALL: + ok = parse_setup_call(command, &iter); + break; default: ok = FALSE; break; diff --git a/src/stkutil.h b/src/stkutil.h index 0c9fd500..d0d2486c 100644 --- a/src/stkutil.h +++ b/src/stkutil.h @@ -860,6 +860,20 @@ struct stk_command_send_sms { struct stk_frame_id frame_id; }; +struct stk_command_setup_call { + char *alpha_id_usr_cfm; + struct stk_address addr; + struct stk_ccp ccp; + struct stk_subaddress subaddr; + struct stk_duration duration; + struct stk_icon_id icon_id_usr_cfm; + char *alpha_id_call_setup; + struct stk_icon_id icon_id_call_setup; + struct stk_text_attribute text_attr_usr_cfm; + struct stk_text_attribute text_attr_call_setup; + struct stk_frame_id frame_id; +}; + struct stk_command { unsigned char number; unsigned char type; @@ -876,6 +890,7 @@ struct stk_command { struct stk_command_setup_menu setup_menu; struct stk_command_select_item select_item; struct stk_command_send_sms send_sms; + struct stk_command_setup_call setup_call; }; void (*destructor)(struct stk_command *command); |