BLESession.handle_request: Simplify Peripheral constructor call

Passing the device variable itself into Peripheral() will give the addr,
addrType and the iface to the Peripheral().
This commit is contained in:
ErrorJan
2020-08-03 14:16:51 +02:00
committed by Shin'ichiro Kawasaki
parent e281543cb8
commit 3a68a0109e

View File

@@ -549,8 +549,7 @@ class BLESession(Session):
self.device = self.found_devices[params['peripheralId']]
self.deviceName = self.device.getValueText(0x9) or self.device.getValueText(0x8)
try:
self.perip = Peripheral(self.device.addr,
self.device.addrType)
self.perip = Peripheral(self.device)
logger.info(f"connected to the BLE peripheral: {self.deviceName}")
except BTLEDisconnectError as e:
logger.error(f"failed to connect to the BLE device \"{self.deviceName}\": {e}")