Package org.ros.internal.node.service
Class DefaultServiceClient<T,S>
java.lang.Object
org.ros.internal.node.service.DefaultServiceClient<T,S>
- All Implemented Interfaces:
ServiceClient<T,S>
Default implementation of a
ServiceClient.- Author:
- damonkohler@google.com (Damon Kohler)
-
Method Summary
Modifier and TypeMethodDescriptionvoidcall(T request, ServiceResponseListener<S> listener) Calls a method on theServiceServer.voidConnects to aServiceServer.getName()booleanstatic <S,T> DefaultServiceClient<S, T> newDefault(GraphName nodeName, ServiceDeclaration serviceDeclaration, org.ros.message.MessageSerializer<S> serializer, org.ros.message.MessageDeserializer<T> deserializer, org.ros.message.MessageFactory messageFactory, ScheduledExecutorService executorService) voidshutdown()Stops the client (e.g.toString()
-
Method Details
-
newDefault
public static <S,T> DefaultServiceClient<S,T> newDefault(GraphName nodeName, ServiceDeclaration serviceDeclaration, org.ros.message.MessageSerializer<S> serializer, org.ros.message.MessageDeserializer<T> deserializer, org.ros.message.MessageFactory messageFactory, ScheduledExecutorService executorService) -
connect
Description copied from interface:ServiceClientConnects to aServiceServer.- Specified by:
connectin interfaceServiceClient<T,S> - Parameters:
uri- theURIof theServiceServerto connect to
-
shutdown
public void shutdown()Description copied from interface:ServiceClientStops the client (e.g. disconnect a persistent service connection).- Specified by:
shutdownin interfaceServiceClient<T,S>
-
call
Description copied from interface:ServiceClientCalls a method on theServiceServer.- Specified by:
callin interfaceServiceClient<T,S> - Parameters:
request- the request messagelistener- theServiceResponseListenerthat will handle the response to this request
-
getName
- Specified by:
getNamein interfaceServiceClient<T,S> - Returns:
- the name of the service this
ServiceClientis connected to
-
toString
-
newMessage
- Specified by:
newMessagein interfaceServiceClient<T,S> - Returns:
- a new request message
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceServiceClient<T,S> - Returns:
trueif theServiceClientis connected
-