From 9d88ce9dcfe6ea05660ad96e1dbe75113b6c1681 Mon Sep 17 00:00:00 2001 From: aero-man Date: Sat, 21 Nov 2020 21:29:04 -0700 Subject: [PATCH] Make Peripheral connection less repetitive --- bluepy/btle.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bluepy/btle.py b/bluepy/btle.py index 023a0f22..e6569d70 100755 --- a/bluepy/btle.py +++ b/bluepy/btle.py @@ -405,10 +405,7 @@ def __init__(self, deviceAddr=None, addrType=ADDR_TYPE_PUBLIC, iface=None): self._serviceMap = None # Indexed by UUID (self.deviceAddr, self.addrType, self.iface) = (None, None, None) - if isinstance(deviceAddr, ScanEntry): - self._connect(deviceAddr.addr, deviceAddr.addrType, deviceAddr.iface) - elif deviceAddr is not None: - self._connect(deviceAddr, addrType, iface) + self.connect(deviceAddr, addrType=addrType, iface=iface) def setDelegate(self, delegate_): # same as withDelegate(), deprecated return self.withDelegate(delegate_)