更新绑定时候选择房间和设置房间名称
This commit is contained in:
@@ -241,6 +241,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
if (currentFullDevice != null) {
|
||||
currentFullDevice!.macAID = res.data['macA'];
|
||||
currentFullDevice!.macBID = res.data['macB'];
|
||||
currentFullDevice!.deviceID = res.data['id'];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -195,7 +195,12 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
TopSlideNotification.show(context, text: "保存成功");
|
||||
MHTHomeController mhtHomeController = Get.find();
|
||||
mhtHomeController.getPersonList();
|
||||
Get.offNamed("/bindDeviceSuccess");
|
||||
// Get.offNamed("/bindDeviceSuccess");
|
||||
Map data = {};
|
||||
final device = bluetoothController.currentFullDevice;
|
||||
data['_id'] = device!.deviceID;
|
||||
data['isNextStep'] = true;
|
||||
Get.toNamed("/editBedPage", arguments: data);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
|
||||
@@ -10,7 +10,8 @@ class BlueToothDataModel {
|
||||
int type;
|
||||
String? macAID;
|
||||
String? macBID;
|
||||
DateTime lastSeen; // 添加的最后可见时间字段
|
||||
DateTime lastSeen; // 最后可见时间
|
||||
String? deviceID; // 设备ID
|
||||
|
||||
BlueToothDataModel({
|
||||
this.name = '',
|
||||
@@ -20,12 +21,18 @@ class BlueToothDataModel {
|
||||
required this.type,
|
||||
this.macA = '',
|
||||
this.macB = '',
|
||||
required this.lastSeen, // 添加到构造函数参数
|
||||
required this.lastSeen,
|
||||
this.deviceID, // ✅ 加入构造函数参数
|
||||
});
|
||||
|
||||
factory BlueToothDataModel.fromScanResult(ScanResult result, int type,
|
||||
{bool bind = false, String name = '', String mac = ''}) {
|
||||
// 如果外部没有传入 name,则取 localName
|
||||
factory BlueToothDataModel.fromScanResult(
|
||||
ScanResult result,
|
||||
int type, {
|
||||
bool bind = false,
|
||||
String name = '',
|
||||
String mac = '',
|
||||
String? deviceID, // ✅ 工厂方法接收 deviceID
|
||||
}) {
|
||||
String finalName =
|
||||
name.isNotEmpty ? name : (result.advertisementData.localName ?? '');
|
||||
|
||||
@@ -35,9 +42,10 @@ class BlueToothDataModel {
|
||||
mac: mac,
|
||||
scanResult: result,
|
||||
type: type,
|
||||
macA: '', // 保持原有默认值
|
||||
macB: '', // 保持原有默认值
|
||||
lastSeen: DateTime.now(), // 设置为当前时间
|
||||
macA: '',
|
||||
macB: '',
|
||||
lastSeen: DateTime.now(),
|
||||
deviceID: deviceID, // ✅ 赋值
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user