oppo手机调用这个方法连接蓝牙门锁设备很慢,有时甚至连接不上,手机型号:oppo Reno Ace,系统是 android 12,
deviceId = that.data.roomMsg.mac
wx.openBluetoothAdapter({
mode:"central",
success (resqq) {
console.log(resqq)
if(resqq.errno==0){
wx.createBLEConnection({
deviceId:deviceId,
success (resaa) {
console.log(resaa)
if(resaa.errCode==0){
// 调用开锁接口
plugin.controlLock(plugin.ControlAction.OPEN, app.data.keyInfo.lockData, res => {
if (res.errorCode === 10003) {
console.log("获取版本信息时设备连接已断开", res)
}
}, null, deviceId).then(res => {
wx.hideLoading();
console.log(res)
if (!!res.deviceId) deviceId = res.deviceId;
if (res.errorCode === 0) {
that.insertDoorOperSetLog(res.electricQuantity,0,res.errorCode,'')
// wx.showModal({
// content: `已开锁`,
// showCancel: false,
// success(res3) {
// if (res3.confirm) {}
// }
// })
wx.showToast({
title: '已开锁',
icon: 'none'
})
} else {
that.insertDoorOperSetLog('',2,res.errorCode,res.errorMsg)
wx.showModal({
content: `开锁失败: ${res.errorMsg}`,
showCancel: false,
success(res3) {
if (res3.confirm) {}
}
})
}
})
}else{
wx.showModal({
content: `开锁失败: ${resaa.errorMsg}`,
showCancel: false,
success(res3) {
}
})
}
}
})
}
}
})