java: convert (uint8_t *buffer, int len) to byte[] for nunchuck

Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Petre Eftime 2015-08-31 18:51:18 +03:00 committed by Mihai Tudor Panu
parent 1f82757c64
commit cfe63bf7b6

View File

@ -1,11 +1,23 @@
%module javaupm_nunchuck
%include "../upm.i"
%include "arrays_java.i";
%apply unsigned char[] {uint8_t *};
%{
#include "nunchuck.h"
%}
%typemap(jni) (uint8_t *buffer, int len) "jbyteArray";
%typemap(jtype) (uint8_t *buffer, int len) "byte[]";
%typemap(jstype) (uint8_t *buffer, int len) "byte[]";
%typemap(javain) (uint8_t *buffer, int len) "$javainput";
%typemap(in) (uint8_t *buffer, int len) {
$1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
$2 = JCALL1(GetArrayLength, jenv, $input);
}
%typemap(freearg) (uint8_t *buffer, int len) {
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
}
%include "nunchuck.h"