|
@@ -56,18 +56,21 @@ class _ExamBloodOxygenState extends State<BloodOxygen> {
|
|
|
}
|
|
|
|
|
|
Future<void> currentDevice() async {
|
|
|
- final device = await controller.getDevice(DeviceTypes.SPO2);
|
|
|
- if (device == null) {
|
|
|
- _connectStatus = WorkerStatus.unboundDevice;
|
|
|
- setState(() {});
|
|
|
- worker = null;
|
|
|
- return;
|
|
|
- }
|
|
|
- spo2 = DeviceControllerManager(DeviceTypes.SPO2, device.model, device.mac);
|
|
|
- worker = spo2!.worker as SpO2DeviceWorker;
|
|
|
- _connectStatus = spo2!.connectStatus;
|
|
|
- loadListeners();
|
|
|
- connect();
|
|
|
+ try {
|
|
|
+ final device = await controller.getDevice(DeviceTypes.SPO2);
|
|
|
+ if (device == null) {
|
|
|
+ _connectStatus = WorkerStatus.unboundDevice;
|
|
|
+ setState(() {});
|
|
|
+ worker = null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ spo2 =
|
|
|
+ DeviceControllerManager(DeviceTypes.SPO2, device.model, device.mac);
|
|
|
+ worker = spo2!.worker as SpO2DeviceWorker;
|
|
|
+ _connectStatus = spo2!.connectStatus;
|
|
|
+ loadListeners();
|
|
|
+ connect();
|
|
|
+ } catch (e) {}
|
|
|
}
|
|
|
|
|
|
Future<void> initData() async {
|