From 41a915dae2fb4224844ac805894a7d07e3d44a29 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 14 Apr 2016 14:45:52 -0300 Subject: [PATCH] Incluindo função para delay na API java. --- src/java/main.cc | 17 +++++++++++++++++ src/java/terminal.java | 11 +++++++++++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/src/java/main.cc b/src/java/main.cc index 5809ae2..b3eaf2c 100644 --- a/src/java/main.cc +++ b/src/java/main.cc @@ -128,6 +128,23 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_wait_1for_1ready(JNIEnv *env, jobjec } +JNIEXPORT jint JNICALL Java_pw3270_terminal_wait(JNIEnv *env, jobject obj, jint seconds) { + + try { + + return getHandle(env,obj)->wait((int) seconds); + + } catch(std::exception &e) { + + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); + + } + + return 0; + +} + + JNIEXPORT void JNICALL Java_pw3270_terminal_log(JNIEnv *env, jobject obj, jstring j_str) { const char * str = env->GetStringUTFChars(j_str, 0); diff --git a/src/java/terminal.java b/src/java/terminal.java index 237bb09..085777e 100644 --- a/src/java/terminal.java +++ b/src/java/terminal.java @@ -43,6 +43,16 @@ public class terminal private native int deinit(); /** + * Wait for an specified amount of time. + *

+ * Wait for the specified time keeping the main loop active. + * + * @param seconds Number of seconds to wait. + * + */ + public native int wait(int seconds); + + /** * Wait for terminal negociation. *

* Wait on a loop until the terminal contents are @@ -439,6 +449,7 @@ public class terminal * */ public terminal(String id) { + load(); init(id); } -- libgit2 0.21.2