From e02f4bf6d83f1e5285c0f5215b8167493b582d69 Mon Sep 17 00:00:00 2001 From: LiXiaoqi <2360211477.com> Date: Thu, 21 Nov 2024 15:00:51 +0800 Subject: [PATCH] id --- lib/core/topic.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/topic.dart b/lib/core/topic.dart index 5791009..aa4d7d1 100644 --- a/lib/core/topic.dart +++ b/lib/core/topic.dart @@ -100,7 +100,7 @@ class Topic { if (subscribeId == null) { // Create the listenable broadcast subscription stream. subscription = ros.stream; - subscribeId = ros.requestSubscriber(name); + await safeSend(Request( op: 'subscribe', id: subscribeId, @@ -144,11 +144,11 @@ class Topic { Future publish(dynamic message) async { // Advertise the topic and then send the publish request. await advertise(); - publishId = ros.requestPublisher(name); await safeSend(publishReq(message)); } Request publishReq(dynamic message) { + publishId = ros.requestPublisher(name); return Request( op: 'publish', topic: name, @@ -162,7 +162,6 @@ class Topic { Future advertise() async { if (!isAdvertised) { // Send the advertisement request. - advertiseId = ros.requestAdvertiser(name); await safeSend(advertiseReq()); // If the ROS connection closes show that we're not advertising anymore. watchForClose(); @@ -170,6 +169,7 @@ class Topic { } Request advertiseReq() { + advertiseId = ros.requestAdvertiser(name); return Request( op: 'advertise', id: advertiseId,