ソースを参照

feature: 处理君正方案隐蔽

332777428@qq.com 5 ヶ月 前
コミット
d7ccd06a69
2 ファイル変更32 行追加20 行削除
  1. 23 12
      devices/ble_manager.js
  2. 9 8
      pages/deviceConnect2/deviceConnect2.js

+ 23 - 12
devices/ble_manager.js

@@ -199,7 +199,10 @@ class bleManager {
       // that.disconnect(result)
       //断开连接是失败的。
       console.log("监听到设备状态变化0:", result.deviceId, JSON.stringify(result));
-      that.errorDisconnect({ "deviceId": result.deviceId, "state": result.connected ? "online" : "offline" });
+      that.errorDisconnect({
+        "deviceId": result.deviceId,
+        "state": result.connected ? "online" : "offline"
+      });
 
 
 
@@ -295,9 +298,9 @@ class bleManager {
   }
 
   testData(temp) {
-    if ((temp.deviceId === "1A:B4:E0:40:22:8B"
-      || temp.deviceId === "F3:55:1F:8D:26:A0"
-      || temp.deviceId === "3F2F112F-ACB5-3EB3-30DA-93DE6A86228A")) {
+    if ((temp.deviceId === "1A:B4:E0:40:22:8B" ||
+        temp.deviceId === "F3:55:1F:8D:26:A0" ||
+        temp.deviceId === "3F2F112F-ACB5-3EB3-30DA-93DE6A86228A")) {
       return true
     }
     return false
@@ -341,10 +344,10 @@ class bleManager {
     const indexRoot = route_constant.indexRoot;
     const connectBleRoot = route_constant.connectBleRoot;
     var lastPageRoute = route_util.getLastPageRoute();
-    // if (lastPageRoute != indexRoot && lastPageRoute != connectBleRoot) {
-    //   console.log("搜索蓝牙设备失败,请返回首页0");
-    //   return;
-    // }
+    if (lastPageRoute != indexRoot && lastPageRoute != connectBleRoot) {
+      console.log("搜索蓝牙设备失败,请返回首页0");
+      return;
+    }
 
     ///蓝牙连接 做限制
     if (lastPageRoute == indexRoot) {
@@ -501,11 +504,16 @@ class bleManager {
         fail: (err) => {
           // {errno: 1509007, errCode: -1, errMsg: "createBLEConnection:fail:already connect"}
           if (err.errno == 1509007) {
-            that.disconnect({ "deviceId": device.deviceId })
+            that.disconnect({
+              "deviceId": device.deviceId
+            })
           } else {
             that.isConnecting = false;
             console.log("监听到设备状态变化3:", err);
-            that.errorDisconnect({ "deviceId": device.deviceId, "state": "offline" })
+            that.errorDisconnect({
+              "deviceId": device.deviceId,
+              "state": "offline"
+            })
             let publicDevice = that.publicDevice ?? {}
             if (device.deviceId == publicDevice.deviceId) {
               that.publicDevice = null;
@@ -557,7 +565,10 @@ class bleManager {
             callback(false)
           }
           console.log('监听到设备状态变化4:', err);
-          that.errorDisconnect({ "deviceId": that.publicDevice.deviceId, "state": "offline" })
+          that.errorDisconnect({
+            "deviceId": that.publicDevice.deviceId,
+            "state": "offline"
+          })
           resolve(false);
         }
       });
@@ -660,7 +671,7 @@ class bleManager {
     });
   }
 
-  connect() { }
+  connect() {}
 
   // 发现特征值 read / write
   discoverCharacteristics(deviceId, serviceId) {

+ 9 - 8
pages/deviceConnect2/deviceConnect2.js

@@ -107,10 +107,11 @@ Page({
           var devicesList = options.data.filter((v) => {
             var name = v.name;
             var isLexin = name.indexOf(lexin_devices.leXin) !== -1;
-            var isJungzheng1 = junzheng_util.isJungzheng1(name);
-            var isJungzheng2 = junzheng_util.isJungzheng2(name);
-            // return isLexin || isJungzheng1 || isJungzheng2;
-            return v.name == "AIrSMArT_861210052356337";
+            // var isJungzheng1 = junzheng_util.isJungzheng1(name);
+            // var isJungzheng2 = junzheng_util.isJungzheng2(name);
+            return isLexin;
+            return isLexin || isJungzheng1 || isJungzheng2;
+            // return v.name == "AIrSMArT_861210052356337";
           });
 
           if (!strings.isEmpty(devicesList)) {
@@ -180,10 +181,10 @@ Page({
     var that = this;
     const devicesList = that.data.devicesList;
     if (devicesList.length < 1) {
-      var url = "../deviceConnect4/deviceConnect4";
-      var p = JSON.stringify(that.data.connectDevice);
-      var param = "?deviceId=" + deviceId + "&param=" + p;
-      route_util.jumpParams(url, param);
+      // var url = "../deviceConnect4/deviceConnect4";
+      // var p = JSON.stringify(that.data.connectDevice);
+      // var param = "?deviceId=" + deviceId + "&param=" + p;
+      // route_util.jumpParams(url, param);
       wx.showToast({
         title: '请短按设备配对键',
         icon: 'none',