diff --git a/internal/core/dbus.go b/internal/core/dbus.go index 52811d0289b570428c9e628c2213cc2821b0bb08..abe8d2d39ed73cc005299e33eff9c66f46442c51 100644 --- a/internal/core/dbus.go +++ b/internal/core/dbus.go @@ -43,15 +43,15 @@ func StartDBus(addr string) error { // return true //}) - hive.Subscribe("/+/+/transfer", func(pub *packet.Publish) { + hive.Subscribe("/link/+/+/transfer", func(pub *packet.Publish) { //log.Println(string(pub.Topic()), string(pub.Payload())) topics := strings.Split(string(pub.Topic()), "/") - channelId, err := strconv.Atoi(topics[1]) + channelId, err := strconv.Atoi(topics[2]) if err != nil { log.Println(err) return } - linkId, err := strconv.Atoi(topics[2]) + linkId, err := strconv.Atoi(topics[3]) if err != nil { log.Println(err) return diff --git a/portal/src/app/main/link-monitor/link-monitor.component.ts b/portal/src/app/main/link-monitor/link-monitor.component.ts index c7a0791c2df51ce35ddaa619c780f27996aec214..dd5216fb1bf3388e88f1c0081e0c31539be561c6 100644 --- a/portal/src/app/main/link-monitor/link-monitor.component.ts +++ b/portal/src/app/main/link-monitor/link-monitor.component.ts @@ -11,7 +11,6 @@ import {MqttService} from '../../mqtt.service'; export class LinkMonitorComponent implements OnInit, OnDestroy { title = '连接监控'; - @ViewChild('contentRecv') contentRecv: ElementRef; @@ -63,7 +62,7 @@ export class LinkMonitorComponent implements OnInit, OnDestroy { } subscribe(): void { - this.recvSub = this.mqtt.subscribe('/' + this.link.channel_id + '/' + this.id + '/recv').subscribe(packet => { + this.recvSub = this.mqtt.subscribe('/link/' + this.link.channel_id + '/' + this.id + '/recv').subscribe(packet => { this.dataRecv.push({ data: this.buffer_to_hex(packet.payload), time: new Date(), @@ -74,7 +73,7 @@ export class LinkMonitorComponent implements OnInit, OnDestroy { this.contentRecv.nativeElement.scrollTo(0, this.contentRecv.nativeElement.scrollHeight); }); - this.sendSub = this.mqtt.subscribe('/' + this.link.channel_id + '/' + this.id + '/send').subscribe(packet => { + this.sendSub = this.mqtt.subscribe('/link/' + this.link.channel_id + '/' + this.id + '/send').subscribe(packet => { this.dataSend.push({ data: this.buffer_to_hex(packet.payload), time: new Date(), @@ -105,7 +104,7 @@ export class LinkMonitorComponent implements OnInit, OnDestroy { if (this.isHex) { content = this.hex_to_buffer(this.text); } - this.mqtt.publish('/' + this.link.channel_id + '/' + this.id + '/transfer', content); + this.mqtt.publish('/link/' + this.link.channel_id + '/' + this.id + '/transfer', content); } }