瀏覽代碼

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 年之前
父節點
當前提交
1667569560
共有 3 個文件被更改,包括 33 次插入0 次删除
  1. 11
    0
      src/groveultrasonic/javaupm_groveultrasonic.i
  2. 11
    0
      src/ozw/javaupm_ozw.i
  3. 11
    0
      src/sx1276/javaupm_sx1276.i

+ 11
- 0
src/groveultrasonic/javaupm_groveultrasonic.i 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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
+%}