Просмотр исходного кода

feature: 处理君正方案ios数据不全的问题

332777428@qq.com 2 месяцев назад
Родитель
Сommit
d9d56942fb
4 измененных файлов с 29 добавлено и 22 удалено
  1. 1 1
      app.js
  2. 13 12
      pages/pageB/deviceConnect2/deviceConnect2.js
  3. 1 0
      utils/blue_ble/util.js
  4. 14 9
      utils/blufi/xBlufi-wx-impl.js

+ 1 - 1
app.js

@@ -15,7 +15,7 @@ const iosHost = 'wxs://mqtt.test.radio1964.com:8884';
 const androidHost = 'wxs://mqtt.test.radio1964.com:8884'
 App({
   globalData: {
-    isRelease: false,
+    isRelease: true,
     is_debug: 2, // 1 测试环境 // 2正式环境
     baseUrl: env.prod.baseUrl,
 

+ 13 - 12
pages/pageB/deviceConnect2/deviceConnect2.js

@@ -92,8 +92,8 @@ Page({
         }
         break;
 
-      // [{"deviceId":"7C:DF:A1:FD:3A:F2","name":"BLUFI_7cdfa1fd3af0","RSSI":-62,"connectable":true,"advertisData":"","advertisServiceUUIDs":["0000FFFF-0000-1000-8000-00805F9B34FB"],"localName":"BLUFI_7cdfa1fd3af0","serviceData":{}}]
-      ///发现设备列表回调
+        // [{"deviceId":"7C:DF:A1:FD:3A:F2","name":"BLUFI_7cdfa1fd3af0","RSSI":-62,"connectable":true,"advertisData":"","advertisServiceUUIDs":["0000FFFF-0000-1000-8000-00805F9B34FB"],"localName":"BLUFI_7cdfa1fd3af0","serviceData":{}}]
+        ///发现设备列表回调
       case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
 
         // 搜索到蓝牙
@@ -104,11 +104,13 @@ Page({
             var isJungzheng1 = junzhengUtil.isJungzheng1(name);
             var isJungzheng2 = junzhengUtil.isJungzheng2(name);
 
-            var localName = v.localName;
-            var isLexin1 = localName.indexOf(lexin_devices.leXin) !== -1;
-            var isJungzheng3 = junzhengUtil.isJungzheng1(localName);
-            var isJungzheng4 = junzhengUtil.isJungzheng2(localName);
-            return isLexin || isJungzheng1 || isJungzheng2 || isLexin1 || isJungzheng3 || isJungzheng4;
+            return isLexin || isJungzheng1 || isJungzheng2;
+
+            // var localName = v.localName;
+            // var isLexin1 = localName.indexOf(lexin_devices.leXin) !== -1;
+            // var isJungzheng3 = junzhengUtil.isJungzheng1(localName);
+            // var isJungzheng4 = junzhengUtil.isJungzheng2(localName);
+            // return isLexin || isJungzheng1 || isJungzheng2 || isLexin1 || isJungzheng3 || isJungzheng4;
             ///2AXD
             // return v.name == "AIrSMArT_d0311004155e";
             ///X4
@@ -127,9 +129,9 @@ Page({
         }
         break;
 
-      // {"type":"0","result":true,"data":{"deviceId":"7C:DF:A1:FD:3A:F2","name":"BLUFI_7cdfa1fd3af0"}}
-      // {"type":"0","result":true,"data":{"deviceId":"7C:DF:A1:FC:BB:26","name":"BLUFI_7cdfa1fcbb24"}}
-      ///主动去连接连接
+        // {"type":"0","result":true,"data":{"deviceId":"7C:DF:A1:FD:3A:F2","name":"BLUFI_7cdfa1fd3af0"}}
+        // {"type":"0","result":true,"data":{"deviceId":"7C:DF:A1:FC:BB:26","name":"BLUFI_7cdfa1fcbb24"}}
+        ///主动去连接连接
       case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
         wx.hideLoading();
         if (options.result) {
@@ -150,7 +152,7 @@ Page({
         }
         break;
 
-      ///停止发现设备列表回调
+        ///停止发现设备列表回调
       case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
         if (options.result) {
           //蓝牙停止搜索ok
@@ -190,7 +192,6 @@ Page({
 
     var name = devicesList[0].name;
     var deviceId = devicesList[0].deviceId;
-    console.log("")
     var isJungzheng1 = junzhengUtil.isJungzheng1(name);
     var isJungzheng2 = junzhengUtil.isJungzheng2(name);
 

+ 1 - 0
utils/blue_ble/util.js

@@ -124,6 +124,7 @@ class BleUtil {
     var that = this;
     var list = that.sendWiFiInfo(wifiName, pwd);
     var isTrue = await that.manager.sendData(device, list);
+    console.log("111--333==" + isTrue);
     ///发送数据成功
     if (isTrue) {
 

+ 14 - 9
utils/blufi/xBlufi-wx-impl.js

@@ -162,7 +162,7 @@ function getSecret(deviceId, serviceId, characteristicId, client, kBytes, pBytes
         getSecret(deviceId, serviceId, characteristicId, client, kBytes, pBytes, gBytes, obj.laveData);
       }
     },
-    fail: function (res) { }
+    fail: function (res) {}
   })
 }
 
@@ -192,7 +192,7 @@ function writeDeviceRouterInfoStart(deviceId, serviceId, characteristicId, data)
         writeRouterSsid(deviceId, serviceId, characteristicId, null);
       }
     },
-    fail: function (res) { }
+    fail: function (res) {}
   })
 }
 
@@ -290,7 +290,7 @@ function writeDevicePwd(deviceId, serviceId, characteristicId, data) {
         writeDeviceEnd(deviceId, serviceId, characteristicId, null);
       }
     },
-    fail: function (res) { }
+    fail: function (res) {}
   })
 }
 
@@ -336,7 +336,7 @@ function init() {
     if (options.isStart) {
       //第一步检查蓝牙适配器是否可用
       wx.onBluetoothAdapterStateChange(function (res) {
-        if (!res.available) { }
+        if (!res.available) {}
       });
       if (!itue) {
         return;
@@ -399,16 +399,21 @@ function init() {
                             }
                           }
                           if (isnotexist) {
-                 
+
                             let name = devices.devices[0].name ?? ""
                             let localName = devices.devices[0].localName ?? ""
+                            //AIrSMArT_d03110061a08
                             // AIrSMArT_d03110c71019
-                            if (name.includes("AIrSMArT") || localName.includes("AIrSMArT")) {
-                              // devices.devices[0].name = name.includes("AIrSMArT") ? name : localName
-                              console.log("打印2", JSON.stringify(devices.devices[0]))
-                              devicesList.push(devices.devices[0])
+                            if (name.includes("MW_BLE") && localName === "") {} else {
+                              devices.devices[0].name = localName;
+                              devicesList.push(devices.devices[0]);
                             }
 
+                            // if (name.includes("AIrSMArT") || localName.includes("AIrSMArT")) {
+                            //   // devices.devices[0].name = name.includes("AIrSMArT") ? name : localName
+                            //   console.log("打印2", JSON.stringify(devices.devices[0]))
+                            // }
+
                           }
                         } else if (devices[0]) {
                           if (devices[0].advertisData) {