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,8 +24,15 @@ | ||
24 | # | 24 | # |
25 | 25 | ||
26 | JAVAH=javah | 26 | JAVAH=javah |
27 | +JAVAC=javac | ||
27 | NDKBUILD=/opt/android-ndk-r8/ndk-build | 28 | NDKBUILD=/opt/android-ndk-r8/ndk-build |
28 | CLASSPATH=br/com/bb/pw3270 | 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 | MKDIR=/bin/mkdir -p | 37 | MKDIR=/bin/mkdir -p |
31 | CONVERT=rsvg-convert | 38 | CONVERT=rsvg-convert |
@@ -66,7 +73,11 @@ res/drawable-hdpi/ic_launcher.png: ../src/pw3270/pixmaps/pw3270.svg | @@ -66,7 +73,11 @@ res/drawable-hdpi/ic_launcher.png: ../src/pw3270/pixmaps/pw3270.svg | ||
66 | @$(MKDIR) `dirname $@` | 73 | @$(MKDIR) `dirname $@` |
67 | @$(CONVERT) --format=png --width=72 --height=72 --output=$@ $< | 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 | @javap -classpath ./bin/classes -s -p br.com.bb.pw3270.lib3270 > $@ | 81 | @javap -classpath ./bin/classes -s -p br.com.bb.pw3270.lib3270 > $@ |
71 | 82 | ||
72 | jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class | 83 | jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class |
android/jni/Android.mk
@@ -34,7 +34,7 @@ LOCAL_DEFAULT_CPP_EXTENSION := cpp | @@ -34,7 +34,7 @@ LOCAL_DEFAULT_CPP_EXTENSION := cpp | ||
34 | LOCAL_MODULE := lib3270 | 34 | LOCAL_MODULE := lib3270 |
35 | LOCAL_LDLIBS := -llog | 35 | LOCAL_LDLIBS := -llog |
36 | LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES) $(NETWORK_SOURCES), ../../src/lib3270/$(SRC)) \ | 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 | include $(BUILD_SHARED_LIBRARY) | 39 | include $(BUILD_SHARED_LIBRARY) |
40 | 40 |
android/lib3270NDK.cbp
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | <Add option="-Wall" /> | 33 | <Add option="-Wall" /> |
34 | </Compiler> | 34 | </Compiler> |
35 | <Unit filename="../src/include/lib3270.h" /> | 35 | <Unit filename="../src/include/lib3270.h" /> |
36 | + <Unit filename="../src/include/lib3270/actions.h" /> | ||
36 | <Unit filename="../src/include/lib3270/html.h" /> | 37 | <Unit filename="../src/include/lib3270/html.h" /> |
37 | <Unit filename="../src/include/lib3270/internals.h" /> | 38 | <Unit filename="../src/include/lib3270/internals.h" /> |
38 | <Unit filename="../src/lib3270/html.c"> | 39 | <Unit filename="../src/lib3270/html.c"> |
@@ -41,11 +42,13 @@ | @@ -41,11 +42,13 @@ | ||
41 | <Unit filename="../src/lib3270/selection.c"> | 42 | <Unit filename="../src/lib3270/selection.c"> |
42 | <Option compilerVar="CC" /> | 43 | <Option compilerVar="CC" /> |
43 | </Unit> | 44 | </Unit> |
45 | + <Unit filename="../src/lib3270/sources.mak" /> | ||
44 | <Unit filename="../src/lib3270/telnet.c"> | 46 | <Unit filename="../src/lib3270/telnet.c"> |
45 | <Option compilerVar="CC" /> | 47 | <Option compilerVar="CC" /> |
46 | </Unit> | 48 | </Unit> |
47 | <Unit filename="Makefile" /> | 49 | <Unit filename="Makefile" /> |
48 | <Unit filename="jni/Android.mk" /> | 50 | <Unit filename="jni/Android.mk" /> |
51 | + <Unit filename="jni/actions.cpp" /> | ||
49 | <Unit filename="jni/globals.h" /> | 52 | <Unit filename="jni/globals.h" /> |
50 | <Unit filename="jni/html.cpp" /> | 53 | <Unit filename="jni/html.cpp" /> |
51 | <Unit filename="jni/lib3270jni.h" /> | 54 | <Unit filename="jni/lib3270jni.h" /> |
android/src/br/com/bb/pw3270/lib3270.java
@@ -317,12 +317,12 @@ public class lib3270 | @@ -317,12 +317,12 @@ public class lib3270 | ||
317 | { | 317 | { |
318 | Log.i(TAG,"PF "+id); | 318 | Log.i(TAG,"PF "+id); |
319 | } | 319 | } |
320 | - | 320 | + |
321 | public void xmit() | 321 | public void xmit() |
322 | { | 322 | { |
323 | Log.i(TAG,"XMIT"); | 323 | Log.i(TAG,"XMIT"); |
324 | } | 324 | } |
325 | - | 325 | + |
326 | /*---[ External methods ]------------------------------------------------*/ | 326 | /*---[ External methods ]------------------------------------------------*/ |
327 | 327 | ||
328 | public int connect() | 328 | public int connect() |
@@ -365,6 +365,10 @@ public class lib3270 | @@ -365,6 +365,10 @@ public class lib3270 | ||
365 | public native boolean isConnected(); | 365 | public native boolean isConnected(); |
366 | public native boolean isTerminalReady(); | 366 | public native boolean isTerminalReady(); |
367 | 367 | ||
368 | + // Keyboard actions | ||
369 | + public native void sendEnter(); | ||
370 | + public native void sendPFkey(int id); | ||
371 | + | ||
368 | // Get/Set screen contents | 372 | // Get/Set screen contents |
369 | public native byte[] getHTML(); | 373 | public native byte[] getHTML(); |
370 | public native byte[] getText(); | 374 | public native byte[] getText(); |
src/include/lib3270/actions.h
@@ -30,6 +30,10 @@ | @@ -30,6 +30,10 @@ | ||
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | 32 | ||
33 | +#ifdef __cplusplus | ||
34 | + extern "C" { | ||
35 | +#endif | ||
36 | + | ||
33 | // Standard actions | 37 | // Standard actions |
34 | #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); | 38 | #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); |
35 | #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) | 39 | #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) |
@@ -49,3 +53,6 @@ | @@ -49,3 +53,6 @@ | ||
49 | // Load action table entries | 53 | // Load action table entries |
50 | #include <lib3270/action_table.h> | 54 | #include <lib3270/action_table.h> |
51 | 55 | ||
56 | +#ifdef __cplusplus | ||
57 | + } | ||
58 | +#endif |