diff --git a/src/mma7455/javaupm_mma7455.i b/src/mma7455/javaupm_mma7455.i index 1f57ef47..160b88f6 100644 --- a/src/mma7455/javaupm_mma7455.i +++ b/src/mma7455/javaupm_mma7455.i @@ -3,7 +3,6 @@ %include "typemaps.i" %include "arrays_java.i"; -%apply unsigned char[] {unsigned char *}; %apply short *OUTPUT { short * ptrX, short * ptrY, short * ptrZ }; %{ @@ -26,4 +25,19 @@ %ignore readData(short *, short *, short *); +%typemap(jni) (unsigned char *buf, unsigned char size) "jbyteArray"; +%typemap(jtype) (unsigned char *buf, unsigned char size) "byte[]"; +%typemap(jstype) (unsigned char *buf, unsigned char size) "byte[]"; + +%typemap(javain) (unsigned char *buf, unsigned char size) "$javainput"; + +%typemap(in) (unsigned char *buf, unsigned char size) { + $1 = (unsigned char *) JCALL2(GetByteArrayElements, jenv, $input, NULL); + $2 = JCALL1(GetArrayLength, jenv, $input); +} + +%typemap(freearg) (unsigned char *buf, unsigned char size) { + JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0); +} + %include "mma7455.h"