处理100J设备蓝牙问题

This commit is contained in:
微微一笑
2026-03-19 14:36:17 +08:00
parent ac59e28281
commit 3a9de3078c
4 changed files with 102 additions and 43 deletions

View File

@ -61,7 +61,8 @@ class BleHelper {
LinkedList: linkedDevices, //已连接的设备列表
platform: systemInfo.uniPlatform,
Disconnect: [], //主动断开的设备
connectingDevices: {} //正在连接的设备
connectingDevices: {}, //正在连接的设备
voiceUploading: false //语音上传中(上传中不主动断开蓝牙)
}
this.cfg = {
onDeviceFound: [], //发现新设备的事件
@ -561,7 +562,7 @@ class BleHelper {
return;
}
if (!this.data.isOpenBlue) {
console.error("蓝牙模块未打开");
console.log("蓝牙模块未打开,即将初始化");
resolve({
available: false,
discovering: false
@ -1624,7 +1625,7 @@ class BleHelper {
// console.log("正在连接" + deviceId);
uni.createBLEConnection({
deviceId: deviceId,
timeout: 15000,
timeout: 20000,
success: (info) => {
//释放连接锁
@ -1808,6 +1809,13 @@ class BleHelper {
});
return prom;
}
// 语音上传中不主动断开:设置/查询上传状态App onHide 时检查)
setVoiceUploading(flag) {
this.data.voiceUploading = !!flag;
}
isVoiceUploading() {
return !!this.data.voiceUploading;
}
//断开连接
disconnectDevice(deviceId) {
if (this.data.platform == 'web') {