Refactor: stk result dataobject
authorDenis Kenzior <denkenz@gmail.com>
Fri, 12 Mar 2010 14:19:25 +0000 (08:19 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Tue, 16 Mar 2010 02:02:06 +0000 (21:02 -0500)
src/stkutil.c
src/stkutil.h

index a8c3d80..7655b60 100644 (file)
@@ -246,7 +246,7 @@ static gboolean parse_dataobj_response_len(struct comprehension_tlv_iter *iter,
 
 /* Defined in TS 102.223 Section 8.12 */
 static gboolean parse_dataobj_result(struct comprehension_tlv_iter *iter,
-                                               void *user)
+                                       void *user)
 {
        struct stk_result *result = user;
        const unsigned char *data;
@@ -268,7 +268,7 @@ static gboolean parse_dataobj_result(struct comprehension_tlv_iter *iter,
                                (data[0] == 0x3c) || (data[0] == 0x3d)))
                return FALSE;
 
-       result->general = data[0];
+       result->type = data[0];
        result->additional_len = len - 1;
        result->additional = g_malloc(len-1);
        memcpy(result->additional, data+1, len-1);
index 9b3464e..116fe77 100644 (file)
@@ -192,6 +192,47 @@ enum stk_duration_type {
        STK_DURATION_TYPE_SECOND_TENTHS = 0x02,
 };
 
+/* Defined according to TS 102.223 Section 8.12 */
+enum stk_result_type {
+       /* 0x00 to 0x1F are used to indicate that command has been performed */
+       STK_RESULT_TYPE_SUCCESS = 0x00,
+       STK_RESULT_TYPE_PARTIAL = 0x01,
+       STK_RESULT_TYPE_MISSING_INFO = 0x02,
+       STK_RESULT_TYPE_REFRESH_WITH_EFS = 0x03,
+       STK_RESULT_TYPE_NO_ICON = 0x04,
+       STK_RESULT_TYPE_CALL_CONTROL = 0x05,
+       STK_RESULT_TYPE_NO_SERVICE = 0x06,
+       STK_RESULT_TYPE_MODIFED = 0x07,
+       STK_RESULT_TYPE_REFRES_NO_NAA = 0x08,
+       STK_RESULT_TYPE_NO_TONE = 0x09,
+       STK_RESULT_TYPE_USER_TERMINATED = 0x10,
+       STK_RESULT_TYPE_GO_BACK = 0x11,
+       STK_RESULT_TYPE_NO_RESPONSE = 0x12,
+       STK_RESULT_TYPE_HELP_REQUESTED = 0x13,
+
+       /* 0x20 to 0x2F are used to indicate that SIM should retry */
+       STK_RESULT_TYPE_TERMINAL_BUSY = 0x20,
+       STK_RESULT_TYPE_NETWORK_UNAVAILABLE = 0x21,
+       STK_RESULT_TYPE_USER_REJECT = 0x22,
+       STK_RESULT_TYPE_USER_CANCEL = 0x23,
+       STK_RESULT_TYPE_TIMER_CONFLICT = 0x24,
+       STK_RESULT_TYPE_CALL_CONTROL_TEMPORARY = 0x25,
+       STK_RESULT_TYPE_BROWSER_TEMPORARY = 0x26,
+       STK_RESULT_TYPE_MMS_TEMPORARY = 0x27,
+
+       /* 0x30 to 0x3F are used to indicate permanent problems */
+       STK_RESULT_TYPE_NOT_CAPABLE = 0x30,
+       STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD = 0x31,
+       STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD = 0x32,
+       STK_RESULT_TYPE_COMMAND_ID_UNKNOWN = 0x33,
+       STK_RESULT_TYPE_MINIMUM_NOT_MET = 0x36,
+       STK_RESULT_TYPE_CALL_CONTROL_PERMANENT = 0x39,
+       STK_RESULT_TYPE_BIP_ERROR = 0x3A,
+       STK_RESULT_TYPE_ACCESS_TECHNOLOGY_ERROR = 0x3B,
+       STK_RESULT_TYPE_FRAMES_ERROR = 0x3C,
+       STK_RESULT_TYPE_MMS_ERROR = 0x3D,
+};
+
 /* Defined in TS 102.223 Section 8.1 */
 struct stk_address {
        unsigned char ton_npi;
@@ -268,7 +309,7 @@ struct stk_response_length {
 
 /* Defined in TS 102.223 Section 8.12 */
 struct stk_result {
-       unsigned char general;
+       enum stk_result_type type;
        unsigned int additional_len;
        unsigned char *additional;
 };