定位到问题了,发现写和订阅的uuid相同了导致写不了,是硬件固件的问题,硬件那边修改name后导致两个uuid一样了。谢谢。
wx.writeBLECharacteristicValue 10007?write为true,但还是报10007 [图片] [图片] 方法: SendTap: function () { var that = this if (that.data.connected) { var buffer = new ArrayBuffer(that.data.inputText.length) var dataView = new Uint8Array(buffer) for (var i = 0; i < that.data.inputText.length; i++) { dataView[i] = that.data.inputText.charCodeAt(i) } wx.writeBLECharacteristicValue({ deviceId: that.data.connectedDeviceId, serviceId: that.data.serviceId, characteristicId: that.data.characteristics, value: buffer, success: function (res) { console.log('发送成功') }, fail:(err)=>{ console.log(err) } }) } else { wx.showModal({ title: '提示', content: '蓝牙已断开', showCancel: false, success: function (res) { that.setData({ searching: false }) } }) } },
2021-10-22