public class Service extends Object
| Constructor and Description |
|---|
Service(Ros ros,
String name,
String type)
Create a ROS service with the given information.
|
| Modifier and Type | Method and Description |
|---|---|
void |
advertiseService(CallServiceCallback cb)
Registers as service advertiser.
|
void |
callService(ServiceRequest request,
ServiceCallback cb)
Call this service.
|
ServiceResponse |
callServiceAndWait(ServiceRequest request)
Call the service and wait for a response.
|
String |
getName()
Get the name of this service.
|
Ros |
getRos()
Get the ROS connection handle for this service.
|
String |
getType()
Return the service type of this service.
|
boolean |
isAdvertised()
Check if the current service is advertising to ROS.
|
void |
sendResponse(ServiceResponse response,
String id)
Send a service response.
|
void |
unadvertiseService()
Unregisters as service advertiser.
|
public Ros getRos()
public String getName()
public String getType()
public boolean isAdvertised()
public void callService(ServiceRequest request, ServiceCallback cb)
request - The service request to send.cb - The callback used when the associated response comes back.public void sendResponse(ServiceResponse response, String id)
response - The service response to send.id - The ID of the response (matching that of the service call).public void advertiseService(CallServiceCallback cb)
public void unadvertiseService()
public ServiceResponse callServiceAndWait(ServiceRequest request)
callService method.request - The service request to send.Copyright © 2014. All rights reserved.