Add parser for item text attribute list objects

This commit is contained in:
Yang Gu 2010-04-21 12:55:56 +08:00 committed by Denis Kenzior
parent 3e5bf2f6bb
commit e374b558a2
2 changed files with 32 additions and 0 deletions

View File

@ -1492,6 +1492,25 @@ static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
return TRUE;
}
/* Defined in TS 102.223 Section 8.73 */
static gboolean parse_dataobj_item_text_attribute_list(
struct comprehension_tlv_iter *iter, void *user)
{
struct stk_item_text_attribute_list *ital = user;
const unsigned char *data;
unsigned int len = comprehension_tlv_iter_get_length(iter);
if ((len > sizeof(ital->list)) || (len % 4 != 0))
return FALSE;
data = comprehension_tlv_iter_get_data(iter);
memcpy(ital->list, data, len);
ital->len = len;
return TRUE;
}
/* Defined in TS 102.223 Section 8.80 */
static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter,
void *user)
@ -1645,6 +1664,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_cdma_sms_tpdu;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_ITEM_TEXT_ATTRIBUTE_LIST:
return parse_dataobj_item_text_attribute_list;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
return parse_dataobj_frame_id;
default:

View File

@ -674,6 +674,17 @@ struct stk_text_attribute {
unsigned char len;
};
/*
* According to 102.223 Section 8.73 the length of CTLV is 1 byte. This means
* that the maximum size is 127 according to the rules of CTLVs. In addition,
* the length should be also the number multiplied by 4, so the maximum number
* is 124.
*/
struct stk_item_text_attribute_list {
unsigned char list[124];
unsigned char len;
};
struct stk_command_display_text {
char *text;
struct stk_icon_id icon_id;