public class DefaultSubscriber<T> extends DefaultTopicParticipant implements Subscriber<T>
Subscriber.TOPIC_MESSAGE_TYPE_WILDCARD| Modifier and Type | Method and Description |
|---|---|
void |
addMessageListener(org.ros.message.MessageListener<T> messageListener)
Adds a
MessageListener with a limit of 1. |
void |
addMessageListener(org.ros.message.MessageListener<T> messageListener,
int limit)
Adds a
MessageListener to be called when new messages are received. |
void |
addPublisher(PublisherIdentifier publisherIdentifier,
java.net.InetSocketAddress address) |
void |
addSubscriberListener(SubscriberListener<T> listener)
Add a new lifecycle listener to the subscriber.
|
boolean |
getLatchMode() |
java.util.Collection<java.lang.String> |
getSupportedProtocols() |
static <S> DefaultSubscriber<S> |
newDefault(NodeIdentifier nodeIdentifier,
TopicDeclaration description,
java.util.concurrent.ScheduledExecutorService executorService,
org.ros.message.MessageDeserializer<S> deserializer) |
void |
shutdown()
Shuts down and unregisters the
Subscriber using the default timeout
for SubscriberListener.onShutdown(Subscriber) callbacks. |
void |
shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Shuts down and unregisters the
Subscriber. |
void |
signalOnMasterRegistrationFailure()
Signal all
SubscriberListeners that the Subscriber has
failed to register with the master. |
void |
signalOnMasterRegistrationSuccess()
Signal all
SubscriberListeners that the Subscriber has
successfully registered with the master. |
void |
signalOnMasterUnregistrationFailure()
Signal all
SubscriberListeners that the Subscriber has
failed to unregister with the master. |
void |
signalOnMasterUnregistrationSuccess()
Signal all
SubscriberListeners that the Subscriber has
successfully unregistered with the master. |
void |
signalOnNewPublisher(PublisherIdentifier publisherIdentifier)
Signal all
SubscriberListeners that a new Publisher has
connected. |
SubscriberDeclaration |
toDeclaration() |
SubscriberIdentifier |
toIdentifier() |
java.lang.String |
toString() |
void |
updatePublishers(java.util.Collection<PublisherIdentifier> publisherIdentifiers)
Updates the list of
Publishers for the topic that this
Subscriber is interested in. |
getTopicDeclaration, getTopicDeclarationAsList, getTopicDeclarationHeader, getTopicMessageType, getTopicNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTopicMessageType, getTopicNamepublic static <S> DefaultSubscriber<S> newDefault(NodeIdentifier nodeIdentifier, TopicDeclaration description, java.util.concurrent.ScheduledExecutorService executorService, org.ros.message.MessageDeserializer<S> deserializer)
public SubscriberIdentifier toIdentifier()
public SubscriberDeclaration toDeclaration()
public java.util.Collection<java.lang.String> getSupportedProtocols()
public boolean getLatchMode()
getLatchMode in interface Subscriber<T>true if the Publisher of this Subscriber's
topic is latched, false otherwisepublic void addMessageListener(org.ros.message.MessageListener<T> messageListener, int limit)
SubscriberMessageListener to be called when new messages are received.
The MessageListener will be executed serially in its own thread. If
the MessageListener processes new messages slower than they arrive,
new messages will be queued up to the specified limit. Older messages are
removed from the buffer when the buffer limit is exceeded.
addMessageListener in interface Subscriber<T>messageListener - this MessageListener will be called when new messages are
receivedlimit - the maximum number of messages to bufferpublic void addMessageListener(org.ros.message.MessageListener<T> messageListener)
SubscriberMessageListener with a limit of 1.addMessageListener in interface Subscriber<T>Subscriber.addMessageListener(MessageListener, int)public void addPublisher(PublisherIdentifier publisherIdentifier, java.net.InetSocketAddress address)
public void updatePublishers(java.util.Collection<PublisherIdentifier> publisherIdentifiers)
Publishers for the topic that this
Subscriber is interested in.publisherIdentifiers - Collection of PublisherIdentifiers for the
subscribed topicpublic void shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
SubscriberSubscriber. using the default
timeout Shutdown is delayed by at most the specified timeout to allow
SubscriberListener.onShutdown(Subscriber) callbacks to complete.
SubscriberListener.onShutdown(Subscriber) callbacks are executed in
separate threads.
shutdown in interface Subscriber<T>public void shutdown()
SubscriberSubscriber using the default timeout
for SubscriberListener.onShutdown(Subscriber) callbacks.
SubscriberListener.onShutdown(Subscriber) callbacks are executed in
separate threads.
shutdown in interface Subscriber<T>Subscriber.shutdown(long, TimeUnit)public void addSubscriberListener(SubscriberListener<T> listener)
SubscriberaddSubscriberListener in interface Subscriber<T>listener - The listener to add.public void signalOnMasterRegistrationSuccess()
SubscriberListeners that the Subscriber has
successfully registered with the master.
Each listener is called in a separate thread.
signalOnMasterRegistrationSuccess in class DefaultTopicParticipantpublic void signalOnMasterRegistrationFailure()
SubscriberListeners that the Subscriber has
failed to register with the master.
Each listener is called in a separate thread.
signalOnMasterRegistrationFailure in class DefaultTopicParticipantpublic void signalOnMasterUnregistrationSuccess()
SubscriberListeners that the Subscriber has
successfully unregistered with the master.
Each listener is called in a separate thread.
signalOnMasterUnregistrationSuccess in class DefaultTopicParticipantpublic void signalOnMasterUnregistrationFailure()
SubscriberListeners that the Subscriber has
failed to unregister with the master.
Each listener is called in a separate thread.
signalOnMasterUnregistrationFailure in class DefaultTopicParticipantpublic void signalOnNewPublisher(PublisherIdentifier publisherIdentifier)
SubscriberListeners that a new Publisher has
connected.
Each listener is called in a separate thread.
public java.lang.String toString()
toString in class java.lang.Object