forked from sqozz/sem6000
Instantiate Peripheral on class initialization
This commit is contained in:
parent
8b7e88db74
commit
a91eb91ac6
1 changed files with 2 additions and 4 deletions
|
@ -20,6 +20,7 @@ class SEMSocket():
|
|||
def __init__(self, mac, auto_reconnect_timeout = None):
|
||||
self.mac_address = mac
|
||||
self.auto_reconnect_timeout = auto_reconnect_timeout
|
||||
self._btle_device = btle.Peripheral(None ,addrType=btle.ADDR_TYPE_PUBLIC,iface=0)
|
||||
try:
|
||||
self.reconnect()
|
||||
except self.NotConnectedException:
|
||||
|
@ -96,9 +97,6 @@ class SEMSocket():
|
|||
|
||||
def connect(self):
|
||||
self.disconnect()
|
||||
if not self._btle_device:
|
||||
self._btle_device = btle.Peripheral(self.mac_address,addrType=btle.ADDR_TYPE_PUBLIC,iface=0)
|
||||
else:
|
||||
self._btle_device.connect(self.mac_address)
|
||||
self._btle_handler = self.BTLEHandler(self)
|
||||
|
||||
|
|
Loading…
Reference in a new issue