This commit is contained in:
wyf
2025-06-27 17:40:53 +08:00
parent cee6c75f26
commit 7930e3eb2c
3 changed files with 49 additions and 30 deletions

View File

@@ -67,17 +67,12 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
blueteethBindController.updateAll();
}
@override
@override
void dispose() {
_isDisposed = true;
_cleanupResources();
try {
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
bledevice.disconnect();
DailyLogUtils.writeLog("关闭蓝牙连接成功");
} catch (e) {
DailyLogUtils.writeError("关闭蓝牙连接失败");
}
_disconnectDevice();
super.dispose();
}
@@ -1105,4 +1100,14 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
onFailure: (res) {},
);
}
void _disconnectDevice() async {
try {
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
await bledevice.disconnect();
DailyLogUtils.writeLog("关闭蓝牙连接成功");
} catch (e) {
DailyLogUtils.writeError("关闭蓝牙连接失败: $e");
}
}
}