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 import android.compat.annotation.UnsupportedAppUsage;
20 
21 
22 /**
23  * Enumeration for the return code in TERMINAL RESPONSE.
24  * To get the actual return code for each enum value, call {@link #value}
25  * method.
26  *
27  * {@hide}
28  */
29 @UnsupportedAppUsage(implicitMember = "values()[Lcom/android/internal/telephony/cat/ResultCode;")
30 public enum ResultCode {
31 
32     /*
33      * Results '0X' and '1X' indicate that the command has been performed.
34      */
35 
36     /** Command performed successfully */
37     @UnsupportedAppUsage
38     OK(0x00),
39 
40     /** Command performed with partial comprehension */
41     @UnsupportedAppUsage
42     PRFRMD_WITH_PARTIAL_COMPREHENSION(0x01),
43 
44     /** Command performed, with missing information */
45     @UnsupportedAppUsage
46     PRFRMD_WITH_MISSING_INFO(0x02),
47 
48     /** REFRESH performed with additional EFs read */
49     @UnsupportedAppUsage
50     PRFRMD_WITH_ADDITIONAL_EFS_READ(0x03),
51 
52     /**
53      * Command performed successfully, but requested icon could not be
54      * displayed
55      */
56     @UnsupportedAppUsage
57     PRFRMD_ICON_NOT_DISPLAYED(0x04),
58 
59     /** Command performed, but modified by call control by NAA */
60     @UnsupportedAppUsage
61     PRFRMD_MODIFIED_BY_NAA(0x05),
62 
63     /** Command performed successfully, limited service */
64     @UnsupportedAppUsage
65     PRFRMD_LIMITED_SERVICE(0x06),
66 
67     /** Command performed with modification */
68     @UnsupportedAppUsage
69     PRFRMD_WITH_MODIFICATION(0x07),
70 
71     /** REFRESH performed but indicated NAA was not active */
72     @UnsupportedAppUsage
73     PRFRMD_NAA_NOT_ACTIVE(0x08),
74 
75     /** Command performed successfully, tone not played */
76     @UnsupportedAppUsage
77     PRFRMD_TONE_NOT_PLAYED(0x09),
78 
79     /** Proactive UICC session terminated by the user */
80     @UnsupportedAppUsage
81     UICC_SESSION_TERM_BY_USER(0x10),
82 
83     /** Backward move in the proactive UICC session requested by the user */
84     @UnsupportedAppUsage
85     BACKWARD_MOVE_BY_USER(0x11),
86 
87     /** No response from user */
88     @UnsupportedAppUsage
89     NO_RESPONSE_FROM_USER(0x12),
90 
91     /** Help information required by the user */
92     @UnsupportedAppUsage
93     HELP_INFO_REQUIRED(0x13),
94 
95     /** USSD or SS transaction terminated by the user */
96     USSD_SS_SESSION_TERM_BY_USER(0x14),
97 
98 
99     /*
100      * Results '2X' indicate to the UICC that it may be worth re-trying the
101      * command at a later opportunity.
102      */
103 
104     /** Terminal currently unable to process command */
105     @UnsupportedAppUsage
106     TERMINAL_CRNTLY_UNABLE_TO_PROCESS(0x20),
107 
108     /** Network currently unable to process command */
109     @UnsupportedAppUsage
110     NETWORK_CRNTLY_UNABLE_TO_PROCESS(0x21),
111 
112     /** User did not accept the proactive command */
113     @UnsupportedAppUsage
114     USER_NOT_ACCEPT(0x22),
115 
116     /** User cleared down call before connection or network release */
117     USER_CLEAR_DOWN_CALL(0x23),
118 
119     /** Action in contradiction with the current timer state */
120     CONTRADICTION_WITH_TIMER(0x24),
121 
122     /** Interaction with call control by NAA, temporary problem */
123     NAA_CALL_CONTROL_TEMPORARY(0x25),
124 
125     /** Launch browser generic error code */
126     @UnsupportedAppUsage
127     LAUNCH_BROWSER_ERROR(0x26),
128 
129     /** MMS temporary problem. */
130     MMS_TEMPORARY(0x27),
131 
132 
133     /*
134      * Results '3X' indicate that it is not worth the UICC re-trying with an
135      * identical command, as it will only get the same response. However, the
136      * decision to retry lies with the application.
137      */
138 
139     /** Command beyond terminal's capabilities */
140     @UnsupportedAppUsage
141     BEYOND_TERMINAL_CAPABILITY(0x30),
142 
143     /** Command type not understood by terminal */
144     CMD_TYPE_NOT_UNDERSTOOD(0x31),
145 
146     /** Command data not understood by terminal */
147     @UnsupportedAppUsage
148     CMD_DATA_NOT_UNDERSTOOD(0x32),
149 
150     /** Command number not known by terminal */
151     CMD_NUM_NOT_KNOWN(0x33),
152 
153     /** SS Return Error */
154     SS_RETURN_ERROR(0x34),
155 
156     /** SMS RP-ERROR */
157     SMS_RP_ERROR(0x35),
158 
159     /** Error, required values are missing */
160     @UnsupportedAppUsage
161     REQUIRED_VALUES_MISSING(0x36),
162 
163     /** USSD Return Error */
164     USSD_RETURN_ERROR(0x37),
165 
166     /** MultipleCard commands error */
167     MULTI_CARDS_CMD_ERROR(0x38),
168 
169     /**
170      * Interaction with call control by USIM or MO short message control by
171      * USIM, permanent problem
172      */
173     @UnsupportedAppUsage
174     USIM_CALL_CONTROL_PERMANENT(0x39),
175 
176     /** Bearer Independent Protocol error */
177     @UnsupportedAppUsage
178     BIP_ERROR(0x3a),
179 
180     /** Access Technology unable to process command */
181     ACCESS_TECH_UNABLE_TO_PROCESS(0x3b),
182 
183     /** Frames error */
184     FRAMES_ERROR(0x3c),
185 
186     /** MMS Error */
187     MMS_ERROR(0x3d);
188 
189 
190     private int mCode;
191 
ResultCode(int code)192     ResultCode(int code) {
193         mCode = code;
194     }
195 
196     /**
197      * Retrieves the actual result code that this object represents.
198      * @return Actual result code
199      */
200     @UnsupportedAppUsage
value()201     public int value() {
202         return mCode;
203     }
204 
fromInt(int value)205     public static ResultCode fromInt(int value) {
206         for (ResultCode r : ResultCode.values()) {
207             if (r.mCode == value) {
208                 return r;
209             }
210         }
211         return null;
212     }
213 }
214