更新传感器升级
This commit is contained in:
@@ -12,6 +12,7 @@ class BlueToothDataModel {
|
||||
String? macBID;
|
||||
DateTime lastSeen; // 最后可见时间
|
||||
String? deviceID; // 设备ID
|
||||
int? version; // ✅ 新增版本号,可为空
|
||||
|
||||
BlueToothDataModel({
|
||||
this.name = '',
|
||||
@@ -22,7 +23,8 @@ class BlueToothDataModel {
|
||||
this.macA = '',
|
||||
this.macB = '',
|
||||
required this.lastSeen,
|
||||
this.deviceID, // ✅ 加入构造函数参数
|
||||
this.deviceID,
|
||||
this.version, // ✅ 构造函数参数
|
||||
});
|
||||
|
||||
factory BlueToothDataModel.fromScanResult(
|
||||
@@ -31,7 +33,8 @@ class BlueToothDataModel {
|
||||
bool bind = false,
|
||||
String name = '',
|
||||
String mac = '',
|
||||
String? deviceID, // ✅ 工厂方法接收 deviceID
|
||||
String? deviceID,
|
||||
int? version, // ✅ 工厂方法参数
|
||||
}) {
|
||||
String finalName =
|
||||
name.isNotEmpty ? name : (result.advertisementData.localName ?? '');
|
||||
@@ -45,7 +48,8 @@ class BlueToothDataModel {
|
||||
macA: '',
|
||||
macB: '',
|
||||
lastSeen: DateTime.now(),
|
||||
deviceID: deviceID, // ✅ 赋值
|
||||
deviceID: deviceID,
|
||||
version: version, // ✅ 赋值
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user