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:
parent
5deafe9d4a
commit
a6a5f12e6c
@ -70,7 +70,6 @@ class BluepyThreadedPeripheral(object):
|
|||||||
finally:
|
finally:
|
||||||
self._peripheral.disconnect()
|
self._peripheral.disconnect()
|
||||||
|
|
||||||
|
|
||||||
def write(self, handle, data):
|
def write(self, handle, data):
|
||||||
self._call_queue.put(lambda: self._peripheral.writeCharacteristic(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)
|
name = dev.getValueText(COMPLETE_LOCAL_NAME_ADTYPE)
|
||||||
log.debug("Found dev, name: {}, address: {}".format(name, address))
|
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:
|
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
|
||||||
logging.info("Found %s at %s", name, address)
|
logging.info("Found %s at %s", name, address)
|
||||||
self._peripheral = BluepyThreadedPeripheral(address, addressType, self._controller)
|
self._peripheral = BluepyThreadedPeripheral(address, addressType, self._controller)
|
||||||
@ -122,4 +122,3 @@ class BluepyConnection(Connection):
|
|||||||
|
|
||||||
def is_alive(self):
|
def is_alive(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ class GattConnection(Connection):
|
|||||||
address = dev.mac_address
|
address = dev.mac_address
|
||||||
name = dev.alias()
|
name = dev.alias()
|
||||||
logging.debug("Device %s at %s", name, address)
|
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:
|
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
|
||||||
logging.info("Found %s at %s", name, address)
|
logging.info("Found %s at %s", name, address)
|
||||||
self._device = CustomDevice(address, self._manager)
|
self._device = CustomDevice(address, self._manager)
|
||||||
|
@ -70,6 +70,7 @@ class GattLibConnection(Connection):
|
|||||||
log.debug("Devices: %s", devices)
|
log.debug("Devices: %s", devices)
|
||||||
|
|
||||||
for address, name in devices.items():
|
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:
|
if (not hub_mac and name == LEGO_MOVE_HUB) or hub_mac == address:
|
||||||
logging.info("Found %s at %s", name, address)
|
logging.info("Found %s at %s", name, address)
|
||||||
self.requester = Requester(address, True, self._iface)
|
self.requester = Requester(address, True, self._iface)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user