blob: 185e7e5f10340c1960640287f8d851bac2ab0a56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
%module javaupm_m24lr64e
%include "../upm.i"
%include "stdint.i"
%include "arrays_java.i";
%include "../java_buffer.i"
%typemap(jni) uint8_t * "jbyteArray"
%typemap(jtype) uint8_t * "byte[]"
%typemap(jstype) uint8_t * "byte[]"
%typemap(javaout) uint8_t * {
return $jnicall;
}
%typemap(out) uint8_t *{
int length = upm::M24LR64E::UID_LENGTH;
$result = JCALL1(NewByteArray, jenv, length);
JCALL4(SetByteArrayRegion, jenv, $result, 0, length, reinterpret_cast<signed char *>($1));
delete [] $1;
}
%{
#include "m24lr64e.h"
%}
%include "m24lr64e.h"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_m24lr64e");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}
|