• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2016 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16from acts.utils import NexusModelNames
17from acts_contrib.test_utils.tel import tel_defines
18
19
20def rat_family_from_rat(rat_type):
21    return _TelTables.technology_tbl[rat_type]['rat_family']
22
23
24def rat_generation_from_rat(rat_type):
25    return _TelTables.technology_tbl[rat_type]['generation']
26
27
28def network_preference_for_generation(generation, operator, phone_type=None):
29    if not phone_type:
30        return _TelTables.operator_network_tbl[operator][generation][
31            'network_preference']
32    else:
33        return _TelTables.operator_network_tbl_by_phone_type[phone_type][
34            generation]['network_preference']
35
36
37def rat_families_for_network_preference(network_preference):
38    return _TelTables.network_preference_tbl[network_preference][
39        'rat_family_list']
40
41
42def rat_family_for_generation(generation, operator, phone_type=None):
43    if not phone_type:
44        return _TelTables.operator_network_tbl[operator][generation][
45            'rat_family']
46    else:
47        return _TelTables.operator_network_tbl_by_phone_type[phone_type][
48            generation]['rat_family']
49
50
51def operator_name_from_plmn_id(plmn_id):
52    return _TelTables.operator_id_to_name[plmn_id]
53
54
55def operator_name_from_network_name(name):
56    return _TelTables.operator_name_tbl.get("name", name)
57
58
59def is_valid_rat(rat_type):
60    return True if rat_type in _TelTables.technology_tbl else False
61
62
63def is_valid_generation(gen):
64    return True if gen in _TelTables.technology_gen_tbl else False
65
66
67def is_rat_svd_capable(rat):
68    return _TelTables.technology_tbl[rat]["simultaneous_voice_data"]
69
70
71def connection_type_from_type_string(input_string):
72    if input_string in _ConnectionTables.connection_type_tbl:
73        return _ConnectionTables.connection_type_tbl[input_string]
74    return tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN
75
76
77def is_user_plane_data_type(connection_type):
78    if connection_type in _ConnectionTables.user_plane_data_type:
79        return _ConnectionTables.user_plane_data_type[connection_type]
80    return False
81
82
83# For TMO, to check if voice mail count is correct after leaving a new voice message.
84def check_tmo_voice_mail_count(voice_mail_count_before,
85                               voice_mail_count_after):
86    return (voice_mail_count_after == -1)
87
88
89# For ATT, to check if voice mail count is correct after leaving a new voice message.
90def check_att_voice_mail_count(voice_mail_count_before,
91                               voice_mail_count_after):
92    return (voice_mail_count_after == (voice_mail_count_before + 1))
93
94
95# For SPT, to check if voice mail count is correct after leaving a new voice message.
96def check_spt_voice_mail_count(voice_mail_count_before,
97                               voice_mail_count_after):
98    return (voice_mail_count_after == (voice_mail_count_before + 1))
99
100
101def get_voice_mail_check_number(operator):
102    return _TelTables.voice_mail_number_tbl.get(operator)
103
104
105def get_voice_mail_count_check_function(operator):
106    return _TelTables.voice_mail_count_check_function_tbl.get(
107        operator, check_tmo_voice_mail_count)
108
109
110def get_voice_mail_delete_digit(operator):
111    return _TelTables.voice_mail_delete_digit_tbl.get(operator, "7")
112
113
114def get_allowable_network_preference(operator, phone_type=None):
115    if not phone_type:
116        return _TelTables.allowable_network_preference_tbl[operator]
117    else:
118        return _TelTables.allowable_network_preference_tbl_by_phone_type[
119            phone_type]
120
121
122class _ConnectionTables():
123    connection_type_tbl = {
124        'WIFI': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
125        'WIFI_P2P': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
126        'MOBILE': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
127        'MOBILE_DUN': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
128        'MOBILE_HIPRI': tel_defines.NETWORK_CONNECTION_TYPE_HIPRI,
129        # TODO: b/26296489 add support for 'MOBILE_SUPL', 'MOBILE_HIPRI',
130        # 'MOBILE_FOTA', 'MOBILE_IMS', 'MOBILE_CBS', 'MOBILE_IA',
131        # 'MOBILE_EMERGENCY'
132        'MOBILE_MMS': tel_defines.NETWORK_CONNECTION_TYPE_MMS
133    }
134
135    user_plane_data_type = {
136        tel_defines.NETWORK_CONNECTION_TYPE_WIFI: True,
137        tel_defines.NETWORK_CONNECTION_TYPE_CELL: False,
138        tel_defines.NETWORK_CONNECTION_TYPE_MMS: False,
139        tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN: False
140    }
141
142
143class _TelTables():
144    # Operator id mapping to operator name
145    # Reference: Pages 43-50 in
146    # https://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.212B-2013-PDF-E.pdf [2013]
147
148    operator_name_tbl = {
149        "T-Mobile": tel_defines.CARRIER_TMO,
150        "AT&T": tel_defines.CARRIER_ATT,
151        "Verizon": tel_defines.CARRIER_VZW,
152        "Verizon Wireless": tel_defines.CARRIER_VZW,
153        "Sprint": tel_defines.CARRIER_SPT,
154        "ROGERS": tel_defines.CARRIER_ROGERS,
155        "Videotron PRTNR1": tel_defines.CARRIER_VIDEOTRON,
156        "Bell": tel_defines.CARRIER_BELL,
157        "Koodo": tel_defines.CARRIER_KOODO,
158        "Ntt Docomo" : tel_defines.CARRIER_NTT_DOCOMO,
159        "KDDI" : tel_defines.CARRIER_KDDI,
160        "Rakuten": tel_defines.CARRIER_RAKUTEN,
161        "SBM": tel_defines.CARRIER_SBM,
162        "SK Telecom": tel_defines.CARRIER_SKT,
163        "KT": tel_defines.CARRIER_KT,
164        "LG U+": tel_defines.CARRIER_LG_UPLUS
165    }
166    operator_id_to_name = {
167
168        #VZW (Verizon Wireless)
169        '310010': tel_defines.CARRIER_VZW,
170        '310012': tel_defines.CARRIER_VZW,
171        '310013': tel_defines.CARRIER_VZW,
172        '310590': tel_defines.CARRIER_VZW,
173        '310890': tel_defines.CARRIER_VZW,
174        '310910': tel_defines.CARRIER_VZW,
175        '310110': tel_defines.CARRIER_VZW,
176        '311270': tel_defines.CARRIER_VZW,
177        '311271': tel_defines.CARRIER_VZW,
178        '311272': tel_defines.CARRIER_VZW,
179        '311273': tel_defines.CARRIER_VZW,
180        '311274': tel_defines.CARRIER_VZW,
181        '311275': tel_defines.CARRIER_VZW,
182        '311276': tel_defines.CARRIER_VZW,
183        '311277': tel_defines.CARRIER_VZW,
184        '311278': tel_defines.CARRIER_VZW,
185        '311279': tel_defines.CARRIER_VZW,
186        '311280': tel_defines.CARRIER_VZW,
187        '311281': tel_defines.CARRIER_VZW,
188        '311282': tel_defines.CARRIER_VZW,
189        '311283': tel_defines.CARRIER_VZW,
190        '311284': tel_defines.CARRIER_VZW,
191        '311285': tel_defines.CARRIER_VZW,
192        '311286': tel_defines.CARRIER_VZW,
193        '311287': tel_defines.CARRIER_VZW,
194        '311288': tel_defines.CARRIER_VZW,
195        '311289': tel_defines.CARRIER_VZW,
196        '311390': tel_defines.CARRIER_VZW,
197        '311480': tel_defines.CARRIER_VZW,
198        '311481': tel_defines.CARRIER_VZW,
199        '311482': tel_defines.CARRIER_VZW,
200        '311483': tel_defines.CARRIER_VZW,
201        '311484': tel_defines.CARRIER_VZW,
202        '311485': tel_defines.CARRIER_VZW,
203        '311486': tel_defines.CARRIER_VZW,
204        '311487': tel_defines.CARRIER_VZW,
205        '311488': tel_defines.CARRIER_VZW,
206        '311489': tel_defines.CARRIER_VZW,
207
208        #TMO (T-Mobile USA)
209        '310160': tel_defines.CARRIER_TMO,
210        '310200': tel_defines.CARRIER_TMO,
211        '310210': tel_defines.CARRIER_TMO,
212        '310220': tel_defines.CARRIER_TMO,
213        '310230': tel_defines.CARRIER_TMO,
214        '310240': tel_defines.CARRIER_TMO,
215        '310250': tel_defines.CARRIER_TMO,
216        '310260': tel_defines.CARRIER_TMO,
217        '310270': tel_defines.CARRIER_TMO,
218        '310310': tel_defines.CARRIER_TMO,
219        '310490': tel_defines.CARRIER_TMO,
220        '310660': tel_defines.CARRIER_TMO,
221        '310800': tel_defines.CARRIER_TMO,
222
223        #ATT (AT&T and Cingular)
224        '310070': tel_defines.CARRIER_ATT,
225        '310560': tel_defines.CARRIER_ATT,
226        '310670': tel_defines.CARRIER_ATT,
227        '310680': tel_defines.CARRIER_ATT,
228        '310150': tel_defines.CARRIER_ATT,  #Cingular
229        '310170': tel_defines.CARRIER_ATT,  #Cingular
230        '310410': tel_defines.CARRIER_ATT,  #Cingular
231        '311180': tel_defines.CARRIER_ATT,
232        #Cingular Licensee Pacific Telesis Mobile Services, LLC
233
234        #Sprint (and Sprint-Nextel)
235        '310120': tel_defines.CARRIER_SPT,
236        '311490': tel_defines.CARRIER_SPT,
237        '311870': tel_defines.CARRIER_SPT,
238        '311880': tel_defines.CARRIER_SPT,
239        '312190': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
240        '316010': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
241        '23433': tel_defines.CARRIER_EEUK,  #Orange
242        '23434': tel_defines.CARRIER_EEUK,  #Orange
243        '23430': tel_defines.CARRIER_EEUK,  #T-Mobile UK
244        '23431': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
245        '23432': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
246        '23415': tel_defines.CARRIER_VFUK,
247
248        # Google Fi
249        '312580': tel_defines.CARRIER_FI,
250
251        #USCC
252        '311580': tel_defines.CARRIER_USCC,
253
254        #Vodafone (Germany)
255        '26202': tel_defines.CARRIER_GMBH,
256        '26204': tel_defines.CARRIER_GMBH,
257        '26209': tel_defines.CARRIER_GMBH,
258        '26242': tel_defines.CARRIER_GMBH,
259        '26243': tel_defines.CARRIER_GMBH,
260
261        #Vodafone (Italy)
262        '22206': tel_defines.CARRIER_ITA,
263        '22210': tel_defines.CARRIER_ITA,
264
265        #Vodafone (Spain)
266        '21401': tel_defines.CARRIER_ESP,
267        '20406': tel_defines.CARRIER_ESP,
268
269        #Orange (France)
270        '20801': tel_defines.CARRIER_ORG,
271        '20802': tel_defines.CARRIER_ORG,
272        '20891': tel_defines.CARRIER_ORG,
273
274        #Telenor (Norway)
275        '24201': tel_defines.CARRIER_TEL,
276        '24212': tel_defines.CARRIER_TEL,
277
278        #Canada Freedom
279        '302490': tel_defines.CARRIER_FRE,
280
281        #Telstra (Australia)
282        '52501': tel_defines.CARRIER_SING,
283        '50501': tel_defines.CARRIER_TSA,
284
285        #KT (South Korea)
286        '45002': tel_defines.CARRIER_KT,
287        '45004': tel_defines.CARRIER_KT,
288        '45008': tel_defines.CARRIER_KT,
289
290        #Softbank (Japan)
291        '44004': tel_defines.CARRIER_SBM,
292        '44006': tel_defines.CARRIER_SBM,
293        '44020': tel_defines.CARRIER_SBM,
294        '44040': tel_defines.CARRIER_SBM,
295        '44041': tel_defines.CARRIER_SBM,
296        '44042': tel_defines.CARRIER_SBM,
297        '44043': tel_defines.CARRIER_SBM,
298        '44044': tel_defines.CARRIER_SBM,
299        '44045': tel_defines.CARRIER_SBM,
300        '44046': tel_defines.CARRIER_SBM,
301        '44047': tel_defines.CARRIER_SBM,
302        '44048': tel_defines.CARRIER_SBM,
303        '44090': tel_defines.CARRIER_SBM,
304        '44092': tel_defines.CARRIER_SBM,
305        '44093': tel_defines.CARRIER_SBM,
306        '44094': tel_defines.CARRIER_SBM,
307        '44095': tel_defines.CARRIER_SBM,
308        '44096': tel_defines.CARRIER_SBM,
309        '44097': tel_defines.CARRIER_SBM,
310        '44098': tel_defines.CARRIER_SBM,
311
312        #SK Telecom (South Korea)
313        '45005': tel_defines.CARRIER_SKT,
314
315        #LG U+ (South Korea)
316        '45006': tel_defines.CARRIER_LG_UPLUS
317    }
318
319    technology_gen_tbl = [
320        tel_defines.GEN_2G, tel_defines.GEN_3G, tel_defines.GEN_4G
321    ]
322
323    technology_tbl = {
324        tel_defines.RAT_1XRTT: {
325            'is_voice_rat': True,
326            'is_data_rat': False,
327            'generation': tel_defines.GEN_3G,
328            'simultaneous_voice_data': False,
329            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
330        },
331        tel_defines.RAT_EDGE: {
332            'is_voice_rat': False,
333            'is_data_rat': True,
334            'generation': tel_defines.GEN_2G,
335            'simultaneous_voice_data': False,
336            'rat_family': tel_defines.RAT_FAMILY_GSM
337        },
338        tel_defines.RAT_GPRS: {
339            'is_voice_rat': False,
340            'is_data_rat': True,
341            'generation': tel_defines.GEN_2G,
342            'simultaneous_voice_data': False,
343            'rat_family': tel_defines.RAT_FAMILY_GSM
344        },
345        tel_defines.RAT_GSM: {
346            'is_voice_rat': True,
347            'is_data_rat': False,
348            'generation': tel_defines.GEN_2G,
349            'simultaneous_voice_data': False,
350            'rat_family': tel_defines.RAT_FAMILY_GSM
351        },
352        tel_defines.RAT_UMTS: {
353            'is_voice_rat': True,
354            'is_data_rat': True,
355            'generation': tel_defines.GEN_3G,
356            'simultaneous_voice_data': True,
357            'rat_family': tel_defines.RAT_FAMILY_WCDMA
358        },
359        tel_defines.RAT_WCDMA: {
360            'is_voice_rat': True,
361            'is_data_rat': True,
362            'generation': tel_defines.GEN_3G,
363            'simultaneous_voice_data': True,
364            'rat_family': tel_defines.RAT_FAMILY_WCDMA
365        },
366        tel_defines.RAT_HSDPA: {
367            'is_voice_rat': False,
368            'is_data_rat': True,
369            'generation': tel_defines.GEN_3G,
370            'simultaneous_voice_data': False,
371            'rat_family': tel_defines.RAT_FAMILY_WCDMA
372        },
373        tel_defines.RAT_HSUPA: {
374            'is_voice_rat': False,
375            'is_data_rat': True,
376            'generation': tel_defines.GEN_3G,
377            'simultaneous_voice_data': False,
378            'rat_family': tel_defines.RAT_FAMILY_WCDMA
379        },
380        tel_defines.RAT_CDMA: {
381            'is_voice_rat': True,
382            'is_data_rat': False,
383            'generation': tel_defines.GEN_2G,
384            'simultaneous_voice_data': False,
385            'rat_family': tel_defines.RAT_FAMILY_CDMA
386        },
387        tel_defines.RAT_EVDO: {
388            'is_voice_rat': False,
389            'is_data_rat': True,
390            'generation': tel_defines.GEN_3G,
391            'simultaneous_voice_data': False,
392            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
393        },
394        tel_defines.RAT_EVDO_0: {
395            'is_voice_rat': False,
396            'is_data_rat': True,
397            'generation': tel_defines.GEN_3G,
398            'simultaneous_voice_data': False,
399            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
400        },
401        tel_defines.RAT_EVDO_A: {
402            'is_voice_rat': False,
403            'is_data_rat': True,
404            'generation': tel_defines.GEN_3G,
405            'simultaneous_voice_data': False,
406            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
407        },
408        tel_defines.RAT_EVDO_B: {
409            'is_voice_rat': False,
410            'is_data_rat': True,
411            'generation': tel_defines.GEN_3G,
412            'simultaneous_voice_data': False,
413            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
414        },
415        tel_defines.RAT_IDEN: {
416            'is_voice_rat': False,
417            'is_data_rat': True,
418            'generation': tel_defines.GEN_2G,
419            'simultaneous_voice_data': False,
420            'rat_family': tel_defines.RAT_FAMILY_IDEN
421        },
422        tel_defines.RAT_LTE_CA: {
423            'is_voice_rat': True,
424            'is_data_rat': True,
425            'generation': tel_defines.GEN_4G,
426            'simultaneous_voice_data': True,
427            'rat_family': tel_defines.RAT_FAMILY_LTE
428        },
429        tel_defines.RAT_LTE: {
430            'is_voice_rat': True,
431            'is_data_rat': True,
432            'generation': tel_defines.GEN_4G,
433            'simultaneous_voice_data': True,
434            'rat_family': tel_defines.RAT_FAMILY_LTE
435        },
436        tel_defines.RAT_NR: {
437            'is_voice_rat': True,
438            'is_data_rat': True,
439            'generation': tel_defines.GEN_5G,
440            'simultaneous_voice_data': True,
441            'rat_family': tel_defines.RAT_FAMILY_NR
442        },
443        tel_defines.RAT_NR_SA: {
444            'is_voice_rat': True,
445            'is_data_rat': True,
446            'generation': tel_defines.GEN_5G,
447            'simultaneous_voice_data': True,
448            'rat_family': tel_defines.RAT_FAMILY_NR
449        },
450        tel_defines.RAT_EHRPD: {
451            'is_voice_rat': False,
452            'is_data_rat': True,
453            'generation': tel_defines.GEN_3G,
454            'simultaneous_voice_data': False,
455            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
456        },
457        tel_defines.RAT_HSPA: {
458            'is_voice_rat': False,
459            'is_data_rat': True,
460            'generation': tel_defines.GEN_3G,
461            'simultaneous_voice_data': True,
462            'rat_family': tel_defines.RAT_FAMILY_WCDMA
463        },
464        tel_defines.RAT_HSPAP: {
465            'is_voice_rat': False,
466            'is_data_rat': True,
467            'generation': tel_defines.GEN_3G,
468            'simultaneous_voice_data': True,
469            'rat_family': tel_defines.RAT_FAMILY_WCDMA
470        },
471        tel_defines.RAT_IWLAN: {
472            'is_voice_rat': True,
473            'is_data_rat': True,
474            'generation': tel_defines.GEN_4G,
475            'simultaneous_voice_data': True,
476            'rat_family': tel_defines.RAT_FAMILY_WLAN
477        },
478        tel_defines.RAT_TD_SCDMA: {
479            'is_voice_rat': True,
480            'is_data_rat': True,
481            'generation': tel_defines.GEN_3G,
482            'simultaneous_voice_data': True,
483            'rat_family': tel_defines.RAT_FAMILY_TDSCDMA
484        },
485        tel_defines.RAT_UNKNOWN: {
486            'is_voice_rat': False,
487            'is_data_rat': False,
488            'generation': tel_defines.GEN_UNKNOWN,
489            'simultaneous_voice_data': False,
490            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
491        },
492        tel_defines.RAT_GLOBAL: {
493            'is_voice_rat': False,
494            'is_data_rat': False,
495            'generation': tel_defines.GEN_UNKNOWN,
496            'simultaneous_voice_data': False,
497            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
498        }
499    }
500
501    network_preference_tbl = {
502        tel_defines.NETWORK_MODE_LTE_GSM_WCDMA: {
503            'rat_family_list': [
504                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
505                tel_defines.RAT_FAMILY_GSM
506            ]
507        },
508        tel_defines.NETWORK_MODE_GSM_UMTS: {
509            'rat_family_list':
510            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
511        },
512        tel_defines.NETWORK_MODE_GSM_ONLY: {
513            'rat_family_list': [tel_defines.RAT_FAMILY_GSM]
514        },
515        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO: {
516            'rat_family_list': [
517                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_CDMA2000,
518                tel_defines.RAT_FAMILY_CDMA
519            ]
520        },
521        tel_defines.NETWORK_MODE_CDMA: {
522            'rat_family_list':
523            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
524        },
525        tel_defines.NETWORK_MODE_CDMA_NO_EVDO: {
526            'rat_family_list':
527            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
528        },
529        tel_defines.NETWORK_MODE_WCDMA_PREF: {
530            'rat_family_list':
531            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
532        },
533        tel_defines.NETWORK_MODE_WCDMA_ONLY: {
534            'rat_family_list': [tel_defines.RAT_FAMILY_WCDMA]
535        },
536        tel_defines.NETWORK_MODE_EVDO_NO_CDMA: {
537            'rat_family_list': [tel_defines.RAT_FAMILY_CDMA2000]
538        },
539        tel_defines.NETWORK_MODE_GLOBAL: {
540            'rat_family_list': [
541                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
542                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM,
543                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
544            ]
545        },
546        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA: {
547            'rat_family_list': [
548                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
549                tel_defines.RAT_FAMILY_GSM, tel_defines.RAT_FAMILY_CDMA2000,
550                tel_defines.RAT_FAMILY_CDMA
551            ]
552        },
553        tel_defines.NETWORK_MODE_LTE_ONLY: {
554            'rat_family_list': [tel_defines.RAT_FAMILY_LTE]
555        },
556        tel_defines.NETWORK_MODE_LTE_WCDMA: {
557            'rat_family_list':
558            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA]
559        },
560        tel_defines.NETWORK_MODE_TDSCDMA_ONLY: {
561            'rat_family_list': [tel_defines.RAT_FAMILY_TDSCDMA]
562        },
563        tel_defines.NETWORK_MODE_TDSCDMA_WCDMA: {
564            'rat_family_list':
565            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_WCDMA]
566        },
567        tel_defines.NETWORK_MODE_LTE_TDSCDMA: {
568            'rat_family_list':
569            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA]
570        },
571        tel_defines.NETWORK_MODE_TDSCDMA_GSM: {
572            'rat_family_list':
573            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_GSM]
574        },
575        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM: {
576            'rat_family_list': [
577                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
578                tel_defines.RAT_FAMILY_GSM
579            ]
580        },
581        tel_defines.NETWORK_MODE_TDSCDMA_GSM_WCDMA: {
582            'rat_family_list': [
583                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
584                tel_defines.RAT_FAMILY_GSM
585            ]
586        },
587        tel_defines.NETWORK_MODE_LTE_TDSCDMA_WCDMA: {
588            'rat_family_list': [
589                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
590                tel_defines.RAT_FAMILY_LTE
591            ]
592        },
593        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA: {
594            'rat_family_list': [
595                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
596                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM
597            ]
598        },
599        tel_defines.NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA: {
600            'rat_family_list': [
601                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
602                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
603            ]
604        },
605        tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA: {
606            'rat_family_list': [
607                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
608                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM,
609                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
610            ]
611        }
612    }
613    default_umts_operator_network_tbl = {
614        tel_defines.GEN_5G: {
615            'rat_family': tel_defines.RAT_FAMILY_NR,
616            'network_preference': tel_defines.NETWORK_MODE_NR_LTE_GSM_WCDMA
617        },
618        tel_defines.GEN_4G: {
619            'rat_family': tel_defines.RAT_FAMILY_LTE,
620            'network_preference':
621            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
622        },
623        tel_defines.GEN_3G: {
624            'rat_family': tel_defines.RAT_FAMILY_WCDMA,
625            'network_preference': tel_defines.NETWORK_MODE_WCDMA_ONLY
626        },
627        tel_defines.GEN_2G: {
628            'rat_family': tel_defines.RAT_FAMILY_GSM,
629            'network_preference': tel_defines.NETWORK_MODE_GSM_ONLY
630        }
631    }
632    default_cdma_operator_network_tbl = {
633        tel_defines.GEN_5G: {
634            'rat_family': tel_defines.RAT_FAMILY_NR,
635            'network_preference': tel_defines.NETWORK_MODE_NR_LTE_GSM_WCDMA
636        },
637        tel_defines.GEN_4G: {
638            'rat_family': tel_defines.RAT_FAMILY_LTE,
639            'network_preference':
640            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
641        },
642        tel_defines.GEN_3G: {
643            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
644            'network_preference': tel_defines.NETWORK_MODE_CDMA
645        },
646        tel_defines.GEN_2G: {
647            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
648            'network_preference': tel_defines.NETWORK_MODE_CDMA_NO_EVDO
649        }
650    }
651    operator_network_tbl = {
652        tel_defines.CARRIER_TMO: default_umts_operator_network_tbl,
653        tel_defines.CARRIER_ATT: default_umts_operator_network_tbl,
654        tel_defines.CARRIER_VZW: default_cdma_operator_network_tbl,
655        tel_defines.CARRIER_SPT: default_cdma_operator_network_tbl,
656        tel_defines.CARRIER_EEUK: default_umts_operator_network_tbl,
657        tel_defines.CARRIER_VFUK: default_umts_operator_network_tbl,
658        tel_defines.CARRIER_GMBH: default_umts_operator_network_tbl,
659        tel_defines.CARRIER_ITA: default_umts_operator_network_tbl,
660        tel_defines.CARRIER_ESP: default_umts_operator_network_tbl,
661        tel_defines.CARRIER_ORG: default_umts_operator_network_tbl,
662        tel_defines.CARRIER_TEL: default_umts_operator_network_tbl,
663        tel_defines.CARRIER_TSA: default_umts_operator_network_tbl,
664        tel_defines.CARRIER_KT: default_umts_operator_network_tbl,
665        tel_defines.CARRIER_SKT: default_umts_operator_network_tbl,
666        tel_defines.CARRIER_LG_UPLUS: default_umts_operator_network_tbl
667    }
668    operator_network_tbl_by_phone_type = {
669        tel_defines.PHONE_TYPE_GSM: default_umts_operator_network_tbl,
670        tel_defines.PHONE_TYPE_CDMA: default_cdma_operator_network_tbl
671    }
672
673    umts_allowable_network_preference_tbl = \
674        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
675         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
676         tel_defines.NETWORK_MODE_LTE_GSM_WCDMA,
677         tel_defines.NETWORK_MODE_WCDMA_PREF,
678         tel_defines.NETWORK_MODE_WCDMA_ONLY,
679         tel_defines.NETWORK_MODE_GSM_ONLY]
680
681    cdma_allowable_network_preference_tbl = \
682        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
683         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
684         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO,
685         tel_defines.NETWORK_MODE_CDMA,
686         tel_defines.NETWORK_MODE_CDMA_NO_EVDO,
687         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA]
688
689    allowable_network_preference_tbl = {
690        tel_defines.CARRIER_TMO: umts_allowable_network_preference_tbl,
691        tel_defines.CARRIER_ATT: umts_allowable_network_preference_tbl,
692        tel_defines.CARRIER_VZW: cdma_allowable_network_preference_tbl,
693        tel_defines.CARRIER_SPT: cdma_allowable_network_preference_tbl,
694        tel_defines.CARRIER_EEUK: umts_allowable_network_preference_tbl,
695        tel_defines.CARRIER_VFUK: umts_allowable_network_preference_tbl,
696        tel_defines.CARRIER_KT: umts_allowable_network_preference_tbl,
697        tel_defines.CARRIER_SKT: umts_allowable_network_preference_tbl,
698        tel_defines.CARRIER_LG_UPLUS: umts_allowable_network_preference_tbl
699    }
700    allowable_network_preference_tbl_by_phone_type = {
701        tel_defines.PHONE_TYPE_GSM: umts_allowable_network_preference_tbl,
702        tel_defines.PHONE_TYPE_CDMA: cdma_allowable_network_preference_tbl
703    }
704
705    voice_mail_number_tbl = {
706        tel_defines.CARRIER_TMO: "123",
707        tel_defines.CARRIER_VZW: "*86",
708        tel_defines.CARRIER_ATT: None,
709        tel_defines.CARRIER_SPT: None,
710        tel_defines.CARRIER_EEUK: "+447953222222",
711        tel_defines.CARRIER_NTT_DOCOMO: "1417",
712        tel_defines.CARRIER_KDDI: "1417",
713        tel_defines.CARRIER_RAKUTEN: "1417",
714        tel_defines.CARRIER_SBM: "1416"
715    }
716
717    voice_mail_count_check_function_tbl = {
718        tel_defines.CARRIER_TMO: check_tmo_voice_mail_count,
719        tel_defines.CARRIER_ATT: check_att_voice_mail_count,
720        tel_defines.CARRIER_SPT: check_spt_voice_mail_count
721    }
722
723    voice_mail_delete_digit_tbl = {
724        tel_defines.CARRIER_EEUK: "3",
725        tel_defines.CARRIER_NTT_DOCOMO: "3",
726        tel_defines.CARRIER_KDDI: "9"
727    }
728
729
730device_capabilities = {
731    NexusModelNames.ONE:
732    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_MSIM],
733    NexusModelNames.N5: [tel_defines.CAPABILITY_PHONE],
734    NexusModelNames.N5v2: [
735        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
736        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
737    ],
738    NexusModelNames.N6: [
739        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
740        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
741    ],
742    NexusModelNames.N6v2: [
743        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
744        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
745    ],
746    NexusModelNames.N5v3: [
747        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
748        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
749        tel_defines.CAPABILITY_VT
750    ],
751    NexusModelNames.N6v3: [
752        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
753        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
754        tel_defines.CAPABILITY_VT
755    ],
756    "default": [
757        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
758        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
759        tel_defines.CAPABILITY_VT
760    ]
761}
762
763operator_capabilities = {
764    tel_defines.CARRIER_VZW: [
765        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
766        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
767        tel_defines.CAPABILITY_VT
768    ],
769    tel_defines.CARRIER_ATT:
770    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE],
771    tel_defines.CARRIER_TMO: [
772        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
773        tel_defines.CAPABILITY_WFC, tel_defines.CAPABILITY_VT
774    ],
775    tel_defines.CARRIER_SPT: [tel_defines.CAPABILITY_PHONE],
776    tel_defines.CARRIER_ROGERS: [
777        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
778        tel_defines.CAPABILITY_WFC
779    ],
780    tel_defines.CARRIER_EEUK: [
781        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
782        tel_defines.CAPABILITY_WFC
783    ],
784    tel_defines.CARRIER_VFUK: [tel_defines.CAPABILITY_PHONE],
785    "default": [tel_defines.CAPABILITY_PHONE]
786}
787