summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2010-05-27 06:59:52 +0200
committerDenis Kenzior <denkenz@gmail.com>2010-05-28 11:35:17 -0500
commit27a9d785c4ac9bd833758f39cd764a91b0d4919f (patch)
tree5775ad6e9279c4e7bf6ad2107413681327e3c2e2
parent5af0120c676707f11e6908ae3631c8aebe04accf (diff)
downloadofono-27a9d785c4ac9bd833758f39cd764a91b0d4919f.tar.bz2
stkutil: Add the Run AT Command response builder
-rw-r--r--src/stkutil.c29
-rw-r--r--src/stkutil.h5
2 files changed, 34 insertions, 0 deletions
diff --git a/src/stkutil.c b/src/stkutil.c
index 1f639ab0..c3a5612d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3604,6 +3604,28 @@ static gboolean build_dataobj_datetime_timezone(struct stk_tlv_builder *tlv,
stk_tlv_builder_close_container(tlv);
}
+/* Described in TS 102.223 Section 8.41 */
+static gboolean build_dataobj_at_response(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ unsigned char tag = STK_DATA_OBJECT_TYPE_AT_RESPONSE;
+ int len;
+
+ if (data == NULL)
+ return TRUE;
+
+ /* "If the AT Response string is longer than the maximum length
+ * capable of being transmitted to the UICC then the AT Response
+ * string shall be truncated to this length by the terminal." */
+ len = strlen(data);
+ if (len > 240) /* Safe pick */
+ len = 240;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, TRUE) &&
+ stk_tlv_builder_append_bytes(tlv, data, len) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
/* Described in TS 102.223 Section 8.45 */
static gboolean build_dataobj_language(struct stk_tlv_builder *tlv,
const void *data, gboolean cr)
@@ -4053,6 +4075,13 @@ unsigned int stk_pdu_from_response(const struct stk_response *response,
break;
case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT:
break;
+ case STK_COMMAND_TYPE_RUN_AT_COMMAND:
+ ok = build_dataobj(&builder,
+ build_dataobj_at_response,
+ DATAOBJ_FLAG_CR,
+ response->run_at_command.at_response,
+ NULL);
+ break;
default:
return 0;
};
diff --git a/src/stkutil.h b/src/stkutil.h
index 8c1b0db9..ac462e0e 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -1135,6 +1135,10 @@ struct stk_response_timer_mgmt {
struct stk_timer_value value;
};
+struct stk_response_run_at_command {
+ const char *at_response;
+};
+
struct stk_response {
unsigned char number;
unsigned char type;
@@ -1159,6 +1163,7 @@ struct stk_response {
struct stk_response_generic set_up_event_list;
struct stk_response_timer_mgmt timer_mgmt;
struct stk_response_generic set_up_idle_mode_text;
+ struct stk_response_run_at_command run_at_command;
};
void (*destructor)(struct stk_response *response);