Commit 9fb62a82fbc581906367432e0ffd5a3d11d1fa20
1 parent
59735797
Exists in
master
and in
5 other branches
Atualizando documentação, experimentando conexão ao host
Showing
4 changed files
with
58 additions
and
0 deletions
Show diff stats
src/java/Makefile.in
| ... | ... | @@ -94,6 +94,11 @@ $(BINDIR)/java/%.class: %.java $(BINDIR)/java/$(PACKAGE_NAME)/terminal.class |
| 94 | 94 | @mkdir -p `dirname $@` |
| 95 | 95 | @$(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d $(BINDIR)/java $< |
| 96 | 96 | |
| 97 | +$(BINDIR)/java/%.class: sample/%.java $(BINDIR)/java/$(PACKAGE_NAME)/terminal.class | |
| 98 | + @echo $< ... | |
| 99 | + @mkdir -p `dirname $@` | |
| 100 | + $(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d $(BINDIR)/java $< | |
| 101 | + | |
| 97 | 102 | $(BINDIR)/java/$(PACKAGE_NAME)/%.class: %.java |
| 98 | 103 | @echo $< ... |
| 99 | 104 | @mkdir -p `dirname $@` | ... | ... |
src/java/main.cc
| ... | ... | @@ -100,3 +100,19 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_deinit(JNIEnv *env, jobject obj) { |
| 100 | 100 | |
| 101 | 101 | return 0; |
| 102 | 102 | } |
| 103 | + | |
| 104 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_wait_1for_1ready(JNIEnv *env, jobject obj, jint seconds) { | |
| 105 | + | |
| 106 | + try { | |
| 107 | + | |
| 108 | + return getHandle(env,obj)->wait_for_ready((int) seconds); | |
| 109 | + | |
| 110 | + } catch(std::exception &e) { | |
| 111 | + | |
| 112 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | |
| 113 | + | |
| 114 | + } | |
| 115 | + | |
| 116 | + return 0; | |
| 117 | + | |
| 118 | +} | ... | ... |
src/java/terminal.java
| ... | ... | @@ -40,6 +40,16 @@ public class terminal |
| 40 | 40 | private native int deinit(); |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | + * Wait for terminal negociation. | |
| 44 | + * <p> | |
| 45 | + * Wait on a loop until the terminal contents are | |
| 46 | + * ready for reading. | |
| 47 | + * | |
| 48 | + * @param seconds Maximum time (in seconds) to wait for. | |
| 49 | + */ | |
| 50 | + public native int wait_for_ready(int seconds); | |
| 51 | + | |
| 52 | + /** | |
| 43 | 53 | * Get the current lib3270 version. |
| 44 | 54 | * |
| 45 | 55 | * @return String with the current lib3270 version. |
| ... | ... | @@ -108,7 +118,28 @@ public class terminal |
| 108 | 118 | public native int print(); |
| 109 | 119 | |
| 110 | 120 | // Connect/Disconnect |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Connect to 3270 host. | |
| 124 | + * <p> | |
| 125 | + * Connect to the 3270 host | |
| 126 | + * <p> | |
| 127 | + * URI formats: | |
| 128 | + * <ul> | |
| 129 | + * <li>tn3270://[HOSTNAME]:[HOSTPORT] for non SSL connections.</li> | |
| 130 | + * <li>tn3270s://[HOSTNAME]:[HOSTPORT] for ssl connection.</li> | |
| 131 | + * </ul> | |
| 132 | + * | |
| 133 | + * @param host Host URI. | |
| 134 | + * @param seconds How many seconds to wait for a connection. | |
| 135 | + * | |
| 136 | + */ | |
| 111 | 137 | public native int connect(String host, int seconds); |
| 138 | + | |
| 139 | + /** | |
| 140 | + * Disconnect from host. | |
| 141 | + * | |
| 142 | + */ | |
| 112 | 143 | public native int disconnect(); |
| 113 | 144 | |
| 114 | 145 | /** | ... | ... |