【发布时间】:2021-03-20 02:44:31
【问题描述】:
环境:Ubuntu 20.04,Python
我的 BLE gatt 服务器实现大致基于此处的示例 - https://github.com/Douglas6/cputemp。
这是我的相关代码:
class RxCharacteristic(Characteristic):
def __init__(self, service):
self.notifying = False
Characteristic.__init__(self, RXCHARID,
['read', 'notify'], service)
def ReadValue(self, options):
value = []
return value
def StartNotify(self):
if self.notifying:
return
print('Notifying...')
self.notifying = True
当一个 BLE 特性以“notify”属性发布时,我的理解是 StartNotify/StopNotify 方法会被自动调用。我猜这发生在客户端连接/断开连接时。
就我而言,当我从“nRF Connect”Android 应用程序测试我的连接性时,我没有看到 StartNotify 被调用。
我想知道是什么触发了 StartNotify/StopNotify 方法的调用。为什么我没有看到它被调用?问候。
【问题讨论】: