1
0
mirror of https://github.com/undera/pylgbst.git synced 2020-11-18 19:37:26 -08:00

Make all backends aware of zero address

This commit is contained in:
Andrey Pokhilko 2019-09-07 23:10:34 +03:00
parent 5deafe9d4a
commit a6a5f12e6c
4 changed files with 21 additions and 20 deletions

View File

@ -70,7 +70,6 @@ class BluepyThreadedPeripheral(object):
finally:
self._peripheral.disconnect()
def write(self, handle, data):
self._call_queue.put(lambda: self._peripheral.writeCharacteristic(handle, data))
@ -103,6 +102,7 @@ class BluepyConnection(Connection):
name = dev.getValueText(COMPLETE_LOCAL_NAME_ADTYPE)
log.debug("Found dev, name: {}, address: {}".format(name, address))
if address != "00:00:00:00:00:00":
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
logging.info("Found %s at %s", name, address)
self._peripheral = BluepyThreadedPeripheral(address, addressType, self._controller)
@ -122,4 +122,3 @@ class BluepyConnection(Connection):
def is_alive(self):
return True

View File

@ -101,6 +101,7 @@ class GattConnection(Connection):
address = dev.mac_address
name = dev.alias()
logging.debug("Device %s at %s", name, address)
if address != "00:00:00:00:00:00":
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
logging.info("Found %s at %s", name, address)
self._device = CustomDevice(address, self._manager)

View File

@ -70,6 +70,7 @@ class GattLibConnection(Connection):
log.debug("Devices: %s", devices)
for address, name in devices.items():
if address != "00:00:00:00:00:00":
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
logging.info("Found %s at %s", name, address)
self.requester = Requester(address, True, self._iface)