def setup_test(self): CoexBaseTest.setup_test(self) self.audio_receiver.enter_pairing_mode() if not pair_and_connect_headset( self.pri_ad, self.audio_receiver.mac_address, set([BtEnum.BluetoothProfile.HEADSET.value])): self.log.error("Failed to pair and connect to headset.") return False
def setup_test(self): super().setup_test() self.audio_receiver.enter_pairing_mode() time.sleep(5) #Wait until device goes into pairing mode. if not pair_and_connect_headset( self.pri_ad, self.audio_receiver.mac_address, set([BtEnum.BluetoothProfile.A2DP.value])): self.log.error("Failed to pair and connect to headset") return False self.audio = AudioCapture(self.pri_ad, self.audio_params)
def initiate_classic_connection_to_multiple_devices(self): """Initiates multiple BR/EDR connections. Steps: 1. Initiate A2DP Connection. 2. Initiate HFP Connection. 3. Disconnect A2DP Connection. 4. Disconnect HFP Connection. 5. Repeat step 1 to 4. Returns: True if successful, False otherwise. """ for i in range(self.iterations): if not pair_and_connect_headset( self.pri_ad, self.receiver.mac_address, {BtEnum.BluetoothProfile.A2DP.value}): self.log.error("Failed to connect A2DP Profile.") return False time.sleep(2) if not pair_and_connect_headset( self.pri_ad, self.audio_receiver.mac_address, {BtEnum.BluetoothProfile.HEADSET.value}): self.log.error("Failed to connect HEADSET profile.") return False time.sleep(2) if not disconnect_headset_from_dev( self.pri_ad, self.receiver.mac_address, [BtEnum.BluetoothProfile.A2DP.value]): self.log.error("Could not disconnect {}".format( self.receiver.mac_address)) return False if not disconnect_headset_from_dev( self.pri_ad, self.audio_receiver.mac_address, [BtEnum.BluetoothProfile.HEADSET.value]): self.log.error("Could not disconnect {}".format( self.audio_receiver.mac_address)) return False return True
def setup_test(self): super().setup_test() self.bt_device.power_on() self.headset_mac_address = self.bt_device.mac_address self.bt_device.enter_pairing_mode() self.pri_ad.droid.bluetoothStartPairingHelper(True) self.pri_ad.droid.bluetoothMakeDiscoverable() if not pair_and_connect_headset( self.pri_ad, self.headset_mac_address, set([BtEnum.BluetoothProfile.A2DP.value])): self.log.error('Failed to pair and connect to headset') return False