00001 package com.github.rosjava.android_apps.application_management.rapp_manager; 00002 00003 import org.ros.namespace.GraphName; 00004 import org.ros.node.AbstractNodeMain; 00005 import org.ros.node.ConnectedNode; 00006 import org.ros.node.topic.Publisher; 00007 00016 public class PairingApplicationNamePublisher extends AbstractNodeMain { 00017 private String name; 00018 private static final String TOPIC_NAME = "/pairing_master/android_app_name"; 00019 private Publisher<std_msgs.String> publisher; 00020 00021 public PairingApplicationNamePublisher(String name) { 00022 this.name = name; 00023 } 00024 00025 @Override 00026 public GraphName getDefaultNodeName() { 00027 return GraphName.of("android/application_name"); 00028 } 00029 00030 @Override 00031 public void onStart(final ConnectedNode connectedNode) { 00032 publisher = connectedNode.newPublisher(PairingApplicationNamePublisher.TOPIC_NAME, std_msgs.String._TYPE); 00033 publisher.setLatchMode(Boolean.TRUE); 00034 std_msgs.String str = publisher.newMessage(); 00035 str.setData(this.name); 00036 publisher.publish(str); 00037 } 00038 } 00039