$search
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 00039 00040 #include <jni.h> 00041 /* Header for class ros_roscpp_JNI */ 00042 00043 #ifndef _Included_ros_roscpp_JNI 00044 #define _Included_ros_roscpp_JNI 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 00050 /************************************************************ 00051 * Node Handle creation, running, destruction, and features 00052 ************************************************************/ 00053 00054 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_init 00055 (JNIEnv * env, jclass __jni, jstring name, jboolean noSigintHandler, jboolean anonymousName, jboolean noRosout, jobjectArray jargs); 00056 00057 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_createNodeHandle 00058 (JNIEnv * env, jclass __jni, jstring jns, jobjectArray jmappings); 00059 00060 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_shutdown 00061 (JNIEnv * env, jclass __jni, jlong cppHandle); 00062 00063 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_nhOk 00064 (JNIEnv * env, jclass __jni, jlong cppHandle); 00065 00066 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_rosOk 00067 (JNIEnv * env, jclass __jni); 00068 00069 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_spin 00070 (JNIEnv * env, jclass __jni); 00071 00072 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_spinOnce 00073 (JNIEnv * env, jclass __jni); 00074 00075 00076 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_checkMaster 00077 (JNIEnv * env, jclass __jni, jlong cppHandle); 00078 00079 JNIEXPORT jstring JNICALL Java_ros_roscpp_JNI_getMasterHost 00080 (JNIEnv * env, jclass __jni, jlong cppHandle); 00081 00082 JNIEXPORT jint JNICALL Java_ros_roscpp_JNI_getMasterPort 00083 (JNIEnv * env, jclass __jni, jlong cppHandle); 00084 00085 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_setMasterRetryTimeout 00086 (JNIEnv * env, jclass __jni, jlong cppHandle, jint ms); 00087 00088 00089 JNIEXPORT jstring JNICALL Java_ros_roscpp_JNI_getName 00090 (JNIEnv * env, jclass __jni, jlong cppHandle); 00091 00092 JNIEXPORT jstring JNICALL Java_ros_roscpp_JNI_mapName 00093 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jname); 00094 00095 00096 JNIEXPORT jstring JNICALL Java_ros_roscpp_JNI_getPackageLocation 00097 (JNIEnv * env, jclass __jni, jstring jname); 00098 00099 00100 00101 /************************************************************ 00102 * Logging 00103 ************************************************************/ 00104 00105 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_logDebug 00106 (JNIEnv * env, jclass __jni, jstring jmessage); 00107 00108 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_logInfo 00109 (JNIEnv * env, jclass __jni, jstring jmessage); 00110 00111 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_logWarn 00112 (JNIEnv * env, jclass __jni, jstring jmessage); 00113 00114 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_logError 00115 (JNIEnv * env, jclass __jni, jstring jmessage); 00116 00117 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_logFatal 00118 (JNIEnv * env, jclass __jni, jstring jmessage); 00119 00120 00121 /************************************************************ 00122 * Getting miscellaneous info 00123 ************************************************************/ 00124 00125 JNIEXPORT jobject JNICALL Java_ros_roscpp_JNI_now 00126 (JNIEnv * env, jclass __jni); 00127 00128 JNIEXPORT jobjectArray JNICALL Java_ros_roscpp_JNI_getSubscribedTopics 00129 (JNIEnv * env, jclass __jni, jlong cppHandle); 00130 00131 JNIEXPORT jobjectArray JNICALL Java_ros_roscpp_JNI_getAdvertisedTopics 00132 (JNIEnv * env, jclass __jni, jlong cppHandle); 00133 00134 JNIEXPORT jobjectArray JNICALL Java_ros_roscpp_JNI_getPublishedTopics 00135 (JNIEnv * env, jclass __jni, jlong cppHandle); 00136 00137 00138 00139 /************************************************************ 00140 * Parameters 00141 ************************************************************/ 00142 00143 00144 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_hasParam 00145 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam); 00146 00147 // Throws RosException on failure. 00148 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_getBooleanParam 00149 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jboolean cache); 00150 00151 // Throws RosException on failure. 00152 JNIEXPORT jint JNICALL Java_ros_roscpp_JNI_getIntParam 00153 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jboolean cache); 00154 00155 // Throws RosException on failure. 00156 JNIEXPORT jdouble JNICALL Java_ros_roscpp_JNI_getDoubleParam 00157 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jboolean cache); 00158 00159 // Throws RosException on failure. 00160 JNIEXPORT jstring JNICALL Java_ros_roscpp_JNI_getStringParam 00161 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jboolean cache); 00162 00163 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_setParam__JLjava_lang_String_2Z 00164 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jboolean val); 00165 00166 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_setParam__JLjava_lang_String_2I 00167 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jint val); 00168 00169 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_setParam__JLjava_lang_String_2D 00170 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jdouble val); 00171 00172 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_setParam__JLjava_lang_String_2Ljava_lang_String_2 00173 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jparam, jstring val); 00174 00175 00176 00177 /************************************************************ 00178 * Subscriptions 00179 ************************************************************/ 00180 00181 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_createSubCallback 00182 (JNIEnv * env, jclass __jni, jobject jcallback, jobject messageTemplate); 00183 00184 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_deleteSubCallback 00185 (JNIEnv * env, jclass __jni, jlong cppCallback); 00186 00187 00188 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_subscribe 00189 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jtopic, jlong cppCallback, jint queueSize); 00190 00191 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_isSubscriberValid 00192 (JNIEnv * env, jclass __jni, jlong cppSubscriber); 00193 00194 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_shutdownSubscriber 00195 (JNIEnv * env, jclass __jni, jlong cppSubscriber); 00196 00197 00198 00199 /************************************************************ 00200 * Publications 00201 ************************************************************/ 00202 00203 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_advertise 00204 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring jtopic, jobject jmessage, jint queueSize, jboolean latch); 00205 00206 JNIEXPORT jint JNICALL Java_ros_roscpp_JNI_getNumSubscribers 00207 (JNIEnv * env, jclass __jni, jlong cppPublisher); 00208 00209 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_publish 00210 (JNIEnv * env, jclass __jni, jlong cppPublisher, jobject jmessage); 00211 00212 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_isPublisherValid 00213 (JNIEnv * env, jclass __jni, jlong cppPublisher); 00214 00215 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_shutdownPublisher 00216 (JNIEnv * env, jclass __jni, jlong cppPublisher); 00217 00218 00219 /************************************************************ 00220 * Service Clients 00221 ************************************************************/ 00222 00223 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_serviceClient 00224 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring name, jstring md5, jboolean persist, jobjectArray jheaderValues); 00225 00226 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_callService 00227 (JNIEnv * env, jclass __jni, jlong cppServiceClient, jobject jrequest, jobject jresponse, jstring md5); 00228 00229 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_shutdownServiceClient 00230 (JNIEnv * env, jclass __jni, jlong cppServiceClient); 00231 00232 00233 /************************************************************ 00234 * Service Servers 00235 ************************************************************/ 00236 00237 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_createSrvCallback 00238 (JNIEnv * env, jclass __jni, jobject jcallback, jstring serviceMD5, jstring serviceDataType, jobject jreq, jobject jres); 00239 00240 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_deleteSrvCallback 00241 (JNIEnv * env, jclass __jni, jlong cppCallback); 00242 00243 00244 JNIEXPORT jlong JNICALL Java_ros_roscpp_JNI_advertiseService 00245 (JNIEnv * env, jclass __jni, jlong cppHandle, jstring name, jlong cppCallback); 00246 00247 JNIEXPORT jboolean JNICALL Java_ros_roscpp_JNI_isServiceServerValid 00248 (JNIEnv * env, jclass __jni, jlong cppServiceServer); 00249 00250 JNIEXPORT void JNICALL Java_ros_roscpp_JNI_shutdownServiceServer 00251 (JNIEnv * env, jclass __jni, jlong cppServiceServer); 00252 00253 00254 #ifdef __cplusplus 00255 } 00256 #endif 00257 #endif