Skip to content

Commit

Permalink
Allow a name suffix in the bluetooth alias (#90)
Browse files Browse the repository at this point in the history
Currently PineTime watches are detected by the device alias so if the
user changes the alias they are no longer listed in Siglo. This is
pretty hard to fix because there's no good way to actually detect it any
other way. This fix lets people at least add an suffix to the alias to
differentiate devices.
  • Loading branch information
MartijnBraam authored Oct 7, 2021
1 parent 78f7b6c commit 950ade7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ def set_timeout(self, timeout):
GObject.timeout_add(timeout, self.stop)

def device_discovered(self, device):
if device.alias() in ("InfiniTime", "Pinetime-JF", "PineTime"):
self.scan_result = True
self.aliases[device.mac_address] = device.alias()
self.device_set.add(device.mac_address)
for prefix in ["InfiniTime", "Pinetime-JF", "PineTime"]:
if device.alias().startswith(prefix):
self.scan_result = True
self.aliases[device.mac_address] = device.alias()
self.device_set.add(device.mac_address)

def scan_for_infinitime(self):
self.start_discovery()
Expand Down

0 comments on commit 950ade7

Please sign in to comment.