1#!/usr/bin/env python3 2# 3# Copyright 2020 - The Android Open Source Project 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. 16 17from enum import Enum 18 19 20class PreferredNetworkType(Enum): 21 """ Available preferred network types that can be passed to 22 set_preferred_network_type""" 23 LTE_ONLY = 'lte-only' 24 GSM_ONLY = 'gsm-only' 25 WCDMA_ONLY = 'wcdma-only' 26 27 28class BaseCellularDut(): 29 """ Base class for DUTs used with cellular simulators. """ 30 def toggle_airplane_mode(self, new_state=True): 31 """ Turns airplane mode on / off. 32 33 Args: 34 new_state: True if airplane mode needs to be enabled. 35 """ 36 raise NotImplementedError() 37 38 def toggle_data_roaming(self, new_state=True): 39 """ Enables or disables cellular data roaming. 40 41 Args: 42 new_state: True if data roaming needs to be enabled. 43 """ 44 raise NotImplementedError() 45 46 def get_rx_tx_power_levels(self): 47 """ Obtains Rx and Tx power levels measured from the DUT. 48 49 Returns: 50 A tuple where the first element is an array with the RSRP value 51 in each Rx chain, and the second element is the Tx power in dBm. 52 Values for invalid or disabled Rx / Tx chains are set to None. 53 """ 54 raise NotImplementedError() 55 56 def set_apn(self, name, apn, type='default'): 57 """ Sets the Access Point Name. 58 59 Args: 60 name: the APN name 61 apn: the APN 62 type: the APN type 63 """ 64 raise NotImplementedError() 65 66 def set_preferred_network_type(self, type): 67 """ Sets the preferred RAT. 68 69 Args: 70 type: an instance of class PreferredNetworkType 71 """ 72 raise NotImplementedError() 73 74 def get_telephony_signal_strength(self): 75 """ Wrapper for the method with the same name in tel_utils. 76 77 Will be deprecated and replaced by get_rx_tx_power_levels. """ 78 raise NotImplementedError() 79