1#!/usr/bin/env python3.4
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.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 is_valid_rat(rat_type):
56    return True if rat_type in _TelTables.technology_tbl else False
57
58
59def is_valid_generation(gen):
60    return True if gen in _TelTables.technology_gen_tbl else False
61
62
63def is_rat_svd_capable(rat):
64    return _TelTables.technology_tbl[rat]["simultaneous_voice_data"]
65
66
67def connection_type_from_type_string(input_string):
68    if input_string in _ConnectionTables.connection_type_tbl:
69        return _ConnectionTables.connection_type_tbl[input_string]
70    return tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN
71
72
73def is_user_plane_data_type(connection_type):
74    if connection_type in _ConnectionTables.user_plane_data_type:
75        return _ConnectionTables.user_plane_data_type[connection_type]
76    return False
77
78
79# For TMO, to check if voice mail count is correct after leaving a new voice message.
80def check_tmo_voice_mail_count(voice_mail_count_before,
81                               voice_mail_count_after):
82    return (voice_mail_count_after == -1)
83
84
85# For ATT, to check if voice mail count is correct after leaving a new voice message.
86def check_att_voice_mail_count(voice_mail_count_before,
87                               voice_mail_count_after):
88    return (voice_mail_count_after == (voice_mail_count_before + 1))
89
90
91# For SPT, to check if voice mail count is correct after leaving a new voice message.
92def check_spt_voice_mail_count(voice_mail_count_before,
93                               voice_mail_count_after):
94    return (voice_mail_count_after == (voice_mail_count_before + 1))
95
96
97def get_voice_mail_check_number(operator):
98    return _TelTables.voice_mail_number_tbl.get(operator)
99
100
101def get_voice_mail_count_check_function(operator):
102    return _TelTables.voice_mail_count_check_function_tbl.get(
103        operator, check_tmo_voice_mail_count)
104
105
106def get_voice_mail_delete_digit(operator):
107    return _TelTables.voice_mail_delete_digit_tbl.get(operator, "7")
108
109
110def get_allowable_network_preference(operator, phone_type=None):
111    if not phone_type:
112        return _TelTables.allowable_network_preference_tbl[operator]
113    else:
114        return _TelTables.allowable_network_preference_tbl_by_phone_type[
115            phone_type]
116
117
118class _ConnectionTables():
119    connection_type_tbl = {
120        'WIFI': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
121        'WIFI_P2P': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
122        'MOBILE': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
123        'MOBILE_DUN': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
124        'MOBILE_HIPRI': tel_defines.NETWORK_CONNECTION_TYPE_HIPRI,
125        # TODO: b/26296489 add support for 'MOBILE_SUPL', 'MOBILE_HIPRI',
126        # 'MOBILE_FOTA', 'MOBILE_IMS', 'MOBILE_CBS', 'MOBILE_IA',
127        # 'MOBILE_EMERGENCY'
128        'MOBILE_MMS': tel_defines.NETWORK_CONNECTION_TYPE_MMS
129    }
130
131    user_plane_data_type = {
132        tel_defines.NETWORK_CONNECTION_TYPE_WIFI: True,
133        tel_defines.NETWORK_CONNECTION_TYPE_CELL: False,
134        tel_defines.NETWORK_CONNECTION_TYPE_MMS: False,
135        tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN: False
136    }
137
138
139class _TelTables():
140    # Operator id mapping to operator name
141    # Reference: Pages 43-50 in
142    # https://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.212B-2013-PDF-E.pdf [2013]
143
144    operator_id_to_name = {
145
146        #VZW (Verizon Wireless)
147        '310010': tel_defines.CARRIER_VZW,
148        '310012': tel_defines.CARRIER_VZW,
149        '310013': tel_defines.CARRIER_VZW,
150        '310590': tel_defines.CARRIER_VZW,
151        '310890': tel_defines.CARRIER_VZW,
152        '310910': tel_defines.CARRIER_VZW,
153        '310110': tel_defines.CARRIER_VZW,
154        '311270': tel_defines.CARRIER_VZW,
155        '311271': tel_defines.CARRIER_VZW,
156        '311272': tel_defines.CARRIER_VZW,
157        '311273': tel_defines.CARRIER_VZW,
158        '311274': tel_defines.CARRIER_VZW,
159        '311275': tel_defines.CARRIER_VZW,
160        '311276': tel_defines.CARRIER_VZW,
161        '311277': tel_defines.CARRIER_VZW,
162        '311278': tel_defines.CARRIER_VZW,
163        '311279': tel_defines.CARRIER_VZW,
164        '311280': tel_defines.CARRIER_VZW,
165        '311281': tel_defines.CARRIER_VZW,
166        '311282': tel_defines.CARRIER_VZW,
167        '311283': tel_defines.CARRIER_VZW,
168        '311284': tel_defines.CARRIER_VZW,
169        '311285': tel_defines.CARRIER_VZW,
170        '311286': tel_defines.CARRIER_VZW,
171        '311287': tel_defines.CARRIER_VZW,
172        '311288': tel_defines.CARRIER_VZW,
173        '311289': tel_defines.CARRIER_VZW,
174        '311390': tel_defines.CARRIER_VZW,
175        '311480': tel_defines.CARRIER_VZW,
176        '311481': tel_defines.CARRIER_VZW,
177        '311482': tel_defines.CARRIER_VZW,
178        '311483': tel_defines.CARRIER_VZW,
179        '311484': tel_defines.CARRIER_VZW,
180        '311485': tel_defines.CARRIER_VZW,
181        '311486': tel_defines.CARRIER_VZW,
182        '311487': tel_defines.CARRIER_VZW,
183        '311488': tel_defines.CARRIER_VZW,
184        '311489': tel_defines.CARRIER_VZW,
185
186        #TMO (T-Mobile USA)
187        '310160': tel_defines.CARRIER_TMO,
188        '310200': tel_defines.CARRIER_TMO,
189        '310210': tel_defines.CARRIER_TMO,
190        '310220': tel_defines.CARRIER_TMO,
191        '310230': tel_defines.CARRIER_TMO,
192        '310240': tel_defines.CARRIER_TMO,
193        '310250': tel_defines.CARRIER_TMO,
194        '310260': tel_defines.CARRIER_TMO,
195        '310270': tel_defines.CARRIER_TMO,
196        '310310': tel_defines.CARRIER_TMO,
197        '310490': tel_defines.CARRIER_TMO,
198        '310660': tel_defines.CARRIER_TMO,
199        '310800': tel_defines.CARRIER_TMO,
200
201        #ATT (AT&T and Cingular)
202        '310070': tel_defines.CARRIER_ATT,
203        '310560': tel_defines.CARRIER_ATT,
204        '310670': tel_defines.CARRIER_ATT,
205        '310680': tel_defines.CARRIER_ATT,
206        '310150': tel_defines.CARRIER_ATT,  #Cingular
207        '310170': tel_defines.CARRIER_ATT,  #Cingular
208        '310410': tel_defines.CARRIER_ATT,  #Cingular
209        '311180': tel_defines.CARRIER_ATT,
210        #Cingular Licensee Pacific Telesis Mobile Services, LLC
211
212        #Sprint (and Sprint-Nextel)
213        '310120': tel_defines.CARRIER_SPT,
214        '311490': tel_defines.CARRIER_SPT,
215        '311870': tel_defines.CARRIER_SPT,
216        '311880': tel_defines.CARRIER_SPT,
217        '312190': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
218        '316010': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
219        '23433': tel_defines.CARRIER_EEUK,  #Orange
220        '23434': tel_defines.CARRIER_EEUK,  #Orange
221        '23430': tel_defines.CARRIER_EEUK,  #T-Mobile UK
222        '23431': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
223        '23432': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
224        '23415': tel_defines.CARRIER_VFUK,
225
226        #USCC
227        '311580': tel_defines.CARRIER_USCC,
228
229        #Vodafone (Germany)
230        '26202': tel_defines.CARRIER_GMBH,
231        '26204': tel_defines.CARRIER_GMBH,
232        '26209': tel_defines.CARRIER_GMBH,
233        '26242': tel_defines.CARRIER_GMBH,
234        '26243': tel_defines.CARRIER_GMBH,
235
236        #Vodafone (Italy)
237        '22206': tel_defines.CARRIER_ITA,
238        '22210': tel_defines.CARRIER_ITA,
239
240        #Vodafone (Spain)
241        '21401': tel_defines.CARRIER_ESP,
242        '20406': tel_defines.CARRIER_ESP,
243
244        #Orange (France)
245        '20801': tel_defines.CARRIER_ORG,
246        '20802': tel_defines.CARRIER_ORG,
247        '20891': tel_defines.CARRIER_ORG,
248
249        #Telenor (Norway)
250        '24201': tel_defines.CARRIER_TEL,
251        '24212': tel_defines.CARRIER_TEL,
252
253        #Telstra (Australia)
254        '50501': tel_defines.CARRIER_TSA
255    }
256
257    technology_gen_tbl = [
258        tel_defines.GEN_2G, tel_defines.GEN_3G, tel_defines.GEN_4G
259    ]
260
261    technology_tbl = {
262        tel_defines.RAT_1XRTT: {
263            'is_voice_rat': True,
264            'is_data_rat': False,
265            'generation': tel_defines.GEN_3G,
266            'simultaneous_voice_data': False,
267            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
268        },
269        tel_defines.RAT_EDGE: {
270            'is_voice_rat': False,
271            'is_data_rat': True,
272            'generation': tel_defines.GEN_2G,
273            'simultaneous_voice_data': False,
274            'rat_family': tel_defines.RAT_FAMILY_GSM
275        },
276        tel_defines.RAT_GPRS: {
277            'is_voice_rat': False,
278            'is_data_rat': True,
279            'generation': tel_defines.GEN_2G,
280            'simultaneous_voice_data': False,
281            'rat_family': tel_defines.RAT_FAMILY_GSM
282        },
283        tel_defines.RAT_GSM: {
284            'is_voice_rat': True,
285            'is_data_rat': False,
286            'generation': tel_defines.GEN_2G,
287            'simultaneous_voice_data': False,
288            'rat_family': tel_defines.RAT_FAMILY_GSM
289        },
290        tel_defines.RAT_UMTS: {
291            'is_voice_rat': True,
292            'is_data_rat': True,
293            'generation': tel_defines.GEN_3G,
294            'simultaneous_voice_data': True,
295            'rat_family': tel_defines.RAT_FAMILY_WCDMA
296        },
297        tel_defines.RAT_WCDMA: {
298            'is_voice_rat': True,
299            'is_data_rat': True,
300            'generation': tel_defines.GEN_3G,
301            'simultaneous_voice_data': True,
302            'rat_family': tel_defines.RAT_FAMILY_WCDMA
303        },
304        tel_defines.RAT_HSDPA: {
305            'is_voice_rat': False,
306            'is_data_rat': True,
307            'generation': tel_defines.GEN_3G,
308            'simultaneous_voice_data': False,
309            'rat_family': tel_defines.RAT_FAMILY_WCDMA
310        },
311        tel_defines.RAT_HSUPA: {
312            'is_voice_rat': False,
313            'is_data_rat': True,
314            'generation': tel_defines.GEN_3G,
315            'simultaneous_voice_data': False,
316            'rat_family': tel_defines.RAT_FAMILY_WCDMA
317        },
318        tel_defines.RAT_CDMA: {
319            'is_voice_rat': True,
320            'is_data_rat': False,
321            'generation': tel_defines.GEN_2G,
322            'simultaneous_voice_data': False,
323            'rat_family': tel_defines.RAT_FAMILY_CDMA
324        },
325        tel_defines.RAT_EVDO: {
326            'is_voice_rat': False,
327            'is_data_rat': True,
328            'generation': tel_defines.GEN_3G,
329            'simultaneous_voice_data': False,
330            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
331        },
332        tel_defines.RAT_EVDO_0: {
333            'is_voice_rat': False,
334            'is_data_rat': True,
335            'generation': tel_defines.GEN_3G,
336            'simultaneous_voice_data': False,
337            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
338        },
339        tel_defines.RAT_EVDO_A: {
340            'is_voice_rat': False,
341            'is_data_rat': True,
342            'generation': tel_defines.GEN_3G,
343            'simultaneous_voice_data': False,
344            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
345        },
346        tel_defines.RAT_EVDO_B: {
347            'is_voice_rat': False,
348            'is_data_rat': True,
349            'generation': tel_defines.GEN_3G,
350            'simultaneous_voice_data': False,
351            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
352        },
353        tel_defines.RAT_IDEN: {
354            'is_voice_rat': False,
355            'is_data_rat': True,
356            'generation': tel_defines.GEN_2G,
357            'simultaneous_voice_data': False,
358            'rat_family': tel_defines.RAT_FAMILY_IDEN
359        },
360        tel_defines.RAT_LTE_CA: {
361            'is_voice_rat': True,
362            'is_data_rat': True,
363            'generation': tel_defines.GEN_4G,
364            'simultaneous_voice_data': True,
365            'rat_family': tel_defines.RAT_FAMILY_LTE
366        },
367        tel_defines.RAT_LTE: {
368            'is_voice_rat': True,
369            'is_data_rat': True,
370            'generation': tel_defines.GEN_4G,
371            'simultaneous_voice_data': True,
372            'rat_family': tel_defines.RAT_FAMILY_LTE
373        },
374        tel_defines.RAT_EHRPD: {
375            'is_voice_rat': False,
376            'is_data_rat': True,
377            'generation': tel_defines.GEN_3G,
378            'simultaneous_voice_data': False,
379            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
380        },
381        tel_defines.RAT_HSPA: {
382            'is_voice_rat': False,
383            'is_data_rat': True,
384            'generation': tel_defines.GEN_3G,
385            'simultaneous_voice_data': True,
386            'rat_family': tel_defines.RAT_FAMILY_WCDMA
387        },
388        tel_defines.RAT_HSPAP: {
389            'is_voice_rat': False,
390            'is_data_rat': True,
391            'generation': tel_defines.GEN_3G,
392            'simultaneous_voice_data': True,
393            'rat_family': tel_defines.RAT_FAMILY_WCDMA
394        },
395        tel_defines.RAT_IWLAN: {
396            'is_voice_rat': True,
397            'is_data_rat': True,
398            'generation': tel_defines.GEN_4G,
399            'simultaneous_voice_data': True,
400            'rat_family': tel_defines.RAT_FAMILY_WLAN
401        },
402        tel_defines.RAT_TD_SCDMA: {
403            'is_voice_rat': True,
404            'is_data_rat': True,
405            'generation': tel_defines.GEN_3G,
406            'simultaneous_voice_data': True,
407            'rat_family': tel_defines.RAT_FAMILY_TDSCDMA
408        },
409        tel_defines.RAT_UNKNOWN: {
410            'is_voice_rat': False,
411            'is_data_rat': False,
412            'generation': tel_defines.GEN_UNKNOWN,
413            'simultaneous_voice_data': False,
414            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
415        },
416        tel_defines.RAT_GLOBAL: {
417            'is_voice_rat': False,
418            'is_data_rat': False,
419            'generation': tel_defines.GEN_UNKNOWN,
420            'simultaneous_voice_data': False,
421            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
422        }
423    }
424
425    network_preference_tbl = {
426        tel_defines.NETWORK_MODE_LTE_GSM_WCDMA: {
427            'rat_family_list': [
428                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
429                tel_defines.RAT_FAMILY_GSM
430            ]
431        },
432        tel_defines.NETWORK_MODE_GSM_UMTS: {
433            'rat_family_list':
434            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
435        },
436        tel_defines.NETWORK_MODE_GSM_ONLY: {
437            'rat_family_list': [tel_defines.RAT_FAMILY_GSM]
438        },
439        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO: {
440            'rat_family_list': [
441                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_CDMA2000,
442                tel_defines.RAT_FAMILY_CDMA
443            ]
444        },
445        tel_defines.NETWORK_MODE_CDMA: {
446            'rat_family_list':
447            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
448        },
449        tel_defines.NETWORK_MODE_CDMA_NO_EVDO: {
450            'rat_family_list':
451            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
452        },
453        tel_defines.NETWORK_MODE_WCDMA_PREF: {
454            'rat_family_list':
455            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
456        },
457        tel_defines.NETWORK_MODE_WCDMA_ONLY: {
458            'rat_family_list': [tel_defines.RAT_FAMILY_WCDMA]
459        },
460        tel_defines.NETWORK_MODE_EVDO_NO_CDMA: {
461            'rat_family_list': [tel_defines.RAT_FAMILY_CDMA2000]
462        },
463        tel_defines.NETWORK_MODE_GLOBAL: {
464            'rat_family_list': [
465                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
466                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM,
467                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
468            ]
469        },
470        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA: {
471            'rat_family_list': [
472                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
473                tel_defines.RAT_FAMILY_GSM, tel_defines.RAT_FAMILY_CDMA2000,
474                tel_defines.RAT_FAMILY_CDMA
475            ]
476        },
477        tel_defines.NETWORK_MODE_LTE_ONLY: {
478            'rat_family_list': [tel_defines.RAT_FAMILY_LTE]
479        },
480        tel_defines.NETWORK_MODE_LTE_WCDMA: {
481            'rat_family_list':
482            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA]
483        },
484        tel_defines.NETWORK_MODE_TDSCDMA_ONLY: {
485            'rat_family_list': [tel_defines.RAT_FAMILY_TDSCDMA]
486        },
487        tel_defines.NETWORK_MODE_TDSCDMA_WCDMA: {
488            'rat_family_list':
489            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_WCDMA]
490        },
491        tel_defines.NETWORK_MODE_LTE_TDSCDMA: {
492            'rat_family_list':
493            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA]
494        },
495        tel_defines.NETWORK_MODE_TDSCDMA_GSM: {
496            'rat_family_list':
497            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_GSM]
498        },
499        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM: {
500            'rat_family_list': [
501                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
502                tel_defines.RAT_FAMILY_GSM
503            ]
504        },
505        tel_defines.NETWORK_MODE_TDSCDMA_GSM_WCDMA: {
506            'rat_family_list': [
507                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
508                tel_defines.RAT_FAMILY_GSM
509            ]
510        },
511        tel_defines.NETWORK_MODE_LTE_TDSCDMA_WCDMA: {
512            'rat_family_list': [
513                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
514                tel_defines.RAT_FAMILY_LTE
515            ]
516        },
517        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA: {
518            'rat_family_list': [
519                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
520                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM
521            ]
522        },
523        tel_defines.NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA: {
524            'rat_family_list': [
525                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
526                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
527            ]
528        },
529        tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA: {
530            'rat_family_list': [
531                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
532                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM,
533                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
534            ]
535        }
536    }
537    default_umts_operator_network_tbl = {
538        tel_defines.GEN_4G: {
539            'rat_family': tel_defines.RAT_FAMILY_LTE,
540            'network_preference':
541            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
542        },
543        tel_defines.GEN_3G: {
544            'rat_family': tel_defines.RAT_FAMILY_WCDMA,
545            'network_preference': tel_defines.NETWORK_MODE_WCDMA_ONLY
546        },
547        tel_defines.GEN_2G: {
548            'rat_family': tel_defines.RAT_FAMILY_GSM,
549            'network_preference': tel_defines.NETWORK_MODE_GSM_ONLY
550        }
551    }
552    default_cdma_operator_network_tbl = {
553        tel_defines.GEN_4G: {
554            'rat_family': tel_defines.RAT_FAMILY_LTE,
555            'network_preference':
556            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
557        },
558        tel_defines.GEN_3G: {
559            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
560            'network_preference': tel_defines.NETWORK_MODE_CDMA
561        },
562        tel_defines.GEN_2G: {
563            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
564            'network_preference': tel_defines.NETWORK_MODE_CDMA_NO_EVDO
565        }
566    }
567    operator_network_tbl = {
568        tel_defines.CARRIER_TMO: default_umts_operator_network_tbl,
569        tel_defines.CARRIER_ATT: default_umts_operator_network_tbl,
570        tel_defines.CARRIER_VZW: default_cdma_operator_network_tbl,
571        tel_defines.CARRIER_SPT: default_cdma_operator_network_tbl,
572        tel_defines.CARRIER_EEUK: default_umts_operator_network_tbl,
573        tel_defines.CARRIER_VFUK: default_umts_operator_network_tbl,
574        tel_defines.CARRIER_GMBH: default_umts_operator_network_tbl,
575        tel_defines.CARRIER_ITA: default_umts_operator_network_tbl,
576        tel_defines.CARRIER_ESP: default_umts_operator_network_tbl,
577        tel_defines.CARRIER_ORG: default_umts_operator_network_tbl,
578        tel_defines.CARRIER_TEL: default_umts_operator_network_tbl,
579        tel_defines.CARRIER_TSA: default_umts_operator_network_tbl
580    }
581    operator_network_tbl_by_phone_type = {
582        tel_defines.PHONE_TYPE_GSM: default_umts_operator_network_tbl,
583        tel_defines.PHONE_TYPE_CDMA: default_cdma_operator_network_tbl
584    }
585
586    umts_allowable_network_preference_tbl = \
587        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
588         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
589         tel_defines.NETWORK_MODE_LTE_GSM_WCDMA,
590         tel_defines.NETWORK_MODE_WCDMA_PREF,
591         tel_defines.NETWORK_MODE_WCDMA_ONLY,
592         tel_defines.NETWORK_MODE_GSM_ONLY]
593
594    cdma_allowable_network_preference_tbl = \
595        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
596         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
597         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO,
598         tel_defines.NETWORK_MODE_CDMA,
599         tel_defines.NETWORK_MODE_CDMA_NO_EVDO,
600         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA]
601
602    allowable_network_preference_tbl = {
603        tel_defines.CARRIER_TMO: umts_allowable_network_preference_tbl,
604        tel_defines.CARRIER_ATT: umts_allowable_network_preference_tbl,
605        tel_defines.CARRIER_VZW: cdma_allowable_network_preference_tbl,
606        tel_defines.CARRIER_SPT: cdma_allowable_network_preference_tbl,
607        tel_defines.CARRIER_EEUK: umts_allowable_network_preference_tbl,
608        tel_defines.CARRIER_VFUK: umts_allowable_network_preference_tbl
609    }
610    allowable_network_preference_tbl_by_phone_type = {
611        tel_defines.PHONE_TYPE_GSM: umts_allowable_network_preference_tbl,
612        tel_defines.PHONE_TYPE_CDMA: cdma_allowable_network_preference_tbl
613    }
614
615    voice_mail_number_tbl = {
616        tel_defines.CARRIER_TMO: "123",
617        tel_defines.CARRIER_VZW: "*86",
618        tel_defines.CARRIER_ATT: None,
619        tel_defines.CARRIER_SPT: None,
620        tel_defines.CARRIER_EEUK: "+447953222222"
621    }
622
623    voice_mail_count_check_function_tbl = {
624        tel_defines.CARRIER_TMO: check_tmo_voice_mail_count,
625        tel_defines.CARRIER_ATT: check_att_voice_mail_count,
626        tel_defines.CARRIER_SPT: check_spt_voice_mail_count
627    }
628
629    voice_mail_delete_digit_tbl = {tel_defines.CARRIER_EEUK: "3"}
630
631
632device_capabilities = {
633    NexusModelNames.ONE:
634    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_MSIM],
635    NexusModelNames.N5: [tel_defines.CAPABILITY_PHONE],
636    NexusModelNames.N5v2: [
637        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
638        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
639    ],
640    NexusModelNames.N6: [
641        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
642        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
643    ],
644    NexusModelNames.N6v2: [
645        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
646        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
647    ],
648    NexusModelNames.N5v3: [
649        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
650        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
651        tel_defines.CAPABILITY_VT
652    ],
653    NexusModelNames.N6v3: [
654        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
655        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
656        tel_defines.CAPABILITY_VT
657    ],
658    "default": [
659        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
660        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
661        tel_defines.CAPABILITY_VT
662    ]
663}
664
665operator_capabilities = {
666    tel_defines.CARRIER_VZW: [
667        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
668        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
669        tel_defines.CAPABILITY_VT
670    ],
671    tel_defines.CARRIER_ATT: [tel_defines.CAPABILITY_PHONE],
672    tel_defines.CARRIER_TMO: [
673        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
674        tel_defines.CAPABILITY_WFC, tel_defines.CAPABILITY_VT
675    ],
676    tel_defines.CARRIER_SPT: [tel_defines.CAPABILITY_PHONE],
677    tel_defines.CARRIER_EEUK: [
678        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
679        tel_defines.CAPABILITY_WFC
680    ],
681    tel_defines.CARRIER_VFUK: [tel_defines.CAPABILITY_PHONE],
682    "default": [tel_defines.CAPABILITY_PHONE]
683}
684