fix(equipment): 进入页面不再信任缓存的蓝牙连接状态,每次走真实扫描
- _checkAndAutoConnect 去掉 isConnected+deviceInfo 缓存短路,始终走 autoConnect - autoConnect 去掉 isConnected 短路,每次真实扫描 - connect() 先断开旧连接再建新连接,避免新旧连接冲突 - connectState CONNECTFAILED 时重置 _intentionalConnect,防止标记卡死 - deviceConnect handler 移除冗余的 _connectState 赋值 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
5705f9e622
commit
15e089f5e3
@@ -107,15 +107,8 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
/** 检查缓存设备:已连接则直接标记,未连接则调 autoConnect 扫描重连 */
|
||||
/** 每次进入页面都走真实扫描连接,确保状态最新 */
|
||||
_checkAndAutoConnect() {
|
||||
// 已连接且 deviceInfo 就绪,直接标记列表
|
||||
if (lefuService.isConnected && lefuService.deviceInfo?.serialNumber) {
|
||||
this._markConnected(lefuService.deviceInfo.serialNumber as string)
|
||||
return
|
||||
}
|
||||
|
||||
// 注册回调:连接成功后更新列表状态
|
||||
lefuService.onDeviceInfo((info) => {
|
||||
this._markConnected(info.serialNumber as string)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user