|
@@ -2,8 +2,8 @@ const {
|
|
|
BtHelper
|
|
|
} = require('../../devices/bt_helper');
|
|
|
|
|
|
-import routePath from '../../utils/route_path.js'
|
|
|
-import route_util from '../../utils/route_util.js';
|
|
|
+import routeRoot from '../../utils/routeRoot.js'
|
|
|
+import routUtil from '../../utils/routUtil.js';
|
|
|
Page({
|
|
|
data: {
|
|
|
connectDevice: {},
|
|
@@ -44,18 +44,18 @@ Page({
|
|
|
console.log("要连接设备:", connectDevice)
|
|
|
BtHelper.getInstance().startScan(connectDevice,
|
|
|
async function (b) {
|
|
|
- if (!b) {
|
|
|
- that.setStatus(1);
|
|
|
+ if (!b) {
|
|
|
+ that.setStatus(1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async function (res) {
|
|
|
+ await BtHelper.getInstance().stopSearch();
|
|
|
+ console.log("搜索到设备11:", res);
|
|
|
+ that.setStatus(2);
|
|
|
+ that.data.connectDevice.deviceId = res.deviceId;
|
|
|
+ that.data.connectDevice.connectable = res.connectable;
|
|
|
+ that.data.connectDevice.mac = res.mac;
|
|
|
}
|
|
|
- },
|
|
|
- async function (res) {
|
|
|
- await BtHelper.getInstance().stopSearch();
|
|
|
- console.log("搜索到设备11:", res);
|
|
|
- that.setStatus(2);
|
|
|
- that.data.connectDevice.deviceId = res.deviceId;
|
|
|
- that.data.connectDevice.connectable = res.connectable;
|
|
|
- that.data.connectDevice.mac = res.mac;
|
|
|
- }
|
|
|
);
|
|
|
},
|
|
|
|
|
@@ -65,7 +65,7 @@ Page({
|
|
|
var connectDevice = that.data.connectDevice;
|
|
|
var isTheSame = getCurrentPages()[0].isTheSameBlue(connectDevice);
|
|
|
if (isTheSame) {
|
|
|
- route_util.goBackRoute(routePath.indexRoot);
|
|
|
+ routUtil.goBackRoute(routeRoot.indexRoot);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -82,7 +82,7 @@ Page({
|
|
|
device.state = 'online';
|
|
|
device.imageUrl = device.img;
|
|
|
getCurrentPages()[0].addBlueDevice(device);
|
|
|
- route_util.goBackRoute(routePath.indexRoot);
|
|
|
+ routUtil.goBackRoute(routeRoot.indexRoot);
|
|
|
}
|
|
|
}, true);
|
|
|
},
|