提交 88d1baf4 编写于 作者: J Jason

bugfixed

上级 554df32a
......@@ -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
......
......@@ -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);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册