Files
upm/src/lsm303/javaupm_lsm303.i
Stefan Andritoiu dddba3e8a4 java: Added auto load library code in upm SWIG interfaces
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2015-11-24 14:36:17 -08:00

32 lines
689 B
OpenEdge ABL

%module javaupm_lsm303
%include "../upm.i"
%{
#include "lsm303.h"
%}
%typemap(jni) int16_t* "jshortArray"
%typemap(jstype) int16_t* "short[]"
%typemap(jtype) int16_t* "short[]"
%typemap(javaout) int16_t* {
return $jnicall;
}
%typemap(out) int16_t *getRawAccelData {
$result = JCALL1(NewShortArray, jenv, 3);
JCALL4(SetShortArrayRegion, jenv, $result, 0, 3, (jshort*)$1);
}
%include "lsm303.h"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_lsm303");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}