1# Copyright 2021 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from enum import Enum 6 7 8class PreferredNetworkType(Enum): 9 """ Available preferred network types that can be passed to 10 set_preferred_network_type""" 11 LTE_ONLY = 'lte-only' 12 GSM_ONLY = 'gsm-only' 13 WCDMA_ONLY = 'wcdma-only' 14 15 16class BaseCellularDut(): 17 """ Base class for DUTs used with cellular simulators. """ 18 19 def toggle_airplane_mode(self, new_state=True): 20 """ Turns airplane mode on / off. 21 22 Args: 23 new_state: True if airplane mode needs to be enabled. 24 """ 25 raise NotImplementedError() 26 27 def toggle_data_roaming(self, new_state=True): 28 """ Enables or disables cellular data roaming. 29 30 Args: 31 new_state: True if data roaming needs to be enabled. 32 """ 33 raise NotImplementedError() 34 35 def get_rx_tx_power_levels(self): 36 """ Obtains Rx and Tx power levels measured from the DUT. 37 38 Returns: 39 A tuple where the first element is an array with the RSRP value 40 in each Rx chain, and the second element is the Tx power in dBm. 41 Values for invalid or disabled Rx / Tx chains are set to None. 42 """ 43 raise NotImplementedError() 44 45 def set_apn(self, name, apn, type='default'): 46 """ Sets the Access Point Name. 47 48 Args: 49 name: the APN name 50 apn: the APN 51 type: the APN type 52 """ 53 raise NotImplementedError() 54 55 def set_preferred_network_type(self, type): 56 """ Sets the preferred RAT. 57 58 Args: 59 type: an instance of class PreferredNetworkType 60 """ 61 raise NotImplementedError() 62 63 def get_telephony_signal_strength(self): 64 """ Wrapper for the method with the same name in tel_utils. 65 66 Will be deprecated and replaced by get_rx_tx_power_levels. """ 67 raise NotImplementedError() 68