From 8e0484d1d594cf7cfc94e66ff3c521a79b508138 Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Thu, 27 May 2010 06:59:40 +0200 Subject: [PATCH] stkutil: Add Set Up Call response builder --- src/stkutil.c | 37 +++++++++++++++++++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 46 insertions(+) diff --git a/src/stkutil.c b/src/stkutil.c index 2ca5c6ac..c9b9511f 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -3383,6 +3383,20 @@ static gboolean build_dataobj_text(struct stk_tlv_builder *tlv, return stk_tlv_builder_close_container(tlv); } +/* Described in TS 102.223 Section 8.30 */ +static gboolean build_dataobj_cc_requested_action(struct stk_tlv_builder *tlv, + const void *data, gboolean cr) +{ + const struct stk_common_byte_array *action = data; + unsigned char tag = STK_DATA_OBJECT_TYPE_CALL_CONTROL_REQUESTED_ACTION; + + return action->array == NULL || + (stk_tlv_builder_open_container(tlv, cr, tag, FALSE) && + stk_tlv_builder_append_bytes(tlv, + action->array, action->len) && + stk_tlv_builder_close_container(tlv)); +} + static gboolean build_dataobj(struct stk_tlv_builder *tlv, dataobj_writer builder_func, ...) { @@ -3404,6 +3418,26 @@ static gboolean build_dataobj(struct stk_tlv_builder *tlv, return TRUE; } +static gboolean build_set_up_call(struct stk_tlv_builder *builder, + const struct stk_response *response) +{ + if (response->set_up_call.modified_result.cc_modified) + return build_dataobj(builder, + build_dataobj_cc_requested_action, + DATAOBJ_FLAG_CR, + &response->set_up_call.cc_requested_action, + build_dataobj_result, + DATAOBJ_FLAG_CR, + &response->set_up_call.modified_result.result, + NULL); + else + return build_dataobj(builder, + build_dataobj_cc_requested_action, + DATAOBJ_FLAG_CR, + &response->set_up_call.cc_requested_action, + NULL); +} + unsigned int stk_pdu_from_response(const struct stk_response *response, unsigned char *pdu, unsigned int size) { @@ -3495,6 +3529,9 @@ unsigned int stk_pdu_from_response(const struct stk_response *response, &response->select_item.item_id, NULL); break; + case STK_COMMAND_TYPE_SETUP_CALL: + ok = build_set_up_call(&builder, response); + break; default: return 0; }; diff --git a/src/stkutil.h b/src/stkutil.h index b04078f7..3245a90a 100644 --- a/src/stkutil.h +++ b/src/stkutil.h @@ -1069,6 +1069,14 @@ struct stk_response_select_item { unsigned char item_id; }; +struct stk_response_set_up_call { + struct stk_common_byte_array cc_requested_action; + struct { + ofono_bool_t cc_modified; + struct stk_result result; + } modified_result; +}; + struct stk_response { unsigned char number; unsigned char type; @@ -1087,6 +1095,7 @@ struct stk_response { struct stk_response_generic set_up_menu; struct stk_response_select_item select_item; struct stk_response_generic send_sms; + struct stk_response_set_up_call set_up_call; }; void (*destructor)(struct stk_response *response);