修复部分机型蓝牙报错的问题

This commit is contained in:
liub
2026-02-02 10:12:48 +08:00
parent 5399ecf359
commit f3d502b00e
3 changed files with 42 additions and 26 deletions

View File

@ -2,7 +2,7 @@
const config = { const config = {
// 开发环境 // 开发环境
development: { development: {
BASE_URL: 'http://139.224.253.23:8000',//http://139.224.253.23:8000 BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
API_PREFIX: '', API_PREFIX: '',
// MQTT 配置 // MQTT 配置
MQTT_HOST: 'www.cnxhyc.com', MQTT_HOST: 'www.cnxhyc.com',

View File

@ -2,7 +2,7 @@
"name" : "星汉物联", "name" : "星汉物联",
"appid" : "__UNI__A21EF43", "appid" : "__UNI__A21EF43",
"description" : "设备管控", "description" : "设备管控",
"versionName" : "1.0.13", "versionName" : "1.0.14",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */

View File

@ -190,7 +190,7 @@
these.device = rec.data; these.device = rec.data;
if (rec.data.bluetoothName) { if (rec.data.bluetoothName) {
these.search = rec.data.bluetoothName; these.search = rec.data.bluetoothName;
}else if(rec.data.deviceName){ } else if (rec.data.deviceName) {
these.search = rec.data.deviceName; these.search = rec.data.deviceName;
} }
@ -533,21 +533,15 @@
return; return;
} }
} }
showLoading(these,{text:'正在刷新'})
let time = null;
let startSearch = () => {
if(time){
clearTimeout(time);
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
});
} }
Promise.allSettled(disconnectPromises).finally(() => { time = setTimeout(() => {
these.EquipMents = []; these.EquipMents = [];
these.PairEquip = []; these.PairEquip = [];
@ -563,8 +557,31 @@
content: '开始搜索失败:' + err.msg content: '开始搜索失败:' + err.msg
}); });
} }
}).finally(()=>{
hideLoading(these);
}); });
}, 500);
}
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
if (device.Linked) {
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
}
}); });
}
if (disconnectPromises.length > 0) {
Promise.allSettled(disconnectPromises).finally(() => {
startSearch();
});
} else {
startSearch();
}
}); });
@ -678,8 +695,7 @@
console.log("客户端验证失败"); console.log("客户端验证失败");
deviceInvalid(); deviceInvalid();
return; return;
} } else if (f.macAddress == these.device.deviceMac) {
else if (f.macAddress == these.device.deviceMac){
console.log("客户端验证成功"); console.log("客户端验证成功");
deviceOK(); deviceOK();
} }