更新蓝牙连接状态

This commit is contained in:
wyf
2025-07-22 11:53:59 +08:00
parent 22b34d7b06
commit 555e853a36
2 changed files with 15 additions and 1 deletions

View File

@@ -226,6 +226,9 @@ class _HomePageState extends State<MainPageBBottomChange>
//如果当前没有连接该设备,则返回
return;
}
if (webviewTestController.selectDevice['blueToothStatus']!=2) {
return;
}
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
to: data['from'],
// to: ef.kvRoot.websocketId,

View File

@@ -86,6 +86,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
bridge.sdk.updateBlueToothStatus((args) async {
ef.log('updateBlueToothStatus: $args');
bluetooth = args[0];
selectDevice['blueToothStatus'] = bluetooth;
return true;
});
//sdk定义接口
@@ -145,7 +146,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
ef.log('更新睡眠习惯: $args[0]');
try {
MHTBlueToothController blueToothController = Get.find();
blueToothController.saveHabitData(args[0]);
await blueToothController.saveHabitData(args[0]);
} catch (e) {
ef.log("[更新睡眠习惯失败]:$e");
}
@@ -172,6 +173,16 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
}
return true;
});
// bridge.sdk.bluetoothConnect((args) async {
// ef.log('[蓝牙连接失败]: $args[0]');
// try {
// selectDevice['blueToothStatus'] = 2;
// return true;
// } catch (e) {
// ef.log("[蓝牙连接失败]:$e");
// }
// return true;
// });
});
} catch (e, s) {
ef.log('$e,$s');