|
@@ -79,7 +79,7 @@ Page({
|
|
|
|
|
|
deviceMacId: null,
|
|
|
deviceListSelect: null,
|
|
|
- deviceList:[],
|
|
|
+ deviceList: [],
|
|
|
// deviceList: [{
|
|
|
// "connectType": 3,
|
|
|
// // "mac": "AIrSMArT_861210052356337",
|
|
@@ -630,14 +630,16 @@ Page({
|
|
|
} else if (device.state === "offline") {
|
|
|
|
|
|
var deviceListSelect = that.getDeviceListSelect();
|
|
|
- if (deviceListSelect != null && deviceList.length > deviceListSelect) {
|
|
|
+ if (deviceListSelect != null) {
|
|
|
+ if (deviceList.length > deviceListSelect) {
|
|
|
+ var currentDevice = deviceList[deviceListSelect];
|
|
|
+ console.log("断开连接0", currentDevice)
|
|
|
+ // 现断线第一个
|
|
|
+ // that.disconnectFirst()
|
|
|
+ }
|
|
|
that.setData({
|
|
|
deviceListSelect: null,
|
|
|
});
|
|
|
- var currentDevice = deviceList[deviceListSelect];
|
|
|
- console.log("断开连接0", currentDevice)
|
|
|
- // 现断线第一个
|
|
|
- // that.disconnectFirst()
|
|
|
}
|
|
|
console.log("断开连接2", device)
|
|
|
|
|
@@ -651,17 +653,18 @@ Page({
|
|
|
} else {
|
|
|
var deviceList = that.getDeviceList();
|
|
|
var deviceListSelect = that.getDeviceListSelect();
|
|
|
- if (deviceListSelect != null && deviceList.length > deviceListSelect) {
|
|
|
+ if (deviceListSelect != null) {
|
|
|
+ if (deviceList.length > deviceListSelect) {
|
|
|
+ var currentDevice = deviceList[deviceListSelect];
|
|
|
+ if (currentDevice.connectType === 1) {
|
|
|
+ console.log("断开连接1", currentDevice)
|
|
|
+ await BtHelper.getInstance().disconnect(currentDevice);
|
|
|
+ }
|
|
|
+ // await time_util.delayMills(500);
|
|
|
+ }
|
|
|
that.setData({
|
|
|
deviceListSelect: null,
|
|
|
});
|
|
|
- var currentDevice = deviceList[deviceListSelect];
|
|
|
- if (currentDevice.connectType === 1) {
|
|
|
- console.log("断开连接1", currentDevice)
|
|
|
- await BtHelper.getInstance().disconnect(currentDevice);
|
|
|
-
|
|
|
- }
|
|
|
- // await time_util.delayMills(500);
|
|
|
}
|
|
|
|
|
|
device.name = device.devName;
|