Browse Source

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 years ago
parent
commit
1667569560
3 changed files with 33 additions and 0 deletions
  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 View File

8
 %}
8
 %}
9
 
9
 
10
 %include "groveultrasonic.h"
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 View File

10
 %}
10
 %}
11
 
11
 
12
 %include "ozw.h"
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 View File

13
 %ignore getRxBuffer();
13
 %ignore getRxBuffer();
14
 
14
 
15
 %include "sx1276.h"
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
+%}