stk: Add poll interval proactive command parser

This commit is contained in:
Yang Gu 2010-05-13 18:48:18 +08:00 committed by Denis Kenzior
parent bf7afc6130
commit 5b030c4a19
2 changed files with 33 additions and 0 deletions

View File

@ -2230,6 +2230,31 @@ static gboolean parse_play_tone(struct stk_command *command,
return TRUE;
}
static gboolean parse_poll_interval(struct stk_command *command,
struct comprehension_tlv_iter *iter)
{
struct stk_command_poll_interval *obj = &command->poll_interval;
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_DURATION,
DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
&obj->duration,
STK_DATA_OBJECT_TYPE_INVALID);
if (ret == FALSE)
return FALSE;
command->destructor = NULL;
return TRUE;
}
static void destroy_send_sms(struct stk_command *command)
{
g_free(command->send_sms.alpha_id);
@ -2358,6 +2383,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
case STK_COMMAND_TYPE_PLAY_TONE:
ok = parse_play_tone(command, &iter);
break;
case STK_COMMAND_TYPE_POLL_INTERVAL:
ok = parse_poll_interval(command, &iter);
break;
case STK_COMMAND_TYPE_SEND_SMS:
ok = parse_send_sms(command, &iter);
break;

View File

@ -824,6 +824,10 @@ struct stk_command_play_tone {
struct stk_frame_id frame_id;
};
struct stk_command_poll_interval {
struct stk_duration duration;
};
struct stk_command_send_sms {
char *alpha_id;
struct stk_address address;
@ -847,6 +851,7 @@ struct stk_command {
struct stk_command_get_input get_input;
struct stk_command_play_tone play_tone;
struct stk_command_send_sms send_sms;
struct stk_command_poll_interval poll_interval;
};
void (*destructor)(struct stk_command *command);