浏览代码

优化兼容性

carlos 1 年之前
父节点
当前提交
ed10bab7f3

+ 3 - 2
app/lib/module/health/health_controller.dart

@@ -145,6 +145,7 @@ class HealthController extends GetxController with WatchRequestOption {
     if (tcmLogin) {
       bool isPay = await hostTCMApi.isPay();
       unlock.value = isPay;
+      configMedicalSwitch(isPay);
       var tcmLevels = await hostTCMApi.getRecentReport();
       if (tcmLevels == null ||
           tcmLevels.healthPoints == null ||
@@ -412,8 +413,8 @@ class HealthController extends GetxController with WatchRequestOption {
   }
 
   //中医解锁配置
-  void configMedicalSwitch() {
-    WatchCommandManager.medicalSwitch(unlock.value);
+  void configMedicalSwitch(bool isUnlock) {
+    WatchCommandManager.medicalSwitch(isUnlock);
   }
 
   //健康提醒

+ 2 - 2
app/lib/module/login/connect_device/connect_device_controller.dart

@@ -61,8 +61,8 @@ class ConnectDeviceController extends GetxController {
         String mac;
         String name;
         if (code.contains("?")) {
-          name = code.split("?").first;
-          mac = code.split("?").last;
+          name = code.split("?").first.toUpperCase();
+          mac = code.split("?").last.toUpperCase();
         } else {
           name = 'H210';
           mac = code;

+ 6 - 4
app/lib/module/scan_list/scan_list_controller.dart

@@ -17,13 +17,15 @@ class ScanListController extends GetxController {
     super.onInit();
     connectCore.bluetoothOpen ? null : openNote();
     connectCore.scanChange = (value) {
-      String name = value.name ?? "";
-      if (value.name != 'NULL' &&
+      var v = value;
+      String name = (v.name ?? "").toUpperCase();
+      v.name = name;
+      if (v.name != 'NULL' &&
           (name == 'H210' || name.contains("H210YH_"))) {
         for (ScanDeviceBean element in deviceList) {
-          if (element.mac == value.mac) return;
+          if (element.mac == v.mac) return;
         }
-        deviceList.add(value);
+        deviceList.add(v);
         // debugPrint('host-to-flutter scanResult: ${deviceList.length}');
       }
     };

+ 13 - 2
app/lib/sdk/data_parse.dart

@@ -65,8 +65,15 @@ class DataParse {
         }
         break;
       case 7: //0x07,脉搏数据
+        final year = bean.body![0];
+        final month = bean.body![1];
+        final day = bean.body![2];
+        final value = bean.body![3];
+        if(year == 0 || month == 0 || day == 0 || value < 40) {
+          break;
+        }
         yakEventBus.fire(
-            DataEvent(WatchResponseType.pulseData, PulseData(bean.body![0], bean.body![1], bean.body![2], bean.body![3])));
+            DataEvent(WatchResponseType.pulseData, PulseData(year, month, day, value)));
         break;
       case 8: //0x08,血压数据,[222, 2, 8, 0, 5, 23, 5, 22, 0, 0, 14, 13]
         final year = bean.body![0];
@@ -151,7 +158,11 @@ class DataParse {
         final year = bean.body![0];
         final month = bean.body![1];
         final day = bean.body![2];
-        yakEventBus.fire(DataEvent(WatchResponseType.bloodOxygen, BloodOxygenData(bean.body![3], year, month, day)));
+        final value = bean.body![3];
+        if(year == 0 || month == 0 || day == 0 || value < 40) {
+          break;
+        }
+        yakEventBus.fire(DataEvent(WatchResponseType.bloodOxygen, BloodOxygenData(value, year, month, day)));
         break;
       case 57: //0x39,总运动时长,[0xde, 0x02, 0x39, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0d]
         var list = bean.body!.sublist(0, 0 + 4);