作为标题,现在我可以从 BLE 设备获取值,如以下代码所示:
class RobotDelegate(object):
...
def peripheral_didDiscoverCharacteristicsForService_error_(self, peripheral, service, error):
for characteristic in self.service.characteristics():
if characteristic.UUID() == blebee_characteristic:
self.characteristic = characteristic
print ("self.characteristic.value = ", self.characteristic.value())
...
delegate = RobotDelegate()
manager = CBCentralManager.alloc()
manager.initWithDelegate_queue_options_(delegate, None, None)
AppHelper.runConsoleEventLoop()
而且我只能从我的BLE设备中读取一次值......实际上,当有人触摸时,BLE设备可以不断更新值,所以我想知道我应该怎么做才能做到这一点?谢谢。