00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
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
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
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
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
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
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
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 }