Jelajahi Sumber

feature: 兼容处理部分设备连接时间过长

Damon 7 bulan lalu
induk
melakukan
73a4542161

+ 0 - 2
devices/ble_manager.js

@@ -179,10 +179,8 @@ class bleManager {
       //   deviceId: result.deviceId,
       //   ///{"isPaired":false,"errno":0,"errMsg":"isBluetoothDevicePaired:ok"}
       //   success: (res) => {
-      //     console.log("gasdfqwerqwerqr==00===" + JSON.stringify(res) + "===" + JSON.stringify(result));
       //   },
       //   fail: (err) => {
-      //     console.log("gasdfqwerqwerqr==111===" + JSON.stringify(err));
       //   }
       // })
     });

+ 1 - 1
pages/deviceConnect3/deviceConnect3.js

@@ -120,7 +120,7 @@ Page({
                 percent: 100,
                 ruterStatus: 1,
               });
-            }, 500);
+            }, 1 * 1000);
 
           }
         }

+ 1 - 0
pages/deviceList/deviceList.js

@@ -40,6 +40,7 @@ Page({
       var devices = [];
       var clientTypes = lexin_devices.clientTypes;
       res.forEach(element => {
+        ///MW-SR1(4G_WIFI),MW-2AX(WIFI)
         for (var i = 0; i < clientTypes.length; i++) {
           if (element.clientType == clientTypes[i]) {
             if (!devices.includes(element)) {

+ 1 - 1
pages/index/index.js

@@ -90,7 +90,7 @@ Page({
   onDeviceLoad() {
     var that = this;
     var deviceList = store.getStore("deviceList");
-    if (!strings.isEmpty(deviceList)) {
+    if (!strings.isEmpty(deviceList)) { 
       that.updateDeviceList(deviceList, true, false);
     }
 

+ 5 - 7
utils/lexin/message.js

@@ -30,7 +30,6 @@ function getDeviceInfo(payloads) {
   var other = payloads.other;
   var SrcDeviceName = payloads.SrcDeviceName;
 
-  console.log("gasdfqwerqwerqr==333==");
   ///连上就调用2次 payloads.SrcDeviceName:AIrSMArT_7cdfa1fcbb24
   const app = getApp();
   const strings = require('../strings');
@@ -56,14 +55,15 @@ function getDeviceInfo(payloads) {
             device.devName = devName;
           }
 
+          ///设置图片
           if (!strings.isEmpty(ProdModel)) {
-            ///设置图片
             var classifyProducts = app.globalData.classifyProducts;
             if (!strings.isEmpty(classifyProducts)) {
               for (var i = 0; i < classifyProducts.length; i++) {
-                if (classifyProducts.clientType == ProdModel) {
-                  if (!strings.isEmpty(classifyProducts.img) && device.imageUrl != classifyProducts.img) {
-                    device.imageUrl = classifyProducts.img;
+                var productItem = classifyProducts[i];
+                if (productItem.clientType == ProdModel) {
+                  if (!strings.isEmpty(productItem.img) && device.imageUrl != productItem.img) {
+                    device.imageUrl = productItem.img;
                   }
                   break;
                 }
@@ -80,13 +80,11 @@ function getDeviceInfo(payloads) {
     }
 
     /// 去更新选中目标
-    console.log("gasdfqwerqwerqr==444==" + currentDeviceId);
     if (!strings.isEmpty(currentDeviceId)) {
       for (var i = 0; i < deviceList.length; i++) {
         var device = deviceList[i];
         var deviceId = device.deviceId;
         if (deviceId == currentDeviceId) {
-          console.log("gasdfqwerqwerqr==555==" + JSON.stringify(device));
           pages[0].refreshCurrentDevice(device);
           break;
         }

+ 7 - 8
utils/lexin/subscribe.js

@@ -3,7 +3,7 @@ module.exports = {
   subscribeAllDevice: subscribeAllDevice,
 }
 
-// 订阅在线单个设备
+// 订阅在线单个设备   pages[0].actionDevice(device);
 function subscribeSingleDevice(device) {
   //  /AIrSMArT_210052355545/status/onoffline 魅族款 APP
   // /AIrSMArT_861210052355545/status/onoffline 魅族款 小程序
@@ -22,14 +22,13 @@ function subscribeSingleDevice(device) {
       }
     }
   }
-  ///在线处理
-  pages[0].actionDevice(device);
 
-  // const lexin_util = require('../lexin/util');
-  // var mac = lexin_util.getMacByDeviceId(deviceId);
-  // var topic = `/AIrSMArT_${mac}/status/onoffline`;
-  // const app = getApp();
-  // app.subscribe(topic);
+  const lexin_util = require('../lexin/util');
+  var mac = lexin_util.getMacByDeviceId(deviceId);
+  var topic = `/AIrSMArT_${mac}/status/onoffline`;
+  const app = getApp();
+  app.unsubscribe(topic);
+  app.subscribe(topic);
 };
 
 // 订阅在线设备