delay() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 20)
})
},
send(){
let sendData = “232319a954696d3a32302f31312f30332031353a30323a303392e4” //发送数据
let buffer = string2buffer(sendData);
let pos = 0;
let bytes = buffer.byteLength;
let result = ‘’
while (bytes > 0) {
let tmpBuffer;
if (bytes > 20) {
tmpBuffer = buffer.slice(pos, pos + 20);
pos += 20;
bytes -= 20;
wx.writeBLECharacteristicValue({
deviceId: this._deviceId,
serviceId: this._serviceId,
characteristicId: this._characteristicId,
value: tmpBuffer,
success(res) {
console.log(‘发送成功!’, res)
},
fail: err => {
console.log(err)
}
})
} else {
tmpBuffer = buffer.slice(pos, pos + bytes);
pos += bytes;
bytes -= bytes;
wx.writeBLECharacteristicValue({
deviceId: this._deviceId,
serviceId: this._serviceId,
characteristicId: this._characteristicId,
value: tmpBuffer,
success(res) {
console.log(‘最后次发送’, res)
},
fail: function (res) {
console.log(‘发送失败’, res)
}
})
}
await this.delay()
}
}
在苹果11,输出2次发送成功,但是设备没有显示写入成功,间隔20毫秒发送一次,安卓小米8,输出2次发送成功,设备有显示时间已同步,但是只收到1次返回结果,看下面的协议Tim是完整的时间,怎么解决
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点(具体到分钟)