Commit 2eafc9ee authored by magho's avatar magho

minor changes

parent e420aac6
......@@ -59,15 +59,17 @@ class NeoKomp(QtWidgets.QMainWindow):
# Initial state
self.central_widget.setCurrentWidget(self.frames['Guide'])
# Make RFID manager
self.rfid_manager = rfid.RFIDManager(self)
self.rfid_manager.start()
# Connect signal
self.rfid_manager.rfid_signal.connect(self.rfid_received)
# Make BLE manager
self.ble_manager = ble.BLEThread(self, self.device_mapping)
self.ble_manager.start()
# Connect signal
self.ble_manager.button_pressed.connect(self.ble_button_pressed)
def enter_event(self, event):
"""Send enter event to the relevant frame"""
......
......@@ -18,21 +18,18 @@ class BLEThread(QtCore.QThread):
self.parent = parent
self.device_mapping = device_mapping
# Make sure ble is on and not currently connected
os.system("bluetoothctl power off")
os.system("bluetoothctl power on")
# Find primary Bluetooth controller.
ctrl_info = subprocess.check_output(['btmgmt', 'info']).decode('utf-8')
pattern = r"([a-zA-Z]+[0-9]+):\tPrimary controller"
primary_ctrl = re.search(pattern, ctrl_info).group(1)
# Make sure ble is on and not currently connected
os.system("bluetoothctl power off")
os.system("bluetoothctl power on")
# Create BLE Manager
self.manager = BLEManager(parent=self, adapter_name=primary_ctrl)
# Connect signal
self.button_pressed.connect(parent.ble_button_pressed)
def __del__(self):
self.wait()
......
......@@ -13,9 +13,6 @@ class RFIDManager(QtCore.QThread):
self.init_device()
# Connect signal to NeoKomp
self.rfid_signal.connect(parent.rfid_received)
# We only need numbers and CRLF for RFID
self.scancodes = {
0: None, 1: u'ESC', 2: u'1', 3: u'2', 4: u'3', 5: u'4', 6: u'5', 7: u'6', 8: u'7', 9: u'8',
......
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