mirror of git://git.sysmocom.de/ofono
stk: Add parser for run at command commands
This commit is contained in:
parent
3af4600368
commit
f21e69c7a8
|
@ -2757,6 +2757,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)
|
||||
{
|
||||
|
@ -2875,6 +2914,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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue