|
@@ -579,10 +579,10 @@ Page({
|
|
|
}
|
|
|
|
|
|
///去蓝牙连接处理
|
|
|
+ // {"connectType":1,"deviceId":"E4:9F:80:09:40:EC","name":"E4:9F:80:09:40:EC","state":"online","ProdModel":"MW-SR1(4G_WIFI)","devName":"猫王音响x阿基米德 SR1 妙播收音机"}
|
|
|
if (index === deviceListSelect && device.state === "online") {
|
|
|
route_util.jumpParam('/pages/deviceDetail/detail', JSON.stringify(device))
|
|
|
} else if (device.state === "offline") {
|
|
|
- console.log("去连接蓝牙", device)
|
|
|
device.name = device.devName;
|
|
|
BtHelper.getInstance().connect(device, function (isConnected, d) {
|
|
|
if (isConnected) {
|
|
@@ -591,7 +591,13 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- // {"connectType":1,"deviceId":"E4:9F:80:09:40:EC","name":"E4:9F:80:09:40:EC","state":"online","ProdModel":"MW-SR1(4G_WIFI)","devName":"猫王音响x阿基米德 SR1 妙播收音机"}
|
|
|
+ device.name = device.devName;
|
|
|
+ BtHelper.getInstance().connect(device, function (isConnected, d) {
|
|
|
+ if (isConnected) {
|
|
|
+ device.state = "online";
|
|
|
+ that.addBlueDevice(device);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -677,23 +683,24 @@ Page({
|
|
|
};
|
|
|
|
|
|
///删除当前设备
|
|
|
+ console.log("gasdfqwerqwerqrq==11===" + deviceList.length);
|
|
|
var deviceId = deviceList[index].deviceId;
|
|
|
deviceList = deviceList.filter((item, i) => {
|
|
|
return deviceId !== item.deviceId;
|
|
|
});
|
|
|
- console.log("断开蓝牙连接", deviceId)
|
|
|
-
|
|
|
- BtHelper.getInstance().disconnect({
|
|
|
- "deviceId": deviceId
|
|
|
- });
|
|
|
-
|
|
|
+ console.log("gasdfqwerqwerqrq==222===" + deviceList.length);
|
|
|
store.setStore("deviceList", deviceList);
|
|
|
+
|
|
|
var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
|
deviceList: deviceList,
|
|
|
indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
deviceListSelect: isCurrentIndex ? null : deviceListSelect,
|
|
|
});
|
|
|
+
|
|
|
+ BtHelper.getInstance().disconnect({
|
|
|
+ "deviceId": deviceId
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/// 断开连接wifi
|
|
@@ -745,6 +752,7 @@ Page({
|
|
|
deviceListSelect: 0,
|
|
|
autoConnected: true,
|
|
|
});
|
|
|
+
|
|
|
event_bus.removeNotification(CmdEvent.eventName, that);
|
|
|
event_bus.addNotification(CmdEvent.eventName, function (event) {
|
|
|
if (event.cmdEvent == EnumCmdEvent.onoffline) {
|
|
@@ -770,9 +778,7 @@ Page({
|
|
|
console.log("首页断开连接", disDevice)
|
|
|
that.updateDeviceList(that.data.deviceList, false, false);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -823,18 +829,10 @@ Page({
|
|
|
updateDeviceList(deviceList, isInit, closeAllBlue) {
|
|
|
var that = this;
|
|
|
var finalList = lexin_add.updateDeviceList(deviceList, isInit, closeAllBlue);
|
|
|
- if (!strings.isEmpty(deviceList) || !strings.isEmpty(finalList)) {
|
|
|
- store.setStore("deviceList", finalList);
|
|
|
-
|
|
|
- // todo 测试代码
|
|
|
- // finalList.forEach(element => {
|
|
|
- // element.state = "online";
|
|
|
- // });
|
|
|
-
|
|
|
- that.setData({
|
|
|
- deviceList: finalList,
|
|
|
- });
|
|
|
- }
|
|
|
+ store.setStore("deviceList", finalList);
|
|
|
+ that.setData({
|
|
|
+ deviceList: finalList,
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
///点击banner事件
|