/** * @param request * @param response */ public void call(T request, ServiceResponseListener<S> response) { checkInitialized(); if (!client.isConnected() || client == null) { if (client != null) client.shutdown(); //locate URI System.err.println("re-connecting to service " + attachedServiceName); try { client = connectedNode.newServiceClient(attachedServiceName, getRequestType()); } catch (ServiceNotFoundException e) { System.err.println("rennection failed. Service not found"); throw new RosRuntimeException(e); } System.err.println("service re-connected, making call"); } client.call(request, response); }
/** * @param request * @param response */ public void call(T request, ServiceResponseListener<S> response) { checkInitialized(); if (!client.isConnected() || client == null) { if (client != null) client.shutdown(); //locate URI System.err.println("re-connecting to service " + attachedServiceName); try { client = connectedNode.newServiceClient(attachedServiceName, getRequestType()); } catch (ServiceNotFoundException e) { System.err.println("rennection failed. Service not found"); throw new RosRuntimeException(e); } System.err.println("service re-connected, making call"); } client.call(request, response); }
ServiceClient client = connectedNode.newServiceClient(entry.getKey(), rosServiceClient.getRequestType()); rosServiceClient.setServiceClient(client, connectedNode, entry.getKey()); break;
ServiceClient client = connectedNode.newServiceClient(entry.getKey(), rosServiceClient.getRequestType()); rosServiceClient.setServiceClient(client, connectedNode, entry.getKey()); break;
@Override public void onStart(final ConnectedNode connectedNode) { ServiceClient<rosjava_test_msgs.AddTwoIntsRequest, rosjava_test_msgs.AddTwoIntsResponse> serviceClient; try { serviceClient = connectedNode.newServiceClient("add_two_ints", rosjava_test_msgs.AddTwoInts._TYPE); } catch (ServiceNotFoundException e) { throw new RosRuntimeException(e); } final rosjava_test_msgs.AddTwoIntsRequest request = serviceClient.newMessage(); request.setA(2); request.setB(2); serviceClient.call(request, new ServiceResponseListener<rosjava_test_msgs.AddTwoIntsResponse>() { @Override public void onSuccess(rosjava_test_msgs.AddTwoIntsResponse response) { connectedNode.getLog().info( String.format("%d + %d = %d", request.getA(), request.getB(), response.getSum())); } @Override public void onFailure(RemoteException e) { throw new RosRuntimeException(e); } }); } }
@Override public void onStart(ConnectedNode connectedNode) { ServiceClient<rosjava_test_msgs.AddTwoIntsRequest, rosjava_test_msgs.AddTwoIntsResponse> serviceClient; try { serviceClient = connectedNode.newServiceClient(SERVICE_NAME, rosjava_test_msgs.AddTwoInts._TYPE); } catch (ServiceNotFoundException e) { throw new RosRuntimeException(e); } rosjava_test_msgs.AddTwoIntsRequest request = serviceClient.newMessage(); serviceClient.call(request, new ServiceResponseListener<rosjava_test_msgs.AddTwoIntsResponse>() { @Override public void onSuccess(rosjava_test_msgs.AddTwoIntsResponse message) { fail(); } @Override public void onFailure(RemoteException e) { assertEquals(e.getMessage(), errorMessage); latch.countDown(); } }); } }, nodeConfiguration);
ServiceClient<rosjava_test_msgs.AddTwoIntsRequest, rosjava_test_msgs.AddTwoIntsResponse> serviceClient; try { serviceClient = connectedNode.newServiceClient(SERVICE_NAME, rosjava_test_msgs.AddTwoInts._TYPE); connectedNode.newServiceClient(SERVICE_NAME, rosjava_test_msgs.AddTwoInts._TYPE); assertEquals(serviceClient, duplicate); } catch (ServiceNotFoundException e) {