|
@@ -131,8 +131,10 @@ Page({
|
|
|
// BtHelper.getInstance().initBluetoothAdapter();
|
|
|
var deviceList = wx.getStorageSync("deviceList") || "";
|
|
|
if (!strings.isEmpty(deviceList)) {
|
|
|
- var list = JSON.parse(deviceList);
|
|
|
- that.updateDeviceList(list, true);
|
|
|
+ try {
|
|
|
+ var list = JSON.parse(deviceList);
|
|
|
+ that.updateDeviceList(list, true);
|
|
|
+ } catch (e) {}
|
|
|
// that.tryConnectBle()
|
|
|
}
|
|
|
|
|
@@ -194,11 +196,13 @@ Page({
|
|
|
var item = dList[i];
|
|
|
if (item.connectType == 1 && tempItem.state == "online") {
|
|
|
item.name = item.devName;
|
|
|
- BtHelper.getInstance().connect(item, function (data) {
|
|
|
- if (data) {
|
|
|
- that.addConnectBlueDevice(item);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (that.data.deviceListIndex == null) {
|
|
|
+ BtHelper.getInstance().connect(item, function (data) {
|
|
|
+ if (data) {
|
|
|
+ that.addConnectBlueDevice(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -965,7 +969,7 @@ Page({
|
|
|
});
|
|
|
}
|
|
|
///断开蓝牙连接
|
|
|
- await BtHelper.getInstance().disconnect();
|
|
|
+ // await BtHelper.getInstance().disconnect();
|
|
|
that.actionDevice(0);
|
|
|
},
|
|
|
|