更新睡眠报告正式地址
This commit is contained in:
@@ -42,6 +42,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
Timer? _timeoutTimer;
|
||||
StreamSubscription<List<ScanResult>>? _scanSubscription;
|
||||
bool _isDisposed = false;
|
||||
ScanResult? targetDevice;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -916,7 +917,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
_scanSubscription = FlutterBluePlus.scanResults.listen((results) async {
|
||||
if (_isDisposed) return;
|
||||
|
||||
ScanResult? targetDevice;
|
||||
|
||||
|
||||
for (var r in results) {
|
||||
if (r.advertisementData.manufacturerData.containsKey(0xFFED)) {
|
||||
@@ -937,7 +938,7 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
_scanSubscription?.cancel();
|
||||
|
||||
try {
|
||||
THapp bledevice = THapp(device: targetDevice.device);
|
||||
THapp bledevice = THapp(device: targetDevice!.device);
|
||||
await bledevice.device.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
|
||||
@@ -1085,7 +1086,8 @@ class _MHTWifiAfterPageState extends State<MHTWifiAfterPage> {
|
||||
|
||||
Future<void> _disconnectDevice() async {
|
||||
try {
|
||||
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
// THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
THapp bledevice = THapp(device: targetDevice!.device);
|
||||
await bledevice.disconnect();
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功".tr);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user