org.ros.node.topic
Interface Subscriber<T>

Type Parameters:
T - the Subscriber may only subscribe to messages of this type
All Superinterfaces:
TopicParticipant
All Known Implementing Classes:
DefaultSubscriber

public interface Subscriber<T>
extends TopicParticipant

Subscribes to messages of a given type on a given ROS topic.


Field Summary
static java.lang.String TOPIC_MESSAGE_TYPE_WILDCARD
          The message type given when a Subscriber chooses not to commit to a specific message type.
 
Method Summary
 void addMessageListener(MessageListener<T> listener)
           
 void addSubscriberListener(SubscriberListener<T> listener)
          Add a new lifecycle listener to the subscriber.
 boolean getLatchMode()
           
 int getQueueLimit()
           
 void removeMessageListener(MessageListener<T> listener)
           
 void removeSubscriberListener(SubscriberListener<T> listener)
          Remove a lifecycle listener from the subscriber.
 void setQueueLimit(int limit)
           
 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.
 
Methods inherited from interface org.ros.internal.node.topic.TopicParticipant
getTopicMessageType, getTopicName
 

Field Detail

TOPIC_MESSAGE_TYPE_WILDCARD

static final java.lang.String TOPIC_MESSAGE_TYPE_WILDCARD
The message type given when a Subscriber chooses not to commit to a specific message type.

See Also:
Constant Field Values
Method Detail

addMessageListener

void addMessageListener(MessageListener<T> listener)
Parameters:
listener - this MessageListener will be called for every new message received

removeMessageListener

void removeMessageListener(MessageListener<T> listener)
Parameters:
listener - the MessageListener to remove

shutdown

void shutdown(long timeout,
              java.util.concurrent.TimeUnit unit)
Shuts down and unregisters the Subscriber. 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

void shutdown()
Shuts down and unregisters the Subscriber using the default timeout for SubscriberListener.onShutdown(Subscriber) callbacks.

SubscriberListener.onShutdown(Subscriber) callbacks are executed in separate threads.

See Also:
shutdown(long, TimeUnit)

addSubscriberListener

void addSubscriberListener(SubscriberListener<T> listener)
Add a new lifecycle listener to the subscriber.

Parameters:
listener - The listener to add.

removeSubscriberListener

void removeSubscriberListener(SubscriberListener<T> listener)
Remove a lifecycle listener from the subscriber.

Nothing will happen if the given listener is not registered.

Parameters:
listener - The listener to remove.

setQueueLimit

void setQueueLimit(int limit)
Parameters:
limit - the maximum number of incoming messages to queue (i.e. buffer)

getQueueLimit

int getQueueLimit()
Returns:
the maximum number of incoming messages to queue (i.e. buffer)

getLatchMode

boolean getLatchMode()
Returns:
true if the Publisher of this Subscriber's topic is latched, false otherwise