zeng.chen пре 7 месеци
родитељ
комит
0b49157907
1 измењених фајлова са 11 додато и 9 уклоњено
  1. 11 9
      pages/connectBle/connectBle.js

+ 11 - 9
pages/connectBle/connectBle.js

@@ -26,6 +26,7 @@ Page({
   onLoad(options) {
     var that = this;
     var json = JSON.parse(options.param)
+    json.clientType = "MW-S2(BLE)"
     console.log("要连接设备:", json)
     that.setData({
       connectDevice: json
@@ -40,16 +41,17 @@ Page({
     BtHelper.getInstance().startScan(
       that.data.connectDevice,
       async function (b) {
-          if (!b) {
-            that.setStatus(1);
-          }
-        },
-        async function (res) {
-          await BtHelper.getInstance().stopSearch();
-          that.setStatus(2);
-          that.data.connectDevice.deviceId = res.deviceId;
-          that.data.connectDevice.connectable = res.connectable;
+        if (!b) {
+          that.setStatus(1);
         }
+      },
+      async function (res) {
+        await BtHelper.getInstance().stopSearch();
+        that.setStatus(2);
+        that.data.connectDevice.deviceId = res.deviceId;
+        that.data.connectDevice.connectable = res.connectable;
+        that.data.connectDevice.mac = res.mac;
+      }
     );
   },