蓝牙监听不一致,几天了都没解决,求助!!
同样的代码,同一个设备,安卓没有问题,但IOS就会报:
notifyBLECharacteristicValueChange:fail setNotifyOnCharacteristics error 10007
var that = this;
wx.notifyBLECharacteristicValueChange({
state: true, // 启用 notify 功能
deviceId: that.data.deviceId,
serviceId: that.data.serviceId,
characteristicId: that.data.notifyCharacteristicId,
success: function (res) {
console.log('[ok]8.2 notify启动成功', res.errMsg);
console.log('[监听]' + that.data.deviceId + '--' + that.data.serviceId + '--' + that.data.notifyCharacteristicId);
that.onBLECharacteristicValueChange(); //监听特征值变化
},
fail: function (res) {
console.log('[ok]8.2 notify启动失败', res.errMsg);
console.log('[监听]' + that.data.deviceId + '--' + that.data.serviceId + '--' + that.data.notifyCharacteristicId);
wx.showToast({
title: 'notify启动失败',
mask: true
});
setTimeout(function () {
wx.hideToast();
}, 2000)
}