Commit d25fb3a6c3ca604d825fbb193e860a9b71f1809e
1 parent
a8141068
Exists in
master
and in
5 other branches
Iniciando implementação das actions de teclado na jni android
Showing
5 changed files
with
29 additions
and
4 deletions
Show diff stats
android/Makefile
... | ... | @@ -24,8 +24,15 @@ |
24 | 24 | # |
25 | 25 | |
26 | 26 | JAVAH=javah |
27 | +JAVAC=javac | |
27 | 28 | NDKBUILD=/opt/android-ndk-r8/ndk-build |
28 | 29 | CLASSPATH=br/com/bb/pw3270 |
30 | +ANDROIDSDK=/opt/android-sdk | |
31 | + | |
32 | +# package android.os does not exist | |
33 | +# javac -d bin/classes | |
34 | + | |
35 | +# /opt/android-sdk/tools/lib/ | |
29 | 36 | |
30 | 37 | MKDIR=/bin/mkdir -p |
31 | 38 | CONVERT=rsvg-convert |
... | ... | @@ -66,7 +73,11 @@ res/drawable-hdpi/ic_launcher.png: ../src/pw3270/pixmaps/pw3270.svg |
66 | 73 | @$(MKDIR) `dirname $@` |
67 | 74 | @$(CONVERT) --format=png --width=72 --height=72 --output=$@ $< |
68 | 75 | |
69 | -sigs.txt: ./bin/classes/br/com/bb/pw3270/lib3270.class | |
76 | +bin/classes/$(CLASSPATH)/lib3270.class: src/$(CLASSPATH)/lib3270.java | |
77 | + @$(MKDIR) `dirname $@` | |
78 | + @$(JAVAC) -classpath $(ANDROIDSDK)/platforms/android-15/android.jar -d bin/classes src/$(CLASSPATH)/lib3270.java | |
79 | + | |
80 | +sigs.txt: bin/classes/$(CLASSPATH)/lib3270.class | |
70 | 81 | @javap -classpath ./bin/classes -s -p br.com.bb.pw3270.lib3270 > $@ |
71 | 82 | |
72 | 83 | jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class | ... | ... |
android/jni/Android.mk
... | ... | @@ -34,7 +34,7 @@ LOCAL_DEFAULT_CPP_EXTENSION := cpp |
34 | 34 | LOCAL_MODULE := lib3270 |
35 | 35 | LOCAL_LDLIBS := -llog |
36 | 36 | LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES) $(NETWORK_SOURCES), ../../src/lib3270/$(SRC)) \ |
37 | - main.cpp misc.cpp html.cpp | |
37 | + main.cpp misc.cpp html.cpp actions.cpp | |
38 | 38 | |
39 | 39 | include $(BUILD_SHARED_LIBRARY) |
40 | 40 | ... | ... |
android/lib3270NDK.cbp
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | <Add option="-Wall" /> |
34 | 34 | </Compiler> |
35 | 35 | <Unit filename="../src/include/lib3270.h" /> |
36 | + <Unit filename="../src/include/lib3270/actions.h" /> | |
36 | 37 | <Unit filename="../src/include/lib3270/html.h" /> |
37 | 38 | <Unit filename="../src/include/lib3270/internals.h" /> |
38 | 39 | <Unit filename="../src/lib3270/html.c"> |
... | ... | @@ -41,11 +42,13 @@ |
41 | 42 | <Unit filename="../src/lib3270/selection.c"> |
42 | 43 | <Option compilerVar="CC" /> |
43 | 44 | </Unit> |
45 | + <Unit filename="../src/lib3270/sources.mak" /> | |
44 | 46 | <Unit filename="../src/lib3270/telnet.c"> |
45 | 47 | <Option compilerVar="CC" /> |
46 | 48 | </Unit> |
47 | 49 | <Unit filename="Makefile" /> |
48 | 50 | <Unit filename="jni/Android.mk" /> |
51 | + <Unit filename="jni/actions.cpp" /> | |
49 | 52 | <Unit filename="jni/globals.h" /> |
50 | 53 | <Unit filename="jni/html.cpp" /> |
51 | 54 | <Unit filename="jni/lib3270jni.h" /> | ... | ... |
android/src/br/com/bb/pw3270/lib3270.java
... | ... | @@ -317,12 +317,12 @@ public class lib3270 |
317 | 317 | { |
318 | 318 | Log.i(TAG,"PF "+id); |
319 | 319 | } |
320 | - | |
320 | + | |
321 | 321 | public void xmit() |
322 | 322 | { |
323 | 323 | Log.i(TAG,"XMIT"); |
324 | 324 | } |
325 | - | |
325 | + | |
326 | 326 | /*---[ External methods ]------------------------------------------------*/ |
327 | 327 | |
328 | 328 | public int connect() |
... | ... | @@ -365,6 +365,10 @@ public class lib3270 |
365 | 365 | public native boolean isConnected(); |
366 | 366 | public native boolean isTerminalReady(); |
367 | 367 | |
368 | + // Keyboard actions | |
369 | + public native void sendEnter(); | |
370 | + public native void sendPFkey(int id); | |
371 | + | |
368 | 372 | // Get/Set screen contents |
369 | 373 | public native byte[] getHTML(); |
370 | 374 | public native byte[] getText(); | ... | ... |
src/include/lib3270/actions.h
... | ... | @@ -30,6 +30,10 @@ |
30 | 30 | * |
31 | 31 | */ |
32 | 32 | |
33 | +#ifdef __cplusplus | |
34 | + extern "C" { | |
35 | +#endif | |
36 | + | |
33 | 37 | // Standard actions |
34 | 38 | #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); |
35 | 39 | #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) |
... | ... | @@ -49,3 +53,6 @@ |
49 | 53 | // Load action table entries |
50 | 54 | #include <lib3270/action_table.h> |
51 | 55 | |
56 | +#ifdef __cplusplus | |
57 | + } | |
58 | +#endif | ... | ... |