JNI.java
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2008, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00035 // author: Jason Wolfe
00036 
00037 
00038 package ros.roscpp;
00039 
00040 import ros.ServiceServer;
00041 import ros.Subscriber;
00042 import ros.communication.Message;
00043 import ros.communication.Time;
00044 
00045 class JNI {
00046         private JNI() {}
00047         static { 
00048                 System.loadLibrary("rosjava");
00049         }
00050 
00051         /************************************************************
00052          *   Startup,  Shutdown, Running, and Node info
00053          ************************************************************/
00054 
00055         public static native void init(String name, boolean noSigintHandler, boolean anonymousName, boolean noRosout, String[] args);
00056 
00057         public static native long createNodeHandle(String ns, Object[] remappings);
00058         public static native void shutdown(long cppHandle);
00059   public static native boolean nhOk(long cppHandle);
00060   public static native boolean rosOk();
00061         
00062         public static native void spin();
00063         public static native void spinOnce();
00064 
00065         public static native boolean checkMaster(long cppHandle);
00066         public static native String getMasterHost(long cppHandle);
00067         public static native int getMasterPort(long cppHandle);
00068         public static native void setMasterRetryTimeout(long cppHandle, int ms);
00069 
00070         public static native String getName(long cppHandle);
00071         public static native String mapName(long cppHandle, String name);
00072         
00073         public static native String getPackageLocation(String name);
00074 
00075         
00076         /************************************************************
00077          *   Logging
00078          ************************************************************/
00079 
00080         public static native void logDebug(String message);
00081         public static native void logInfo(String message);
00082         public static native void logWarn(String message);
00083         public static native void logError(String message);
00084         public static native void logFatal(String message);
00085 
00086 
00087         /************************************************************
00088          *   Miscellaneous getters
00089          ************************************************************/
00090 
00091         public static native Time now();
00092 
00093         public static native String [] getSubscribedTopics(long cppHandle);
00094         public static native String [] getAdvertisedTopics(long cppHandle);
00095         public static native String [] getPublishedTopics(long cppHandle);
00096         
00097         /************************************************************
00098          *   Parameter server calls
00099          ************************************************************/
00100 
00101         public static native boolean hasParam(long cppHandle, String param);
00102 
00103         public static native boolean getBooleanParam(long cppHandle, String param, boolean useCache);
00104         public static native int     getIntParam(long cppHandle, String param,    boolean useCache);
00105         public static native double  getDoubleParam(long cppHandle, String param, boolean useCache);
00106         public static native String  getStringParam(long cppHandle, String param, boolean useCache);
00107         
00108         public static native boolean setParam(long cppHandle, String param, boolean value);
00109         public static native boolean setParam(long cppHandle, String param, int     value);
00110         public static native boolean setParam(long cppHandle, String param, double  value);
00111         public static native boolean setParam(long cppHandle, String param, String  value);
00112 
00113         /************************************************************
00114          *   Subscriptions and Publications
00115          ************************************************************/
00116 
00117         @SuppressWarnings("unchecked")
00118         public static native long createSubCallback(Subscriber.Callback cb, Message template);
00119         public static native void deleteSubCallback(long cppCallback);
00120         public static native long subscribe(long cppHandle, String topic, long cppCallback, int queueSize);
00121         public static native boolean isSubscriberValid(long cppSubscriber);
00122         public static native void shutdownSubscriber(long cppSubscriber);
00123 
00124         public static native long advertise(long cppHandle, String topic, Message msgTemplate, int queueSize, boolean latch);
00125         public static native int getNumSubscribers(long cppPublisher);
00126         public static native void publish(long cppPublisher, Message m);
00127         public static native boolean isPublisherValid(long cppPublisher);
00128         public static native void shutdownPublisher(long cppPublisher);
00129 
00130         /************************************************************
00131          *   Service Clients and Servers
00132          ************************************************************/
00133         
00134         public static native long serviceClient(long cppHandle, String name, String md5, boolean isPersistant, Object [] headerValues);
00135         public static native boolean callService(long cppServiceClient, Message request, Message response, String md5);
00136         public static native void shutdownServiceClient(long cppServiceClient);
00137 
00138         @SuppressWarnings("unchecked")
00139         public static native long createSrvCallback(ServiceServer.Callback cb, String serviceMD5, String serviceDataType, Message reqTemplate, Message resTemplate);
00140         public static native void deleteSrvCallback(long cppCallback);
00141         public static native long advertiseService(long cppHandle, String name, long cppCallback);
00142         public static native boolean isServiceServerValid(long cppServiceServer);
00143         public static native void shutdownServiceServer(long cppServiceServer);
00144 
00145 }


rosjava_jni
Author(s): Jason Wolfe (jawolfe@willowgarage.com), Nicholas Butko (nbutko@cogsci.ucsd.edu), Lorenz Moesenlechner (moesenle@in.tum.de)
autogenerated on Thu Jan 2 2014 11:07:00