Example #1
0
    def teardown_class(self):
        """Clean up the test class after tests finish running

        """
        super().teardown_class()
        self.dut.droid.bluetoothFactoryReset()
        self.dut.adb.shell(BLE_LOCATION_SCAN_DISABLE)
        self.bt_device.reset()
        self.bt_device.power_off()
        btutils.disable_bluetooth(self.dut.droid)
Example #2
0
    def teardown_class(self):

        super().teardown_class()
        self.dut.droid.bluetoothFactoryReset()

        # Stopping BT on slave
        self.bt_device.reset()
        self.bt_device.power_off()

        #Stopping BT on master
        bt_utils.disable_bluetooth(self.dut.droid)
Example #3
0
    def teardown_test(self):
        #Stopping Music
        if hasattr(self, 'media'):
            self.media.stop()

        # Stopping BT on slave
        self.bt_device.reset()
        self.bt_device.power_off()

        #Stopping BT on master
        bt_utils.disable_bluetooth(self.dut.droid)

        #Resetting the atten to initial levels
        self.attenuator.set_atten(self.atten_min)
        self.log.info('Attenuation set to {} dB'.format(self.atten_min))
Example #4
0
    def teardown_test(self):
        """Tear down necessary objects after test case is finished.

        Bring down the AP interface, delete the bridge interface, stop the
        packet sender, and reset the ethernet interface for the packet sender
        """
        super().teardown_test()
        self.dut.droid.bluetoothFactoryReset()
        self.dut.adb.shell(BLE_LOCATION_SCAN_DISABLE)
        if hasattr(self, 'media'):
            self.media.stop()
        # Set Attenuator to the initial attenuation
        if hasattr(self, 'attenuators'):
            self.set_attenuation(INIT_ATTEN)
        self.bt_device.reset()
        self.bt_device.power_off()
        btutils.disable_bluetooth(self.dut.droid)
Example #5
0
 def teardown_test(self):
     self.parsing_results()
     with open(self.json_file, 'a') as results_file:
         json.dump(self.result, results_file, indent=4, sort_keys=True)
     if not disable_bluetooth(self.pri_ad.droid):
         self.log.info('Failed to disable bluetooth')
         return False
     self.destroy_android_and_relay_object()
 def teardown_test(self):
     self.performance_baseline_check()
     for i in range(self.num_atten):
         self.attenuators[i].set_atten(0)
         current_atten = int(self.attenuators[i].get_atten())
         self.log.debug(
             "Setting attenuation to zero : Current atten {} : {}".format(
                 self.attenuators[i], current_atten))
     self.a2dp_streaming = False
     if not disable_bluetooth(self.pri_ad.droid):
         self.log.info("Failed to disable bluetooth")
         return False
     self.destroy_android_and_relay_object()
     self.rvr = {}
Example #7
0
 def destroy_android_and_relay_object(self):
     """Destroys android device object and relay device object if required
     devices has android device and relay device."""
     if hasattr(self, 'required_devices'):
         if ('discovery' in self.current_test_name
                 or 'ble' in self.current_test_name):
             if hasattr(self, 'inquiry_devices'):
                 for device in range(len(self.inquiry_devices)):
                     inquiry_device = self.inquiry_devices[device]
                     if not disable_bluetooth(inquiry_device.droid):
                         self.log.info('Failed to disable bluetooth')
                 android_device.destroy(self.inquiry_devices)
             if hasattr(self, 'relay'):
                 relay_device_controller.destroy(self.relay)
Example #8
0
def toggle_bluetooth(pri_ad, duration):
    """Toggles bluetooth on/off for N iterations.

    Args:
        pri_ad: An android device object.
        duration: Iperf duration of the test.

    Returns:
        True if successful, False otherwise.
    """
    start_time = time.time()
    while time.time() < start_time + duration:
        if not enable_bluetooth(pri_ad.droid, pri_ad.ed):
            pri_ad.log.error("Failed to enable bluetooth")
            return False
        time.sleep(BLUETOOTH_WAIT_TIME)
        if not disable_bluetooth(pri_ad.droid):
            pri_ad.log.error("Failed to turn off bluetooth")
            return False
        time.sleep(BLUETOOTH_WAIT_TIME)
    return True