onBLECharacteristicValueChange获取不到变化
- 当前 Bug 的表现(可附上截图) ios小程序 开启了notify 可以获取到特征值变化如下图: [图片] 同样代码Android小程序 notify也是开启成功,但是收不到特征值变化 [图片] - 预期表现 - 复现路径 - 提供一个最简复现 Demo 代码贴上 wx.getBLEDeviceServices({ // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接 deviceId: deviceId, success: function(res3) { console.log('device services:', res3.services) wx.getBLEDeviceCharacteristics({ // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接 deviceId: deviceId, // 这里的 serviceId 需要在上面的 getBLEDeviceServices 接口中获取 serviceId: that.globalData.serviceId, success: function(res2) { console.log('device getBLEDeviceCharacteristics:', res2.characteristics) wx.notifyBLECharacteristicValueChange({ deviceId: deviceId, serviceId: serviceId, characteristicId: characteristicId, state: true, type: 'notification', success: function(res) { console.log(res) console.log('notify开启成功') setTimeout(function() { wx.onBLECharacteristicValueChange(function(characteristic) { console.log('characteristic value comed:', that.buf2hex(characteristic.value)); }) }, 1000) }, fail: function(r) { console.log(r) } }) setTimeout(function() { wx.writeBLECharacteristicValue({ //开锁指令 deviceId: deviceId, serviceId: serviceId, characteristicId: characteristicId, value: buffer, success: function(res) { console.log(res) console.log('writeBLECharacteristicValue success', res.errMsg) wx.readBLECharacteristicValue({ deviceId: deviceId, serviceId: serviceId, characteristicId: characteristicId, success: function(res) { console.log(res) }, fail: function(e) { console.log(e) } }) }, 1000); }, fail: function(e) { console.log('获取特征值') console.log(e) } }) } })