/** * Create a new Empty ServiceResponse based on the given * ServiceResponse. Any missing values will be set to their defaults. * * @param m * The ServiceResponse to parse. * @return A Empty ServiceResponse based on the given Message. */ public static Response fromServiceResponse(ServiceResponse resp) { // get it from the JSON object return Empty.Response.fromJsonObject(resp.toJsonObject()); }
/** * Create a new Empty ServiceResponse based on the given * ServiceResponse. Any missing values will be set to their defaults. * * @param resp the resp * @return A Empty ServiceResponse based on the given Message. */ public static Response fromServiceResponse(ServiceResponse resp) { // get it from the JSON object return Empty.Response.fromJsonObject(resp.toJsonObject()); }
/** * Create a clone of this ServiceResponse. */ @Override public ServiceResponse clone() { return new ServiceResponse(this.toJsonObject(), this.serviceResponseType, this.result); } }
/** * Create a clone of this ServiceResponse. */ @Override public ServiceResponse clone() { return new ServiceResponse(this.toJsonObject(), this.serviceResponseType, this.result); } }
/** * Send a service response. * * @param response * The service response to send. * @param id * The ID of the response (matching that of the service call). */ public void sendResponse(ServiceResponse response, String id) { // build and send the rosbridge call JsonObject call = Json.createObjectBuilder() .add(JRosbridge.FIELD_OP, JRosbridge.OP_CODE_SERVICE_RESPONSE) .add(JRosbridge.FIELD_ID, id) .add(JRosbridge.FIELD_SERVICE, this.name) .add(JRosbridge.FIELD_VALUES, response.toJsonObject()) .add(JRosbridge.FIELD_RESULT, response.getResult()).build(); this.ros.send(call); }
/** * Send a service response. * * @param response * The service response to send. * @param id * The ID of the response (matching that of the service call). */ public void sendResponse(ServiceResponse response, String id) { // build and send the rosbridge call JsonObject call = Json.createObjectBuilder() .add(JRosbridge.FIELD_OP, JRosbridge.OP_CODE_SERVICE_RESPONSE) .add(JRosbridge.FIELD_ID, id) .add(JRosbridge.FIELD_SERVICE, this.name) .add(JRosbridge.FIELD_VALUES, response.toJsonObject()) .add(JRosbridge.FIELD_RESULT, response.getResult()).build(); this.ros.send(call); }