From 1f82757c64bc4c4f553d5197163e18e6d4046b6e Mon Sep 17 00:00:00 2001 From: Petre Eftime Date: Mon, 31 Aug 2015 18:50:38 +0300 Subject: [PATCH] java: convert (char *buffer, size_t len) to byte[] for ublox6 Signed-off-by: Petre Eftime Signed-off-by: Mihai Tudor Panu --- src/ublox6/javaupm_ublox6.i | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ublox6/javaupm_ublox6.i b/src/ublox6/javaupm_ublox6.i index 9a93422f..965bf7c2 100644 --- a/src/ublox6/javaupm_ublox6.i +++ b/src/ublox6/javaupm_ublox6.i @@ -1,7 +1,5 @@ %module javaupm_ublox6 %include "../upm.i" -%include "stdint.i" -%include "carrays.i" %{ #include "ublox6.h" @@ -12,19 +10,16 @@ %typemap(jtype) (char *buffer, size_t len) "byte[]"; %typemap(jstype) (char *buffer, size_t len) "byte[]"; +%typemap(javain) (char *buffer, size_t len) "$javainput"; + %typemap(in) (char *buffer, size_t len) { $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, NULL); $2 = JCALL1(GetArrayLength, jenv, $input); } -%typemap(freearg) readData(char *buffer, size_t len) { - JCALL2(ReleaseByteArrayElements, jenv, $input, JNI_ABORT); -} - -%typemap(freearg) writeData(char *buffer, size_t len) { - JCALL2(ReleaseByteArrayElements, jenv, $input, 0); +%typemap(freearg) (char *buffer, size_t len) { + JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0); } %include "ublox6.h" speed_t int_B9600 = B9600; -%array_class(char, charArray);