Exemple #1
0
    def stateChanged(self, state):
        print("stateChanged()", self.device.address, self.uuid.toString(),
              qenum_key(QtBt.QLowEnergyService, state))
        if state == QtBt.QLowEnergyService.ServiceState.ServiceDiscovered:
            self.characteristics = self.service.characteristics()

            for c in self.characteristics:
                print(c.name(),
                      qenum_key(QtBt.QLowEnergyCharacteristic, c.properties()))
                if ServiceHandler.supportsNotify(c):
                    self.enableNotify(c)
Exemple #2
0
 def error(self, error):
     print("Sevice.error()", self.device.address, self.uuid.toString(),
           qenum_key(QtBt.QLowEnergyService, error))
Exemple #3
0
 def error(self, error):
     print("error():", qenum_key(QtBt.QBluetoothDeviceDiscoveryAgent,
                                 error))
Exemple #4
0
 def error(self, error):
     print("device.error()", self.address,
           qenum_key(QtBt.QLowEnergyController, error))
     if qenum_key(QtBt.QLowEnergyController, error) == "UnknownError":
         self.connection.disconnectFromDevice()
         QtCore.QTimer.singleShot(5000, self.cleanup)