Przeglądaj źródła

java: Added "automatic load library" code for new sensors

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
Stefan Andritoiu 9 lat temu
rodzic
commit
1667569560

+ 11
- 0
src/groveultrasonic/javaupm_groveultrasonic.i Wyświetl plik

@@ -8,3 +8,14 @@
8 8
 %}
9 9
 
10 10
 %include "groveultrasonic.h"
11
+
12
+%pragma(java) jniclasscode=%{
13
+    static {
14
+        try {
15
+            System.loadLibrary("javaupm_groveultrasonic");
16
+        } catch (UnsatisfiedLinkError e) {
17
+            System.err.println("Native code library failed to load. \n" + e);
18
+            System.exit(1);
19
+        }
20
+    }
21
+%}

+ 11
- 0
src/ozw/javaupm_ozw.i Wyświetl plik

@@ -10,3 +10,14 @@
10 10
 %}
11 11
 
12 12
 %include "ozw.h"
13
+
14
+%pragma(java) jniclasscode=%{
15
+    static {
16
+        try {
17
+            System.loadLibrary("javaupm_ozw");
18
+        } catch (UnsatisfiedLinkError e) {
19
+            System.err.println("Native code library failed to load. \n" + e);
20
+            System.exit(1);
21
+        }
22
+    }
23
+%}

+ 11
- 0
src/sx1276/javaupm_sx1276.i Wyświetl plik

@@ -13,3 +13,14 @@
13 13
 %ignore getRxBuffer();
14 14
 
15 15
 %include "sx1276.h"
16
+
17
+%pragma(java) jniclasscode=%{
18
+    static {
19
+        try {
20
+            System.loadLibrary("javaupm_sx1276");
21
+        } catch (UnsatisfiedLinkError e) {
22
+            System.err.println("Native code library failed to load. \n" + e);
23
+            System.exit(1);
24
+        }
25
+    }
26
+%}