예제 #1
0
    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
예제 #2
0
    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()

        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