|
@@ -84,7 +84,7 @@ Page({
|
|
var devicelist = wx.getStorageSync("devicelist") || "";
|
|
var devicelist = wx.getStorageSync("devicelist") || "";
|
|
if (!strings.isEmpty(devicelist)) {
|
|
if (!strings.isEmpty(devicelist)) {
|
|
var list = JSON.parse(devicelist);
|
|
var list = JSON.parse(devicelist);
|
|
- that.updateDeviceList(list, true);
|
|
|
|
|
|
+ that.updateDeviceList(list, false);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -164,12 +164,16 @@ Page({
|
|
}
|
|
}
|
|
///获取播放状态
|
|
///获取播放状态
|
|
else if (payloads.type === "play" || payloads.type === "play_state") {
|
|
else if (payloads.type === "play" || payloads.type === "play_state") {
|
|
- if (that.data.deviceListIndex === null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ var deviceList = that.data.deviceList;
|
|
|
|
+ var deviceListIndex = that.data.deviceListIndex;
|
|
|
|
+ if (deviceListIndex === null || deviceList.length <= deviceListIndex) {
|
|
|
|
+ return
|
|
|
|
+ };
|
|
|
|
+ var deviceId = deviceList[deviceListIndex].deviceId;
|
|
|
|
+
|
|
// 接收设备当前播放状态
|
|
// 接收设备当前播放状态
|
|
const obj = {
|
|
const obj = {
|
|
- DstDeviceName: that.getThisDeviceID()
|
|
|
|
|
|
+ DstDeviceName: that.getThisDeviceID(deviceId)
|
|
}
|
|
}
|
|
app.PubMsg({
|
|
app.PubMsg({
|
|
type: "get_position",
|
|
type: "get_position",
|
|
@@ -333,15 +337,28 @@ Page({
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
|
|
- if (that.data.deviceList.length === 0 || that.data.deviceListIndex === null) {
|
|
|
|
|
|
+ var deviceList = that.data.deviceList;
|
|
|
|
+ var deviceListIndex = that.data.deviceListIndex;
|
|
|
|
+ if (deviceListIndex === null || deviceList.length <= deviceListIndex) {
|
|
return
|
|
return
|
|
};
|
|
};
|
|
|
|
|
|
- let topic = `/AIrSMArT_${that.data.deviceList[that.data.deviceListIndex].name.split("BLUFI_")[1]}/user/pub_response`;
|
|
|
|
|
|
+ var tempDevice = that.data.deviceList[deviceListIndex];
|
|
|
|
+ var tempDeviceId = tempDevice.deviceId;
|
|
|
|
+ ///删除当前选中这个
|
|
|
|
+ deviceList.splice(deviceListIndex, 1);
|
|
|
|
+ ///添加到第一个去
|
|
|
|
+ deviceList.unshift(tempDevice);
|
|
|
|
+ that.setData({
|
|
|
|
+ deviceListIndex: 0,
|
|
|
|
+ deviceList: deviceList,
|
|
|
|
+ });
|
|
|
|
|
|
|
|
+ let topic = `/AIrSMArT_${tempDeviceId.split("BLUFI_")[1]}/user/pub_response`;
|
|
app.subscribe(topic);
|
|
app.subscribe(topic);
|
|
|
|
+
|
|
const obj = {
|
|
const obj = {
|
|
- DstDeviceName: that.getThisDeviceID()
|
|
|
|
|
|
+ DstDeviceName: that.getThisDeviceID(tempDeviceId)
|
|
};
|
|
};
|
|
app.PubMsg({
|
|
app.PubMsg({
|
|
type: "get_dev_info",
|
|
type: "get_dev_info",
|
|
@@ -364,6 +381,13 @@ Page({
|
|
that.setData({
|
|
that.setData({
|
|
actionIndex: e.currentTarget.dataset.index
|
|
actionIndex: e.currentTarget.dataset.index
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ var deviceList = that.data.deviceList;
|
|
|
|
+ var deviceListIndex = that.data.deviceListIndex;
|
|
|
|
+ if (deviceListIndex === null || deviceList.length <= deviceListIndex) {
|
|
|
|
+ return
|
|
|
|
+ };
|
|
|
|
+ var deviceId = deviceList[deviceListIndex].deviceId;
|
|
const other = {
|
|
const other = {
|
|
"url": "",
|
|
"url": "",
|
|
"media_data": "",
|
|
"media_data": "",
|
|
@@ -378,21 +402,23 @@ Page({
|
|
};
|
|
};
|
|
app.PubMsg({
|
|
app.PubMsg({
|
|
type: "play",
|
|
type: "play",
|
|
- DstDeviceName: that.getThisDeviceID(),
|
|
|
|
|
|
+ DstDeviceName: that.getThisDeviceID(deviceId),
|
|
other
|
|
other
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
- getThisDeviceID() {
|
|
|
|
- var that = this;
|
|
|
|
- return `AIrSMArT_${that.data.deviceList[that.data.deviceListIndex].name.split("BLUFI_")[1]}`
|
|
|
|
|
|
+ getThisDeviceID(deviceId) {
|
|
|
|
+ return `AIrSMArT_${deviceId.split("BLUFI_")[1]}`
|
|
},
|
|
},
|
|
|
|
|
|
getchannelData(clientType) {
|
|
getchannelData(clientType) {
|
|
var that = this;
|
|
var that = this;
|
|
- if (that.data.deviceListIndex === null) {
|
|
|
|
|
|
+ var deviceList = that.data.deviceList;
|
|
|
|
+ var deviceListIndex = that.data.deviceListIndex;
|
|
|
|
+ if (deviceListIndex === null || deviceList.length <= deviceListIndex) {
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
+ var deviceId = deviceList[deviceListIndex].deviceId;
|
|
|
|
|
|
listByDevice({
|
|
listByDevice({
|
|
clientType
|
|
clientType
|
|
@@ -402,7 +428,7 @@ Page({
|
|
});
|
|
});
|
|
// 接收设备当前播放状态
|
|
// 接收设备当前播放状态
|
|
const obj = {
|
|
const obj = {
|
|
- DstDeviceName: that.getThisDeviceID()
|
|
|
|
|
|
+ DstDeviceName: that.getThisDeviceID(deviceId)
|
|
}
|
|
}
|
|
app.PubMsg({
|
|
app.PubMsg({
|
|
type: "get_position",
|
|
type: "get_position",
|