|
@@ -22,7 +22,7 @@ import lexin_message from '../../utils/lexin/message.js';
|
|
|
import {
|
|
|
BtHelper
|
|
|
} from '../../devices/bt_helper.js';
|
|
|
-import event_bus, { addNotification } from '../../utils/event_bus.js';
|
|
|
+import event_bus from '../../utils/event_bus.js';
|
|
|
import {
|
|
|
EnumCmdEvent,
|
|
|
CmdEvent
|
|
@@ -590,11 +590,12 @@ 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 妙播收音机"}
|
|
|
+ var deviceList = that.getDeviceList();
|
|
|
+ let curDevice = deviceList[index]
|
|
|
if (index === deviceListSelect && device.state === "online") {
|
|
|
- route_util.jumpParam('/pages/deviceDetail/detail', JSON.stringify(device))
|
|
|
+ route_util.jumpParam('/pages/deviceDetail/detail', JSON.stringify(curDevice))
|
|
|
} else if (device.state === "offline") {
|
|
|
|
|
|
- var deviceList = that.getDeviceList();
|
|
|
var deviceListSelect = that.getDeviceListSelect();
|
|
|
if (deviceListSelect != null && deviceList.length > deviceListSelect) {
|
|
|
that.setData({
|
|
@@ -660,6 +661,7 @@ Page({
|
|
|
if (deviceList[index].connectType == 3) {
|
|
|
that.cancelWifi(index, false);
|
|
|
} else {
|
|
|
+ console.log("确定删除", index)
|
|
|
that.cancelBlue(index, false);
|
|
|
}
|
|
|
}
|
|
@@ -729,6 +731,8 @@ Page({
|
|
|
deviceListSelect: isCurrentIndex ? null : deviceListSelect,
|
|
|
});
|
|
|
|
|
|
+ console.log("最终确定删除", deviceId, JSON.stringify(deviceList), deviceList.length)
|
|
|
+
|
|
|
BtHelper.getInstance().disconnect({
|
|
|
"deviceId": deviceId
|
|
|
});
|
|
@@ -790,7 +794,16 @@ Page({
|
|
|
let that = this;
|
|
|
event_bus.removeNotification(CmdEvent.eventName, that);
|
|
|
event_bus.addNotification(CmdEvent.eventName, function (event) {
|
|
|
- if (event.cmdEvent == EnumCmdEvent.onoffline) {
|
|
|
+ if (event.cmdEvent == EnumCmdEvent.btMac) {
|
|
|
+ let deviceList = that.getDeviceList()
|
|
|
+ let disDevice = deviceList.find(item => {
|
|
|
+ return item.state == "online" && item.connectType === 1
|
|
|
+ })
|
|
|
+ if (disDevice) {
|
|
|
+ disDevice.mac = event.btMac
|
|
|
+ console.log("设备mac:", disDevice.mac)
|
|
|
+ }
|
|
|
+ } else if (event.cmdEvent == EnumCmdEvent.onoffline) {
|
|
|
let isFirst = false;
|
|
|
// 有下线就开启监听扫描
|
|
|
if (event.commonValue == "online") {
|