跪求懂的人回复一下
为什么wx.onBLECharacteristicValueChange()不执行?wx.notifyBLECharacteristicValueChange({ state: true, // 启用 notify 功能 deviceId: that.data.deviceId, serviceId: that.data.serviceId, characteristicId: that.data.charaId, success(res) { console.log('notifyBLECharacteristicValueChange success', res.errMsg) } }) function ab2hex(buffer) { let hexArr = Array.prototype.map.call( new Uint8Array(buffer), function (bit) { return ('00' + bit.toString(16)).slice(-2) } ) return hexArr.join(''); } wx.onBLECharacteristicValueChange(function (res) { console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`) console.log(ab2hex(res.value)) 之前代码的characteristic里的write,read都为true,但writeDefault:false wirtenoresponse:true 我不知道跟这个有没有关系,导致我notify是success和ok,writeBLECharacteristicValue也可以正常实现,但onble这个函数却不执行
2023-10-14