设备控制
parent
528caef3a5
commit
a18f888531
|
|
@ -455,6 +455,7 @@ export default {
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
success: (res) =>{
|
success: (res) =>{
|
||||||
|
if (res.confirm) {
|
||||||
console.info("操作功能:【"+type+"】,变更状态为:"+ status)
|
console.info("操作功能:【"+type+"】,变更状态为:"+ status)
|
||||||
if (!this.connected) {
|
if (!this.connected) {
|
||||||
// 链接mqtt
|
// 链接mqtt
|
||||||
|
|
@ -468,6 +469,7 @@ export default {
|
||||||
// 设备回执
|
// 设备回执
|
||||||
this.ackMessage(type);
|
this.ackMessage(type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
console.info(this.status)
|
console.info(this.status)
|
||||||
},
|
},
|
||||||
|
|
@ -515,6 +517,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
publishMessage() {
|
publishMessage() {
|
||||||
|
console.info("开始发布消息")
|
||||||
if (!this.connected || !this.publishTopic || !this.message) {
|
if (!this.connected || !this.publishTopic || !this.message) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '控制设备失败',
|
title: '控制设备失败',
|
||||||
|
|
@ -536,6 +539,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
ackMessage(type) {
|
ackMessage(type) {
|
||||||
|
console.info("处理回执消息")
|
||||||
this.client.on("message", (topic, payload) => {
|
this.client.on("message", (topic, payload) => {
|
||||||
// 1. 先判断是否是目标订阅主题(如dtu/xxx/up)
|
// 1. 先判断是否是目标订阅主题(如dtu/xxx/up)
|
||||||
if (topic !== this.status.subscribeTopic) return;
|
if (topic !== this.status.subscribeTopic) return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue