更新控制跳转
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
|
||||
class BlueToothDataModel {
|
||||
String name;//设备型号
|
||||
String name; // 设备型号
|
||||
bool bind;
|
||||
String mac;
|
||||
ScanResult scanResult;
|
||||
@@ -10,6 +10,7 @@ class BlueToothDataModel {
|
||||
int type;
|
||||
String? macAID;
|
||||
String? macBID;
|
||||
DateTime lastSeen; // 添加的最后可见时间字段
|
||||
|
||||
BlueToothDataModel({
|
||||
this.name = '',
|
||||
@@ -19,6 +20,7 @@ class BlueToothDataModel {
|
||||
required this.type,
|
||||
this.macA = '',
|
||||
this.macB = '',
|
||||
required this.lastSeen, // 添加到构造函数参数
|
||||
});
|
||||
|
||||
factory BlueToothDataModel.fromScanResult(ScanResult result, int type,
|
||||
@@ -28,6 +30,14 @@ class BlueToothDataModel {
|
||||
name.isNotEmpty ? name : (result.advertisementData.localName ?? '');
|
||||
|
||||
return BlueToothDataModel(
|
||||
name: finalName, bind: bind, mac: mac, scanResult: result, type: type);
|
||||
name: finalName,
|
||||
bind: bind,
|
||||
mac: mac,
|
||||
scanResult: result,
|
||||
type: type,
|
||||
macA: '', // 保持原有默认值
|
||||
macB: '', // 保持原有默认值
|
||||
lastSeen: DateTime.now(), // 设置为当前时间
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user