mirror of git://git.sysmocom.de/ofono
Add parser for STK send sms proactive commands
This commit is contained in:
parent
a16f270eb1
commit
e64596f1dc
|
@ -719,6 +719,55 @@ static gboolean parse_get_input(struct stk_command *command,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroy_send_sms(struct stk_command *command)
|
||||||
|
{
|
||||||
|
g_free(command->send_sms.alpha_id);
|
||||||
|
g_free(command->send_sms.address.number);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean parse_send_sms(struct stk_command *command,
|
||||||
|
struct comprehension_tlv_iter *iter)
|
||||||
|
{
|
||||||
|
struct stk_command_send_sms *obj = &command->send_sms;
|
||||||
|
struct gsm_sms_tpdu tpdu;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
obj->frame_id = 0xFF;
|
||||||
|
|
||||||
|
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_ADDRESS, 0,
|
||||||
|
&obj->address,
|
||||||
|
STK_DATA_OBJECT_TYPE_GSM_SMS_TPDU, 0,
|
||||||
|
&tpdu,
|
||||||
|
STK_DATA_OBJECT_TYPE_ICON_ID, 0,
|
||||||
|
&obj->icon_id,
|
||||||
|
STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE, 0,
|
||||||
|
&obj->text_attribute,
|
||||||
|
STK_DATA_OBJECT_TYPE_FRAME_ID, 0,
|
||||||
|
&obj->frame_id,
|
||||||
|
STK_DATA_OBJECT_TYPE_INVALID);
|
||||||
|
|
||||||
|
if (ret == FALSE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
command->destructor = destroy_send_sms;
|
||||||
|
|
||||||
|
if (sms_decode(tpdu.tpdu, tpdu.len, TRUE, tpdu.len, &obj->gsm_sms)
|
||||||
|
== FALSE) {
|
||||||
|
command->destructor(command);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
|
struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
|
@ -789,6 +838,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
|
||||||
case STK_COMMAND_TYPE_GET_INPUT:
|
case STK_COMMAND_TYPE_GET_INPUT:
|
||||||
ok = parse_get_input(command, &iter);
|
ok = parse_get_input(command, &iter);
|
||||||
break;
|
break;
|
||||||
|
case STK_COMMAND_TYPE_SEND_SMS:
|
||||||
|
ok = parse_send_sms(command, &iter);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -342,6 +342,15 @@ struct stk_command_get_input {
|
||||||
unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
|
unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct stk_command_send_sms {
|
||||||
|
char *alpha_id;
|
||||||
|
struct stk_address address;
|
||||||
|
struct sms gsm_sms;
|
||||||
|
struct stk_icon_identifier icon_id;
|
||||||
|
struct stk_text_attribute text_attribute;
|
||||||
|
unsigned char frame_id; /* Values 0x10 to 0xFF reserved */
|
||||||
|
};
|
||||||
|
|
||||||
struct stk_command {
|
struct stk_command {
|
||||||
unsigned char number;
|
unsigned char number;
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
|
@ -353,6 +362,7 @@ struct stk_command {
|
||||||
struct stk_command_display_text display_text;
|
struct stk_command_display_text display_text;
|
||||||
struct stk_command_display_text get_inkey;
|
struct stk_command_display_text get_inkey;
|
||||||
struct stk_command_get_input get_input;
|
struct stk_command_get_input get_input;
|
||||||
|
struct stk_command_send_sms send_sms;
|
||||||
};
|
};
|
||||||
|
|
||||||
void (*destructor)(struct stk_command *command);
|
void (*destructor)(struct stk_command *command);
|
||||||
|
|
Loading…
Reference in New Issue