更新蓝牙连接状态
This commit is contained in:
@@ -226,6 +226,9 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
//如果当前没有连接该设备,则返回
|
//如果当前没有连接该设备,则返回
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (webviewTestController.selectDevice['blueToothStatus']!=2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||||
to: data['from'],
|
to: data['from'],
|
||||||
// to: ef.kvRoot.websocketId,
|
// to: ef.kvRoot.websocketId,
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
bridge.sdk.updateBlueToothStatus((args) async {
|
bridge.sdk.updateBlueToothStatus((args) async {
|
||||||
ef.log('updateBlueToothStatus: $args');
|
ef.log('updateBlueToothStatus: $args');
|
||||||
bluetooth = args[0];
|
bluetooth = args[0];
|
||||||
|
selectDevice['blueToothStatus'] = bluetooth;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
//sdk定义接口
|
//sdk定义接口
|
||||||
@@ -145,7 +146,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
ef.log('更新睡眠习惯: $args[0]');
|
ef.log('更新睡眠习惯: $args[0]');
|
||||||
try {
|
try {
|
||||||
MHTBlueToothController blueToothController = Get.find();
|
MHTBlueToothController blueToothController = Get.find();
|
||||||
blueToothController.saveHabitData(args[0]);
|
await blueToothController.saveHabitData(args[0]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ef.log("[更新睡眠习惯失败]:$e");
|
ef.log("[更新睡眠习惯失败]:$e");
|
||||||
}
|
}
|
||||||
@@ -172,6 +173,16 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
}
|
}
|
||||||
return true;
|
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) {
|
} catch (e, s) {
|
||||||
ef.log('$e,$s');
|
ef.log('$e,$s');
|
||||||
|
|||||||
Reference in New Issue
Block a user