Add jni interface for get_last_error_string

This commit is contained in:
Mathew Winters 2018-12-05 07:56:05 +13:00
parent df6d045f45
commit bd7ff9b10f
2 changed files with 18 additions and 0 deletions

View File

@ -86,6 +86,8 @@ public class LibFreeRDP {
private static native boolean freerdp_send_clipboard_data(long inst, String data);
private static native String freerdp_get_last_error_string(long inst);
public static void setEventListener(EventListener l) {
listener = l;
}

View File

@ -793,6 +793,17 @@ static void JNICALL jni_freerdp_free(JNIEnv* env, jclass cls, jlong instance)
#endif
}
static jstring JNICALL jni_freerdp_get_last_error_string(JNIEnv* env, jclass cls, jlong instance)
{
freerdp* inst = (freerdp*)instance;
if (!inst || !inst->context)
return (*env)->NewStringUTF(env, "");
return (*env)->NewStringUTF(env,
freerdp_get_last_error_string(freerdp_get_last_error(inst->context)));
}
static jboolean JNICALL jni_freerdp_parse_arguments(
JNIEnv* env, jclass cls, jlong instance, jobjectArray arguments)
{
@ -1101,6 +1112,11 @@ static JNINativeMethod methods[] =
"()Ljava/lang/String;",
&jni_freerdp_get_build_config
},
{
"freerdp_get_last_error_string",
"(J)Ljava/lang/String;",
&jni_freerdp_get_last_error_string
},
{
"freerdp_new",
"(Landroid/content/Context;)J",