def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) if self._hold_mute == "MUTE": self._sip_call_api.toogle_mute() # Check no audio on uplink after mute call audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL") #unmute call self._sip_call_api.toogle_mute() if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 0: # Check audio on uplink is back after unmute audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL") if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0: audio_analyzer_result = 0 else: audio_analyzer_result = 4 else: audio_analyzer_result = 4 elif self._hold_mute == "HOLD": self._sip_call_api.hold_call() # Check no audio on uplink after mute call audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL") #unhold call self._sip_call_api.unhold_call() if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 2: # Check audio on uplink is back after unmute audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL") if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0: audio_analyzer_result = 0 else: audio_analyzer_result = 4 else: audio_analyzer_result = 4 else: self._logger.error("Unknown hold/mute argument") audio_analyzer_result = 4 # Compute test verdict and comment verdict self.__compute_test_verdict__(audio_analyzer_result) return self._result_verdict, self._verdict_comment
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) # WAIT FOR CALL DURATION self._logger.info("Wait for call duration: %s s..." % str(self._call_duration)) # Set Voice Call Volume 0% self._system_api.adjust_specified_stream_volume("VoiceCall", 0) # Launch audio_quality test audio_analyzer_result, l_volume_zero_percent = self._audio_analyzer.get_volume( self._call_type, self._acc_type) self._logger.info("Volume at 0 percent: %s " % str(l_volume_zero_percent)) # Set Voice Call Volume 100% self._system_api.adjust_specified_stream_volume("VoiceCall", 100) # Launch audio_quality test audio_analyzer_result2, l_volume_hundred_percent = self._audio_analyzer.get_volume( self._call_type, self._acc_type) self._logger.info("Volume at 100 percent: %s " % str(l_volume_hundred_percent)) self._keyevent_api.scenario(["POWER_BUTTON"]) # Set Voice Call Volume 0% self._system_api.adjust_specified_stream_volume("VoiceCall", 0) # Launch audio_quality test audio_analyzer_result3, l_volume_zero_percent2 = self._audio_analyzer.get_volume( self._call_type, self._acc_type) self._logger.info( "Volume at 0 percent after press power down button: %s " % str(l_volume_zero_percent2)) if audio_analyzer_result == 0 and audio_analyzer_result2 == 0 and audio_analyzer_result3 == 0: l_delta1 = int(l_volume_hundred_percent) - int( l_volume_zero_percent) l_delta2 = int(l_volume_hundred_percent) - int( l_volume_zero_percent2) self._delta_volume = abs(l_delta1 - l_delta2) if self._delta_volume < 10: self._result_verdict = 0 else: self._result_verdict = 1 else: self._result_verdict = 3 # Compute test verdict and comment verdict self.__compute_test_verdict__(self._result_verdict) return self._result_verdict, self._verdict_comment
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) self._voice_call_api.set_mute(1) # Check no audio on uplink after mute call. Check audio routing in downlink still after mute call audio_analyzer_result_ul = self._audio_analyzer.run( self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run( self._call_type, self._acc_type, "DL") # unmute call self._voice_call_api.set_mute(0) if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 0: # Check audio on uplink is back after unmute audio_analyzer_result_ul = self._audio_analyzer.run( self._call_type, self._acc_type, "UL") audio_analyzer_result_dl = self._audio_analyzer.run( self._call_type, self._acc_type, "DL") if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0: audio_analyzer_result = 0 else: audio_analyzer_result = 4 else: audio_analyzer_result = 4 # Compute test verdict and comment verdict self.__compute_test_verdict__(audio_analyzer_result) return self._result_verdict, self._verdict_comment
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) if self._acc_type == "HEADSET": if self._use_io_card: self._wired_headset.unplug_headphone() self._wired_headset.plug_whs() elif self._acc_type == "HEADPHONE": if self._use_io_card: self._wired_headset.unplug_whs() self._wired_headset.plug_headphone() # Dial using PHONE_NUMBER parameter self._phone_calling.dial(self._calling_phone_number) time.sleep(self._wait_btwn_cmd) # Wait for state "active" before callSetupTimeout seconds self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time) # Answer call self._phone_receiving.answer() # Phone1 & 2 : Check voice call is active self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) call_start_time = time.localtime() # Configure Audio output to acc_type given with the test_case if self._acc_type == "EARPIECE": if self._use_io_card: self._wired_headset.unplug_whs() self._wired_headset.unplug_headphone() elif self._acc_type == "SPEAKER": # Switch to Speaker, nothing to do in Earpiece # Bluetooth already done with connect Bluetooth function above self._phonesystem_api.switch_audio_output(self._acc_type.lower()) time.sleep(self._wait_btwn_cmd) if self._acc_type.find("BLUETOOTH") == -1: # Set Voice Call Volume self._system_api.adjust_specified_stream_volume( "VoiceCall", self._call_stream_volume_dut) else: # Set Voice Call Volume self._system_api.adjust_specified_stream_volume( "Bluetooth", self._call_stream_volume_dut) if self._system_api2: self._system_api2.adjust_specified_stream_volume( "VoiceCall", self._call_stream_volume_ref) self._logger.info("Begin audio checks - Call duration = %d s" % self._call_duration) while self._elapsed_time < self._call_duration and self._result_verdict is not Global.FAILURE: # Launch audio_quality test if self._signal_tested_direction in ["UL", "DL"]: audio_analyzer_result = self._audio_analyzer.run( self._call_type, self._acc_type, self._signal_tested_direction) # Compute test verdict and comment verdict LabAudioQualityBase.__compute_test_verdict__( self, audio_analyzer_result) else: # Test both UL and DL audio output audio_analyzer_result_ul = self._audio_analyzer.run( self._call_type, self._acc_type, "ul") audio_analyzer_result_dl = self._audio_analyzer.run( self._call_type, self._acc_type, "dl") # Compute test verdict and comment verdict for UL LabAudioQualityBase.__compute_test_verdict__( self, audio_analyzer_result_ul) if self._result_verdict is Global.SUCCESS: tmp = self._verdict_comment # Compute test verdict and comment verdict for DL LabAudioQualityBase.__compute_test_verdict__( self, audio_analyzer_result_dl) if self._result_verdict is Global.SUCCESS: self._verdict_comment += tmp # Wait for the next measurement to be made while checking the CSV call is still active if self._is_network_simulator_used: if self._call_origin_type in "MO": self._phone_receiving.is_voice_call_connected( self._wait_between_measure) elif self._call_origin_type in "MT": self._phone_calling.is_voice_call_connected( self._wait_between_measure) # Get elapsed time since call establishment in s self._elapsed_time = self._get_elapsed_time( call_start_time, time.localtime()) self._logger.info( "Time elapsed since the beginning of the call: %d s" % self._elapsed_time) # RELEASE THE CALL # Phone1 & 2 : Check call is still active self._phone_calling.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) self._phone_receiving.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) # Hang up call self._phone_releasing.release() # Phone1 & 2 : Check call is idle self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) return self._result_verdict, self._verdict_comment
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) if self._acc_type == "HEADSET": if self._use_io_card: self._wired_headset.unplug_headphone() self._wired_headset.plug_whs() elif self._acc_type == "HEADPHONE": if self._use_io_card: self._wired_headset.unplug_whs() self._wired_headset.plug_headphone() # Flight mode activation self._logger.info("Airplane mode switch on") self._networking_api.set_flight_mode("on") time.sleep(self._wait_btwn_cmd) # Flight mode desactivation self._logger.info("Airplane mode switch off") self._networking_api.set_flight_mode("off") # Wait networking go back self._logger.info("Wait networking go back") time.sleep(20) # Dial using PHONE_NUMBER parameter self._phone_calling.dial(self._calling_phone_number) time.sleep(self._wait_btwn_cmd) # Wait for state "active" before callSetupTimeout seconds self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time) # Answer call self._phone_receiving.answer() # Phone1 & 2 : Check voice call is active self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) # Configure Audio output to acc_type given with the test_case if self._acc_type == "EARPIECE": if self._use_io_card: self._wired_headset.unplug_headphone() self._wired_headset.unplug_whs() elif self._acc_type == "SPEAKER": # Switch to Speaker, nothing to do in Earpiece # Bluetooth already done with connect Bluetooth function above self._phonesystem_api.switch_audio_output(self._acc_type.lower()) time.sleep(self._wait_btwn_cmd) if self._acc_type.find("BLUETOOTH") == -1: # Set Voice Call Volume self._system_api.adjust_specified_stream_volume( "VoiceCall", self._call_stream_volume_dut) else: # Set Voice Call Volume self._system_api.adjust_specified_stream_volume( "Bluetooth", self._call_stream_volume_dut) self._system_api2.adjust_specified_stream_volume( "VoiceCall", self._call_stream_volume_ref) # WAIT FOR CALL DURATION self._logger.info("Wait for call duration: %s s..." % str(self._call_duration)) # Launch audio_quality test audio_analyzer_result = self._audio_analyzer.run( self._call_type, self._acc_type, self._signal_tested_direction) # Compute test verdict and comment verdict LabAudioQualityBase.__compute_test_verdict__(self, audio_analyzer_result) # RELEASE THE CALL # Phone1 & 2 : Check call is still active self._phone_calling.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) self._phone_receiving.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) # Hang up call self._phone_releasing.release() # Phone1 & 2 : Check call is idle self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) return self._result_verdict, self._verdict_comment
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) # In case of back-to-back iterations, the DUT or reference phone might have been unplugged if self._use_io_card: if self._device.get_state() == "unknown": self._io_card.usb_connector(plug=True) self._system_api.wait_for_device(timeout=60) self._device.connect_board() if self._io_card_2: if self._phone2.get_state() == "unknown": self._io_card_2.usb_connector(plug=True) self._system_api2.wait_for_device(timeout=60) self._phone2.connect_board() if self._phone_calling: if self._phone_calling.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL: self._logger.info("Read state of calling phone: %s" % self._phone_calling.get_sip_call_state()) self._phone_calling.release() self._phone_calling.wait_for_state( self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL, self._call_setup_time) if self._phone_receiving: if self._phone_receiving.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL: self._logger.info("Read state of receiving phone: %s" % self._phone_receiving.get_sip_call_state()) self._phone_receiving.release() self._phone_receiving.wait_for_state( self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL, self._call_setup_time) # Dial using PHONE_NUMBER parameter if self._phone_calling: if self._phone2: self._phone_calling.dial(self._calling_phone_number) else: self._phone_calling.dial(self._calling_phone_number, check_state=False) else: self._voip_server.start_mt_call(self._dut_sip_address.split('@')[0], self._peer_sip_address.split('@')[0]) if self._phone_receiving: self._phone_receiving.wait_for_state( self._uecmd_types.SIP_CALL_STATE.INCOMING_CALL, self._call_setup_time) self._phone_receiving.answer() # Phone1 & 2 : Check voice call is active if self._phone_calling: self._phone_calling.wait_for_state( self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time) if self._phone_receiving: self._phone_receiving.wait_for_state( self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time) # Set Voice Call Volume self._system_api.adjust_specified_stream_volume("VoiceCall", self._call_stream_volume_dut) if self._phone_receiving and self._phone2: self._system_api2.adjust_specified_stream_volume("VoiceCall", self._call_stream_volume_ref) start_time = time.localtime() if self._elapsed_time > 0: self._elapsed_time = 0 polqa_result_dl = [] polqa_result_ul = [] # Start audio quality measurement while self._elapsed_time < self._call_duration: # Unplug IO card(s) if self._use_io_card: self._device.disconnect_board() self._io_card.usb_connector(plug=False) if self._io_card_2: self._phone2.disconnect_board() self._io_card_2.usb_connector(plug=False) # If only 1 phone is used, the acquisition of DL and UL audio stream are done using a SIP server if not self._phone2: # For DL, switch to a playback call profile self._voip_server.change_call_profile(self._dut_sip_address.split('@')[0], VoIPServerCallUtilities.sip_profiles["PLAYBACK"]) # Start POLQA measurement in DL [tmp_polqa_result_dl, meas_in_range_dl] = self.__start_audio_quality_mos("POLQA", "DL", self._audio_analyzer_meas_retry) # If the current measurement result is not in the expected MOS range, do not take it into account if meas_in_range_dl: polqa_result_dl.append(float(tmp_polqa_result_dl)) # If User does not want to keep recorded audio file, it will not be stored # only if test is PASS if self._keep_record is True or polqa_result_dl[-1] < float(self._polqa_target): self._host_deg_file_path += time.strftime('%Y%m%d_%H%M%S', time.localtime()) + "_DL" ".wav" self._audio_analyzer.copy_from_upv(self._aa_deg_file_path, self._host_deg_file_path) self._host_deg_file_path = self._host_deg_file_path.split(str(time.localtime().tm_year))[0] if not self._phone2: # For UL, switch to a record call profile self._voip_server.change_call_profile(self._dut_sip_address.split('@')[0], VoIPServerCallUtilities.sip_profiles["RECORD"]) self._audio_analyzer.start_single_measurement(wait_for_result=False) self._audio_analyzer.wait_for_meas_state("measurement_terminated") self._voip_server_computer.copy_file_in_local_path(self._voip_server_deg_file, self._local_deg_file) # Copy degraded audio file to UPV for offline POLQA measurement self._audio_analyzer.copy_to_upv(os.path.join(self._aa_conf_path, self._degraded_audio_file), self._aa_deg_file_path) # Start POLQA measurement in offline mode [tmp_polqa_result_ul, meas_in_range_ul] = self.__start_audio_quality_mos("POLQA", "DL", self._audio_analyzer_meas_retry, load_setup=False, offline=True) else: # Start POLQA measurement in UL [tmp_polqa_result_ul, meas_in_range_ul] = self.__start_audio_quality_mos("POLQA", "UL", self._audio_analyzer_meas_retry) # Plug IO card(s) if self._use_io_card: self._io_card.usb_connector(plug=True) self._system_api.wait_for_device(timeout=60) self._device.connect_board() if self._io_card_2: self._io_card_2.usb_connector(plug=True) self._system_api2.wait_for_device(timeout=60) self._phone2.connect_board() # If the current measurement result is not in the expected MOS range, do not take it into account if meas_in_range_ul: polqa_result_ul.append(float(tmp_polqa_result_ul)) # If User does not want to keep recorded audio file, it will not be stored # only if test is PASS if self._keep_record is True or polqa_result_ul[-1] < float(self._polqa_target): self._host_deg_file_path += time.strftime('%Y%m%d_%H%M%S', time.localtime()) + "_UL" + ".wav" self._audio_analyzer.copy_from_upv(self._aa_deg_file_path, self._host_deg_file_path) self._host_deg_file_path = self._host_deg_file_path.split(str(time.localtime().tm_year))[0] if meas_in_range_dl and meas_in_range_ul: self._error.Msg = "Current POLQA result (DL/UL) : %f / %f, POLQA target : %s" % (polqa_result_dl[-1], polqa_result_ul[-1], self._polqa_target) self._logger.info(self._error.Msg) else: self._error.Msg = "POLQA result is out of range after %d retry. No usable result for this iteration." \ % self._audio_analyzer_meas_retry self._logger.error(self._error.Msg) self._result_verdict = Global.BLOCKED # Maintain the VOIP call for wait_between_measure s before starting a new measurement self._logger.info( "Maintain the VOIP call for %d s before starting a new measurement" % self._wait_between_measure) time.sleep(self._wait_between_measure) # Get elapsed time since call establishment in s self._elapsed_time = self.__get_elapsed_time(start_time, time.localtime()) # Check if call is still connected if self._sip_call_api.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.IN_CALL: msg = "VOIP call interrupted after %d seconds, state is %s !" % (self._elapsed_time, self._sip_call_api.get_sip_call_state()) self.get_logger().error(msg) raise DeviceException(DeviceException.INVALID_DEVICE_STATE, msg) else: self.get_logger().info( "VOIP call still connected after %d seconds!", self._elapsed_time) # RELEASE THE CALL # Phone1 & 2 : Check call is still active if self._phone_calling: self._phone_calling.wait_for_state( self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time) if self._phone_receiving: self._phone_receiving.wait_for_state( self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time) if self._phone_releasing: self._phone_releasing.release() time.sleep(self._wait_btwn_cmd) self._phone_releasing.wait_for_state( self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL, self._call_setup_time) else: self._voip_server.release_call(self._dut_sip_address.split('@')[0]) if self._phone_receiving: self._phone_receiving.wait_for_state( self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL, self._call_setup_time) if self._result_verdict is not Global.BLOCKED: self._error.Msg = "Median POLQA result (DL/UL) : %f / %f, POLQA target : %s" % ( float(numpy.median(numpy.array(polqa_result_dl))), float(numpy.median(numpy.array(polqa_result_ul))), self._polqa_target) # Compare the result of POLQA process with POLQA targets # Compute test verdict (if POLQA result > POLQA target the test pass, # else the test fails) if float(numpy.median(numpy.array(polqa_result_dl))) > float(self._polqa_target) \ and float(numpy.median(numpy.array(polqa_result_ul))) > float(self._polqa_target): self._logger.info(self._error.Msg) self._result_verdict = Global.SUCCESS else: self._logger.error(self._error.Msg) self._result_verdict = Global.FAILURE self._error.Msg += "" return self._result_verdict, self._error.Msg
def run_test(self): """ Execute the test """ # Call LabAudioQualityBase run_test function LabAudioQualityBase.run_test(self) if self._acc_type == "HEADSET": if self._use_io_card: self._wired_headset.unplug_headphone() self._wired_headset.plug_whs() elif self._acc_type == "HEADPHONE": if self._use_io_card: self._wired_headset.unplug_whs() self._wired_headset.plug_headphone() self._system_api.adjust_specified_stream_volume( "Ringtone", self._call_stream_volume_dut) # Dial using PHONE_NUMBER parameter self._phone_calling.dial(self._calling_phone_number) time.sleep(self._wait_btwn_cmd) # Wait for state "active" before callSetupTimeout seconds self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time) # Check ringtone audio_analyzer_result = self._audio_analyzer.ringtone_detection( self._acc_type) # Answer for all accessories except Bluetooth( auto answer by audio_analyzer for bt) if self._acc_type.find("BLUETOOTH") == -1: # Answer call self._phone_receiving.answer() # Phone1 & 2 : Check voice call is active self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time) # Compute test verdict and comment verdict LabAudioQualityBase.__compute_test_verdict__(self, audio_analyzer_result) # RELEASE THE CALL # Phone1 & 2 : Check call is still active self._phone_calling.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) self._phone_receiving.check_state( self._uecmd_types.VOICE_CALL_STATE.ACTIVE) # Hang up call self._phone_releasing.release() # Phone1 & 2 : Check call is idle self._phone_calling.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) self._phone_receiving.wait_for_state( self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time) return self._result_verdict, self._verdict_comment