Example #1
0
 def connectCurrentDevice(self):
     if self.m_device is not None:
         self.m_control = QtBluetooth.QLowEnergyController(self.m_device)
         self.m_control.discoveryFinished.connect(self.onServiceScanDone)
         self.m_control.connected.connect(self.onDeviceConnected)
         self.m_control.disconnected.connect(self.onDeviceDisconnected)
         self.m_control.connectToDevice()
     else:
         self.deviceDisconnected.emit()
Example #2
0
 def foo(self, *args, **kwargs):
     # print('foo', args, kwargs)
     if len(args):
         if args[0].name() == 'NIST0002':
             print(args[0].name())
             self.controller = QtBt.QLowEnergyController(
                 args[0]).createCentral(args[0])
             self.controller.connected.connect(self.c)
             self.controller.serviceDiscovered.connect(self.service)
             self.controller.discoveryFinished.connect(
                 self.discoveryFinished)
             self.controller.connectToDevice()
             print(self.controller)
Example #3
0
 def connectCurrentDevice(self):
     if self.m_device is None:
         self.deviceDisconnected.emit()
         return
     if self.m_control:
         self.m_control.disconnectFromDevice()
         self.m_control = None
     self.m_control = QtBluetooth.QLowEnergyController(self.m_device)
     self.m_control.serviceDiscovered.connect(self.onServiceDiscovered)
     self.m_control.discoveryFinished.connect(self.onServiceScanDone)
     self.m_control.error.connect(self.onControllerError)
     self.m_control.connected.connect(self.onDeviceConnected)
     self.m_control.disconnected.connect(self.onDeviceDisconnected)
     self.m_control.connectToDevice()