summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYang Gu <yang.gu@intel.com>2010-05-10 18:38:48 +0800
committerDenis Kenzior <denkenz@gmail.com>2010-05-11 12:21:51 -0500
commit37c2bc8cf21c4af599421e0a11845fa0aec4cb2f (patch)
tree4a716b258060dd49eba4e109bfee736d9fab7699 /src
parent6e4f5c5122c258fb90ee2198972b0627e6a02ec7 (diff)
downloadofono-37c2bc8cf21c4af599421e0a11845fa0aec4cb2f.tar.bz2
stkutil: Add play tone proactive command parser
Diffstat (limited to 'src')
-rw-r--r--src/stkutil.c42
-rw-r--r--src/stkutil.h10
2 files changed, 52 insertions, 0 deletions
diff --git a/src/stkutil.c b/src/stkutil.c
index 5bddb936..0f0ea347 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2200,6 +2200,45 @@ static gboolean parse_more_time(struct stk_command *command,
return TRUE;
}
+static void destroy_play_tone(struct stk_command *command)
+{
+ g_free(command->play_tone.alpha_id);
+}
+
+static gboolean parse_play_tone(struct stk_command *command,
+ struct comprehension_tlv_iter *iter)
+{
+ struct stk_command_play_tone *obj = &command->play_tone;
+ gboolean ret;
+
+ if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
+ return FALSE;
+
+ if (command->dst != STK_DEVICE_IDENTITY_TYPE_EARPIECE)
+ return FALSE;
+
+ ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_ALPHA_ID, 0,
+ &obj->alpha_id,
+ STK_DATA_OBJECT_TYPE_TONE, 0,
+ &obj->tone,
+ STK_DATA_OBJECT_TYPE_DURATION, 0,
+ &obj->duration,
+ 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_play_tone;
+
+ return TRUE;
+}
+
static void destroy_send_sms(struct stk_command *command)
{
g_free(command->send_sms.alpha_id);
@@ -2317,6 +2356,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
case STK_COMMAND_TYPE_MORE_TIME:
ok = parse_more_time(command, &iter);
break;
+ case STK_COMMAND_TYPE_PLAY_TONE:
+ ok = parse_play_tone(command, &iter);
+ break;
case STK_COMMAND_TYPE_SEND_SMS:
ok = parse_send_sms(command, &iter);
break;
diff --git a/src/stkutil.h b/src/stkutil.h
index 70c6b019..00c001bd 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -815,6 +815,15 @@ struct stk_command_get_input {
struct stk_frame_id frame_id;
};
+struct stk_command_play_tone {
+ char *alpha_id;
+ unsigned char tone;
+ struct stk_duration duration;
+ struct stk_icon_id icon_id;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
struct stk_command_send_sms {
char *alpha_id;
struct stk_address address;
@@ -835,6 +844,7 @@ struct stk_command {
struct stk_command_display_text display_text;
struct stk_command_get_inkey get_inkey;
struct stk_command_get_input get_input;
+ struct stk_command_play_tone play_tone;
struct stk_command_send_sms send_sms;
};