小程序蓝牙数据丢失的问题!大数据到底如何发送?
发布于 8 年前 作者 yanggang 2643 次浏览 来自 官方Issues

首先上代码:

var b =new Array();

b[0] = “0x88”;

b[1] = “0x06”;

b[2] = “0x05”;

b[3] = “0x05”;

b[4] = “0x05”;

b[5] = “0x06”;

b[6] = “0x05”;

b[7] = “0x05”;

b[8] = “0x05”;

b[9] = “0x05”;

b[10] = “0x05”;

b[11] = “0x05”;

b[12] = “0x00”;

b[13] = “0x00”;

b[14] = “0x00”;

b[15] = “0x02”;

b[16] = “0x75”;

b[17] = “0x00”;

b[18] = “0x00”;

b[19] = “0x00”;

b[20] = “0x00”;

b[21] = “0x00”;

b[22] = “0x00”;

onSendCommand() {

     for (var i=0;i<23;i++){

  let that = this;

   let buffer = new ArrayBuffer(1)

   let dataView = new DataView(buffer)

dataView.setUint8(0, b[i])

wx.writeBLECharacteristicValue({

deviceId: that.data.deviceId,

serviceId: that.data.serviceId,

characteristicId: that.data.characteristicId,

value: buffer,

success(res) { }

})

}
}

我这个代码 只能接受到大概15组数据,然后就接受不到数据了,,请问各位大佬,大神,大师,大哥们,,怎样才能让这22组数据,全部都能发出去呢!!???小弟感激不尽!

回到顶部