diff options
author | Yang Gu <yang.gu@intel.com> | 2010-04-27 17:47:07 +0800 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-27 09:30:59 -0500 |
commit | 3ae32b6e519c18d4e5d5ee7e716e3065fff30295 (patch) | |
tree | ed39ec81d35516e0c72bc3ecf6e5dd0d0dfee3e3 /src | |
parent | def5c38094f52fe7f597db12ce74c45eca1699ff (diff) | |
download | ofono-3ae32b6e519c18d4e5d5ee7e716e3065fff30295.tar.bz2 |
stkutil: Use struct to represent frame id
Use a field has_id to indicate if we have frame id or not. Originally
we use 0xFF to indicate we don't have frame id. But in that way, we
have to initialize each test case of proactive command when it doesn't
have this comprehension tlv to be 0xFF. To use has_id will save this
effort, and keep consistency with other implementations.
Diffstat (limited to 'src')
-rw-r--r-- | src/stkutil.c | 13 | ||||
-rw-r--r-- | src/stkutil.h | 12 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/stkutil.c b/src/stkutil.c index 33235509..ed48db4f 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -1635,7 +1635,7 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter, static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter, void *user) { - unsigned char *frame_id = user; + struct stk_frame_id *fi = user; const unsigned char *data; if (comprehension_tlv_iter_get_length(iter) != 1) @@ -1646,7 +1646,8 @@ static gboolean parse_dataobj_frame_id(struct comprehension_tlv_iter *iter, if (data[0] >= 0x10) return FALSE; - *frame_id = data[0]; + fi->has_id = TRUE; + fi->id = data[0]; return TRUE; } @@ -2084,8 +2085,6 @@ static gboolean parse_display_text(struct stk_command *command, if (command->dst != STK_DEVICE_IDENTITY_TYPE_DISPLAY) return FALSE; - obj->frame_id = 0xFF; - ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT, DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM, &obj->text, @@ -2126,8 +2125,6 @@ static gboolean parse_get_inkey(struct stk_command *command, if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL) return FALSE; - obj->frame_id = 0xFF; - ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT, DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM, &obj->text, @@ -2162,8 +2159,6 @@ static gboolean parse_get_input(struct stk_command *command, struct stk_command_get_input *obj = &command->get_input; gboolean ret; - obj->frame_id = 0xFF; - if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC) return FALSE; @@ -2207,8 +2202,6 @@ static gboolean parse_send_sms(struct stk_command *command, struct gsm_sms_tpdu tpdu; gboolean ret; - obj->frame_id = 0xFF; - if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC) return FALSE; diff --git a/src/stkutil.h b/src/stkutil.h index 5d2a818f..cbb6442c 100644 --- a/src/stkutil.h +++ b/src/stkutil.h @@ -728,6 +728,12 @@ struct stk_frames_info { unsigned int len; }; +/* Defined in TS 102.223 Section 8.80 */ +struct stk_frame_id { + ofono_bool_t has_id; + unsigned char id; +}; + /* * According to 102.223 Section 8.82 the length of CTLV is 1 byte. This means * that the maximum size is 127 according to the rules of CTLVs. @@ -789,7 +795,7 @@ struct stk_command_display_text { ofono_bool_t immediate_response; struct stk_duration duration; struct stk_text_attribute text_attribute; - unsigned char frame_id; /* Values 0x10 to 0xFF reserved */ + struct stk_frame_id frame_id; }; struct stk_command_get_input { @@ -798,7 +804,7 @@ struct stk_command_get_input { char *default_text; struct stk_icon_id icon_id; struct stk_text_attribute text_attribute; - unsigned char frame_id; /* Values 0x10 to 0xFF reserved */ + struct stk_frame_id frame_id; }; struct stk_command_send_sms { @@ -807,7 +813,7 @@ struct stk_command_send_sms { struct sms gsm_sms; struct stk_icon_id icon_id; struct stk_text_attribute text_attribute; - unsigned char frame_id; /* Values 0x10 to 0xFF reserved */ + struct stk_frame_id frame_id; }; struct stk_command { |