成功调用写函数readBLECharacteristicValue 设备收到的却会丢包 如何解决 丢包的问题?
- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
setTimeout(function writeData() {
//处理中
wx.writeBLECharacteristicValue({
deviceId: deviceId,
serviceId: serviceId,
characteristicId: characteristicId,
value: buffer,
success: function (res) {
alllength90 += bufferlength
console.log(TLing)
endTime = new Date().getTime()
console.log('endTime-startTime:' + (endTime - startTime)+"ms")
startTime = endTime;
if (TLing++ == 1000) {
endTime = new Date().getTime()
console.log('endTime-startTime:' + (endTime - startTime)+"ms")
console.log('字节数:' + alllength90)
console.log(res)
TLing = 1
return
}else{
setTimeout(writeData, 30);
}
},
fail:function(){
console.log('写入失败')
}
});
}, 30);