Commit 0e823eb6 authored by magho's avatar magho

added a ble disconnect workaround

parent a6c285b9
......@@ -66,7 +66,7 @@ class ModuleDevice(gatt.Device):
def connect_failed(self, error):
super().connect_failed(error)
print("[%s] Connection failed: %s" % (self.mac_address, str(error)))
print("[%s] Connection lost: %s" % (self.mac_address, str(error)))
def disconnect_succeeded(self):
super().disconnect_succeeded()
......@@ -98,8 +98,8 @@ class ModuleDevice(gatt.Device):
else:
print("Failed to fetch values")
# DBus is taking its time getting back on disconnect(), which blocks
# DBus is taking its time getting back with a reply on self.disconnect(), which blocks
# the whole process, so we offload this work to a different process.
#os.system("bluetoothctl disconnect %s" % self.mac_address)
#subprocess.Popen(["bluetoothctl", "disconnect", self.mac_address], shell=True)
subprocess.Popen(["bluetoothctl", "disconnect %s" % self.mac_address], shell=True)
# TODO: Find a nicer way of doing this.
#self.disconnect()
subprocess.Popen(["/usr/bin/bt-device", "--remove=%s" % self.mac_address])
......@@ -63,9 +63,7 @@ class RFIDManager(QtCore.QThread):
except KeyError:
continue
if key == u'CRLF':
if len(self.rfid_string) == 10:
print("[RFID]: rfid not of len() == 10: %s" % self.rfid_string)
self.rfid_received(self.rfid_string)
self.rfid_received(self.rfid_string)
self.rfid_string = ""
else:
self.rfid_string += key
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment