Commit 41a915dae2fb4224844ac805894a7d07e3d44a29

Authored by Perry Werneck
1 parent b265149c

Incluindo função para delay na API java.

Showing 2 changed files with 28 additions and 0 deletions   Show diff stats
src/java/main.cc
... ... @@ -128,6 +128,23 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_wait_1for_1ready(JNIEnv *env, jobjec
128 128  
129 129 }
130 130  
  131 +JNIEXPORT jint JNICALL Java_pw3270_terminal_wait(JNIEnv *env, jobject obj, jint seconds) {
  132 +
  133 + try {
  134 +
  135 + return getHandle(env,obj)->wait((int) seconds);
  136 +
  137 + } catch(std::exception &e) {
  138 +
  139 + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
  140 +
  141 + }
  142 +
  143 + return 0;
  144 +
  145 +}
  146 +
  147 +
131 148 JNIEXPORT void JNICALL Java_pw3270_terminal_log(JNIEnv *env, jobject obj, jstring j_str) {
132 149  
133 150 const char * str = env->GetStringUTFChars(j_str, 0);
... ...
src/java/terminal.java
... ... @@ -43,6 +43,16 @@ public class terminal
43 43 private native int deinit();
44 44  
45 45 /**
  46 + * Wait for an specified amount of time.
  47 + * <p>
  48 + * Wait for the specified time keeping the main loop active.
  49 + *
  50 + * @param seconds Number of seconds to wait.
  51 + *
  52 + */
  53 + public native int wait(int seconds);
  54 +
  55 + /**
46 56 * Wait for terminal negociation.
47 57 * <p>
48 58 * Wait on a loop until the terminal contents are
... ... @@ -439,6 +449,7 @@ public class terminal
439 449 *
440 450 */
441 451 public terminal(String id) {
  452 + load();
442 453 init(id);
443 454 }
444 455  
... ...