1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef LIBTEXTCLASSIFIER_ACTIONS_ACTIONS_JNI_H_ 18 #define LIBTEXTCLASSIFIER_ACTIONS_ACTIONS_JNI_H_ 19 20 #include <jni.h> 21 #include <string> 22 #include "utils/java/jni-base.h" 23 24 #ifndef TC3_ACTIONS_CLASS_NAME 25 #define TC3_ACTIONS_CLASS_NAME ActionsSuggestionsModel 26 #endif 27 28 #define TC3_ACTIONS_CLASS_NAME_STR TC3_ADD_QUOTES(TC3_ACTIONS_CLASS_NAME) 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 TC3_JNI_METHOD(jlong, TC3_ACTIONS_CLASS_NAME, nativeNewActionsModel) 35 (JNIEnv* env, jobject clazz, jint fd, jbyteArray serialized_preconditions); 36 37 TC3_JNI_METHOD(jlong, TC3_ACTIONS_CLASS_NAME, nativeNewActionsModelFromPath) 38 (JNIEnv* env, jobject clazz, jstring path, jbyteArray serialized_preconditions); 39 40 TC3_JNI_METHOD(jlong, TC3_ACTIONS_CLASS_NAME, nativeNewActionsModelWithOffset) 41 (JNIEnv* env, jobject clazz, jint fd, jlong offset, jlong size, 42 jbyteArray serialized_preconditions); 43 44 TC3_JNI_METHOD(jboolean, TC3_ACTIONS_CLASS_NAME, 45 nativeInitializeConversationIntentDetection) 46 (JNIEnv* env, jobject thiz, jlong ptr, jbyteArray jserialized_config); 47 48 TC3_JNI_METHOD(jobject, TC3_ACTIONS_CLASS_NAME, nativeSuggestActions) 49 (JNIEnv* env, jobject thiz, jlong ptr, jobject jconversation, jobject joptions, 50 jlong annotatorPtr, jobject app_context, jstring device_locales, 51 jboolean generate_intents); 52 53 TC3_JNI_METHOD(void, TC3_ACTIONS_CLASS_NAME, nativeCloseActionsModel) 54 (JNIEnv* env, jobject thiz, jlong ptr); 55 56 TC3_JNI_METHOD(jstring, TC3_ACTIONS_CLASS_NAME, nativeGetLocales) 57 (JNIEnv* env, jobject clazz, jint fd); 58 59 TC3_JNI_METHOD(jstring, TC3_ACTIONS_CLASS_NAME, nativeGetLocalesWithOffset) 60 (JNIEnv* env, jobject clazz, jint fd, jlong offset, jlong size); 61 62 TC3_JNI_METHOD(jstring, TC3_ACTIONS_CLASS_NAME, nativeGetName) 63 (JNIEnv* env, jobject clazz, jint fd); 64 65 TC3_JNI_METHOD(jstring, TC3_ACTIONS_CLASS_NAME, nativeGetNameWithOffset) 66 (JNIEnv* env, jobject clazz, jint fd, jlong offset, jlong size); 67 68 TC3_JNI_METHOD(jint, TC3_ACTIONS_CLASS_NAME, nativeGetVersion) 69 (JNIEnv* env, jobject clazz, jint fd); 70 71 TC3_JNI_METHOD(jint, TC3_ACTIONS_CLASS_NAME, nativeGetVersionWithOffset) 72 (JNIEnv* env, jobject clazz, jint fd, jlong offset, jlong size); 73 74 TC3_JNI_METHOD(jlong, TC3_ACTIONS_CLASS_NAME, nativeGetNativeModelPtr) 75 (JNIEnv* env, jobject thiz, jlong ptr); 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif // LIBTEXTCLASSIFIER_ACTIONS_ACTIONS_JNI_H_ 82