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)
def error(self, error): print("Sevice.error()", self.device.address, self.uuid.toString(), qenum_key(QtBt.QLowEnergyService, error))
def error(self, error): print("error():", qenum_key(QtBt.QBluetoothDeviceDiscoveryAgent, error))
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)