1 /*
2  * Copyright (C) 2017 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 android.telephony;
18 
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 import android.annotation.TestApi;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Contains access network related constants.
28  */
29 public final class AccessNetworkConstants {
30 
31     /**
32      * Wireless transportation type
33      *
34      * @hide */
35     @Retention(RetentionPolicy.SOURCE)
36     @IntDef(prefix = {"TRANSPORT_TYPE_"},
37             value = {
38                     TRANSPORT_TYPE_INVALID,
39                     TRANSPORT_TYPE_WWAN,
40                     TRANSPORT_TYPE_WLAN})
41     public @interface TransportType {}
42 
43     /**
44      * Invalid transport type
45      * @hide
46      */
47     @SystemApi
48     public static final int TRANSPORT_TYPE_INVALID = -1;
49 
50     /**
51      * Transport type for Wireless Wide Area Networks (i.e. Cellular)
52      * @hide
53      */
54     @SystemApi
55     @TestApi
56     public static final int TRANSPORT_TYPE_WWAN = 1;
57 
58     /**
59      * Transport type for Wireless Local Area Networks (i.e. Wifi)
60      * @hide
61      */
62     @SystemApi
63     @TestApi
64     public static final int TRANSPORT_TYPE_WLAN = 2;
65 
66     /** @hide */
transportTypeToString(@ransportType int transportType)67     public static String transportTypeToString(@TransportType int transportType) {
68         switch (transportType) {
69             case TRANSPORT_TYPE_WWAN: return "WWAN";
70             case TRANSPORT_TYPE_WLAN: return "WLAN";
71             default: return Integer.toString(transportType);
72         }
73     }
74 
75     public static final class AccessNetworkType {
76         public static final int UNKNOWN = 0;
77         public static final int GERAN = 1;
78         public static final int UTRAN = 2;
79         public static final int EUTRAN = 3;
80         public static final int CDMA2000 = 4;
81         public static final int IWLAN = 5;
82 
83         /** @hide */
AccessNetworkType()84         private AccessNetworkType() {}
85 
86         /** @hide */
toString(int type)87         public static String toString(int type) {
88             switch (type) {
89                 case UNKNOWN: return "UNKNOWN";
90                 case GERAN: return "GERAN";
91                 case UTRAN: return "UTRAN";
92                 case EUTRAN: return "EUTRAN";
93                 case CDMA2000: return "CDMA2000";
94                 case IWLAN: return "IWLAN";
95                 default: return Integer.toString(type);
96             }
97         }
98     }
99 
100     /**
101      * Frequency bands for GERAN.
102      * http://www.etsi.org/deliver/etsi_ts/145000_145099/145005/14.00.00_60/ts_145005v140000p.pdf
103      */
104     public static final class GeranBand {
105         public static final int BAND_T380 = 1;
106         public static final int BAND_T410 = 2;
107         public static final int BAND_450 = 3;
108         public static final int BAND_480 = 4;
109         public static final int BAND_710 = 5;
110         public static final int BAND_750 = 6;
111         public static final int BAND_T810 = 7;
112         public static final int BAND_850 = 8;
113         public static final int BAND_P900 = 9;
114         public static final int BAND_E900 = 10;
115         public static final int BAND_R900 = 11;
116         public static final int BAND_DCS1800 = 12;
117         public static final int BAND_PCS1900 = 13;
118         public static final int BAND_ER900 = 14;
119 
120         /** @hide */
GeranBand()121         private GeranBand() {};
122     }
123 
124     /**
125      * Frenquency bands for UTRAN.
126      * http://www.etsi.org/deliver/etsi_ts/125100_125199/125104/13.03.00_60/ts_125104v130p.pdf
127      */
128     public static final class UtranBand {
129         public static final int BAND_1 = 1;
130         public static final int BAND_2 = 2;
131         public static final int BAND_3 = 3;
132         public static final int BAND_4 = 4;
133         public static final int BAND_5 = 5;
134         public static final int BAND_6 = 6;
135         public static final int BAND_7 = 7;
136         public static final int BAND_8 = 8;
137         public static final int BAND_9 = 9;
138         public static final int BAND_10 = 10;
139         public static final int BAND_11 = 11;
140         public static final int BAND_12 = 12;
141         public static final int BAND_13 = 13;
142         public static final int BAND_14 = 14;
143         /** band 15, 16, 17, 18 are reserved */
144         public static final int BAND_19 = 19;
145         public static final int BAND_20 = 20;
146         public static final int BAND_21 = 21;
147         public static final int BAND_22 = 22;
148         /** band 23, 24 are reserved */
149         public static final int BAND_25 = 25;
150         public static final int BAND_26 = 26;
151 
152         /** @hide */
UtranBand()153         private UtranBand() {};
154     }
155 
156     /**
157      * Frenquency bands for EUTRAN.
158      * http://www.etsi.org/deliver/etsi_ts/136100_136199/136101/14.03.00_60/ts_136101v140p.pdf
159      */
160     public static final class EutranBand {
161         public static final int BAND_1 = 1;
162         public static final int BAND_2 = 2;
163         public static final int BAND_3 = 3;
164         public static final int BAND_4 = 4;
165         public static final int BAND_5 = 5;
166         public static final int BAND_6 = 6;
167         public static final int BAND_7 = 7;
168         public static final int BAND_8 = 8;
169         public static final int BAND_9 = 9;
170         public static final int BAND_10 = 10;
171         public static final int BAND_11 = 11;
172         public static final int BAND_12 = 12;
173         public static final int BAND_13 = 13;
174         public static final int BAND_14 = 14;
175         public static final int BAND_17 = 17;
176         public static final int BAND_18 = 18;
177         public static final int BAND_19 = 19;
178         public static final int BAND_20 = 20;
179         public static final int BAND_21 = 21;
180         public static final int BAND_22 = 22;
181         public static final int BAND_23 = 23;
182         public static final int BAND_24 = 24;
183         public static final int BAND_25 = 25;
184         public static final int BAND_26 = 26;
185         public static final int BAND_27 = 27;
186         public static final int BAND_28 = 28;
187         public static final int BAND_30 = 30;
188         public static final int BAND_31 = 31;
189         public static final int BAND_33 = 33;
190         public static final int BAND_34 = 34;
191         public static final int BAND_35 = 35;
192         public static final int BAND_36 = 36;
193         public static final int BAND_37 = 37;
194         public static final int BAND_38 = 38;
195         public static final int BAND_39 = 39;
196         public static final int BAND_40 = 40;
197         public static final int BAND_41 = 41;
198         public static final int BAND_42 = 42;
199         public static final int BAND_43 = 43;
200         public static final int BAND_44 = 44;
201         public static final int BAND_45 = 45;
202         public static final int BAND_46 = 46;
203         public static final int BAND_47 = 47;
204         public static final int BAND_48 = 48;
205         public static final int BAND_65 = 65;
206         public static final int BAND_66 = 66;
207         public static final int BAND_68 = 68;
208         public static final int BAND_70 = 70;
209 
210         /** @hide */
EutranBand()211         private EutranBand() {};
212     }
213 
214     /**
215      * Frenquency bands for CDMA2000.
216      * http://www.3gpp2.org/Public_html/Specs/C.S0057-E_v1.0_Bandclass_Specification.pdf
217      * @hide
218      *
219      * TODO(yinxu): Check with the nexus team about the definition of CDMA bands.
220      */
221     public static final class CdmaBands {
222         public static final int BAND_0 = 1;
223         public static final int BAND_1 = 2;
224         public static final int BAND_2 = 3;
225         public static final int BAND_3 = 4;
226         public static final int BAND_4 = 5;
227         public static final int BAND_5 = 6;
228         public static final int BAND_6 = 7;
229         public static final int BAND_7 = 8;
230         public static final int BAND_8 = 9;
231         public static final int BAND_9 = 10;
232         public static final int BAND_10 = 11;
233         public static final int BAND_11 = 12;
234         public static final int BAND_12 = 13;
235         public static final int BAND_13 = 14;
236         public static final int BAND_14 = 15;
237         public static final int BAND_15 = 16;
238         public static final int BAND_16 = 17;
239         public static final int BAND_17 = 18;
240         public static final int BAND_18 = 19;
241         public static final int BAND_19 = 20;
242         public static final int BAND_20 = 21;
243         public static final int BAND_21 = 22;
244 
245         /** @hide */
CdmaBands()246         private CdmaBands() {};
247     }
248 
249     /** @hide */
AccessNetworkConstants()250     private AccessNetworkConstants() {};
251 }
252