1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.telephony.cat;
18 
19 
20 /**
21  * Enumeration for the return code in TERMINAL RESPONSE.
22  * To get the actual return code for each enum value, call {@link #value}
23  * method.
24  *
25  * {@hide}
26  */
27 public enum ResultCode {
28 
29     /*
30      * Results '0X' and '1X' indicate that the command has been performed.
31      */
32 
33     /** Command performed successfully */
34     OK(0x00),
35 
36     /** Command performed with partial comprehension */
37     PRFRMD_WITH_PARTIAL_COMPREHENSION(0x01),
38 
39     /** Command performed, with missing information */
40     PRFRMD_WITH_MISSING_INFO(0x02),
41 
42     /** REFRESH performed with additional EFs read */
43     PRFRMD_WITH_ADDITIONAL_EFS_READ(0x03),
44 
45     /**
46      * Command performed successfully, but requested icon could not be
47      * displayed
48      */
49     PRFRMD_ICON_NOT_DISPLAYED(0x04),
50 
51     /** Command performed, but modified by call control by NAA */
52     PRFRMD_MODIFIED_BY_NAA(0x05),
53 
54     /** Command performed successfully, limited service */
55     PRFRMD_LIMITED_SERVICE(0x06),
56 
57     /** Command performed with modification */
58     PRFRMD_WITH_MODIFICATION(0x07),
59 
60     /** REFRESH performed but indicated NAA was not active */
61     PRFRMD_NAA_NOT_ACTIVE(0x08),
62 
63     /** Command performed successfully, tone not played */
64     PRFRMD_TONE_NOT_PLAYED(0x09),
65 
66     /** Proactive UICC session terminated by the user */
67     UICC_SESSION_TERM_BY_USER(0x10),
68 
69     /** Backward move in the proactive UICC session requested by the user */
70     BACKWARD_MOVE_BY_USER(0x11),
71 
72     /** No response from user */
73     NO_RESPONSE_FROM_USER(0x12),
74 
75     /** Help information required by the user */
76     HELP_INFO_REQUIRED(0x13),
77 
78     /** USSD or SS transaction terminated by the user */
79     USSD_SS_SESSION_TERM_BY_USER(0x14),
80 
81 
82     /*
83      * Results '2X' indicate to the UICC that it may be worth re-trying the
84      * command at a later opportunity.
85      */
86 
87     /** Terminal currently unable to process command */
88     TERMINAL_CRNTLY_UNABLE_TO_PROCESS(0x20),
89 
90     /** Network currently unable to process command */
91     NETWORK_CRNTLY_UNABLE_TO_PROCESS(0x21),
92 
93     /** User did not accept the proactive command */
94     USER_NOT_ACCEPT(0x22),
95 
96     /** User cleared down call before connection or network release */
97     USER_CLEAR_DOWN_CALL(0x23),
98 
99     /** Action in contradiction with the current timer state */
100     CONTRADICTION_WITH_TIMER(0x24),
101 
102     /** Interaction with call control by NAA, temporary problem */
103     NAA_CALL_CONTROL_TEMPORARY(0x25),
104 
105     /** Launch browser generic error code */
106     LAUNCH_BROWSER_ERROR(0x26),
107 
108     /** MMS temporary problem. */
109     MMS_TEMPORARY(0x27),
110 
111 
112     /*
113      * Results '3X' indicate that it is not worth the UICC re-trying with an
114      * identical command, as it will only get the same response. However, the
115      * decision to retry lies with the application.
116      */
117 
118     /** Command beyond terminal's capabilities */
119     BEYOND_TERMINAL_CAPABILITY(0x30),
120 
121     /** Command type not understood by terminal */
122     CMD_TYPE_NOT_UNDERSTOOD(0x31),
123 
124     /** Command data not understood by terminal */
125     CMD_DATA_NOT_UNDERSTOOD(0x32),
126 
127     /** Command number not known by terminal */
128     CMD_NUM_NOT_KNOWN(0x33),
129 
130     /** SS Return Error */
131     SS_RETURN_ERROR(0x34),
132 
133     /** SMS RP-ERROR */
134     SMS_RP_ERROR(0x35),
135 
136     /** Error, required values are missing */
137     REQUIRED_VALUES_MISSING(0x36),
138 
139     /** USSD Return Error */
140     USSD_RETURN_ERROR(0x37),
141 
142     /** MultipleCard commands error */
143     MULTI_CARDS_CMD_ERROR(0x38),
144 
145     /**
146      * Interaction with call control by USIM or MO short message control by
147      * USIM, permanent problem
148      */
149     USIM_CALL_CONTROL_PERMANENT(0x39),
150 
151     /** Bearer Independent Protocol error */
152     BIP_ERROR(0x3a),
153 
154     /** Access Technology unable to process command */
155     ACCESS_TECH_UNABLE_TO_PROCESS(0x3b),
156 
157     /** Frames error */
158     FRAMES_ERROR(0x3c),
159 
160     /** MMS Error */
161     MMS_ERROR(0x3d);
162 
163 
164     private int mCode;
165 
ResultCode(int code)166     ResultCode(int code) {
167         mCode = code;
168     }
169 
170     /**
171      * Retrieves the actual result code that this object represents.
172      * @return Actual result code
173      */
value()174     public int value() {
175         return mCode;
176     }
177 
fromInt(int value)178     public static ResultCode fromInt(int value) {
179         for (ResultCode r : ResultCode.values()) {
180             if (r.mCode == value) {
181                 return r;
182             }
183         }
184         return null;
185     }
186 }
187