发送代码如下:
var buffer1 = new ArrayBuffer(2);
var uint8Array = new Uint8Array(buffer1);
uint8Array[0]=254;
uint8Array[1]=207;
wx.writeBLECharacteristicValue({
deviceId: that.data.deviceId,
serviceId: that.data.serviceId,
characteristicId: that.data.write,
value: uint8Array.buffer,
最终提示发送成功,但是发送的数据为空,请问该如何传值,多谢!
BTW:
数据封装采用官方提供的:
let buffer = new ArrayBuffer(2)
let object = new DataView(buffer)
object.setUint8(0, 254)
object.setUint8(1, 207)
将value:buffer
此种方式也是行不通。