def __init__(self, tc_name, global_config): """ Constructor """ # Call gsm voice call base Init function LabGsmVcBase.__init__(self, tc_name, global_config) self._phone_number = \ str(self._tc_parameters.get_param_value("PHONE_NUMBER")) if self._phone_number.upper() == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number())
def __init__(self, tc_name, global_config): """ Constructor """ # Call gsm voice call base Init function LabGsmVcBase.__init__(self, tc_name, global_config) self._phone_number = \ str(self._tc_parameters.get_param_value("PHONE_NUMBER")) if self._phone_number.upper() == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) # Read IS_EMERGENCY_NUMBER from test case xml file self._is_emergency_number_param = \ str(self._tc_parameters.get_param_value("IS_EMERGENCY_NUMBER")) # Retrieve testcase parameters for AT proxy usage self._launch_mode = self._tc_parameters.get_param_value("LAUNCH_MODE") self._command = self._tc_parameters.get_param_value("COMMAND") self._index = self._tc_parameters.get_param_value("INDEX") self._expected_result = \ self._tc_parameters.get_param_value("EXPECTED_RESULT") self._command_timeout = \ self._tc_parameters.get_param_value("COMMAND_TIMEOUT") self._command_timeout = int(self._command_timeout) # Instantiate the PhoneSystem UE Command category self._phone_system = self._device.get_uecmd("PhoneSystem") # Instantiate the modem UE commands self._modem_flashing_api = self._device.get_uecmd("ModemFlashing") # Get Serial Handler instance self._serial_handler = SerialHandler() # Initialize a boolean attribute corresponding to the # previously read parameter self._is_emergency_number = False # The attribute that will store the initial list # of emergency numbers. self._initial_emergency_numbers = None # Win COM port to be used self.at_proxy_com_port = None # Store the AT proxy connection availability self.modem_available = False # Store the verdict for AT@NVM interrogation self._at_inter_nvm_em_verdict = None # Store the response for AT@NVM interrogation self._at_inter_nvm_em = None # Store the verdict for setting EM in NVM via AT@NVM # it will be used in tear down to know if the initial values # should be restored or not in NVM:cust.emergency self._at_set_nvm_em = None # AT command that will be used for initial NVM:cust.emergency # values at the tear down. self.command_to_rest_em_in_nvm = None # AT command that will be used for setting new EM in NVM:cust.emergency self.command_to_add_em_in_nvm = None # Store the initial list of RIL emergency number from UECmdTypes self._initial_ue_command_em_number = UECmdTypes.EMERGENCY_NUMBERS_LIST #Set up the parameters for the AT@NVM:cust.emergency # AT@NVM:cust.emergency[<index>]={<P1>,<P2>,<P3>,<P4>,<P5>,<P6>,<P7>,<P8>} # < index>, <index1>, <index2> - index of Emergency number to be stored self.index = self._index # <P1>,<P2>,<P3> BCD encoded ECC in decimal values # Make sure the provided Phone Number parameter is not present # in the list of emergency numbers self.em_no_length = len(self._phone_number) if self.em_no_length != 6: # Otherwise create an error message message = "Provided parameter PHONE_NUMBER [%s] should be 6 digits" % ( self._phone_number) # Raise an exception raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, message) # <P1> (in BCD representation) self.p1_bcd = int_to_bcd(self._phone_number[0:2]) # <P2> (in BCD representation) self.p2_bcd = int_to_bcd(self._phone_number[2:4]) # <P2> (in BCD representation) self.p3_bcd = int_to_bcd(self._phone_number[4:6]) #<P4> denotes whether ECC is valid when sim present or not # 0 - ECC is not valid when SIM present # 1 - ECC is valid when SIM is present self.p4 = 1 #<P5> denotes ECC Category self.p5 = 1 #<P6>, <P7> # MCC 2 bytes same as 3GPP PLMN format self.p6 = self._mcc self.p7 = self._mnc #<P8> reserved . give 0xff self.p8 = "255" self.command_to_add_em_in_nvm = "%s[%s]={%s, %s, %s, %s, %s, %s, %s, %s}" % ( str(self._command), str(self._index), str(self.p1_bcd), str(self.p2_bcd), str(self.p3_bcd), str(self.p4), str(self.p5), str(self.p6), str(self.p7), str(self.p8))