writeBLECharacteristicValue 写入问题
//向低功耗蓝牙设备特征值中写入二进制数据 writeBLECharacteristicValue: function (e) { var that = this ; wx.onBLECharacteristicValueChange( function (characteristic) { that.setData({ msg_3: JSON.stringify(characteristic) }) }) // 向蓝牙设备发送一个0x00的16进制数据 let buffer = new ArrayBuffer(4) let dataView = new DataView(buffer) dataView.setUint8(0, 0x0D) dataView.setUint8(1, 0x02) dataView.setUint8(2, 0x11) dataView.setUint8(3, 0x13) wx.writeBLECharacteristicValue({ deviceId: that.data.deviceId, serviceId: that.data.uuid, characteristicId: that.data.characteristicId, value: buffer, success: function (res) { that.setData({ msg_2: JSON.stringify(res) }) } }) }, |
请问 value: buffer, 这样写对吗?
显示是成功写入的,但 onBLECharacteristicValueChange 没有回调信息