mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
java: map C buffer pointer and length to Java array for Ublox6
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:
parent
42c59e98ab
commit
fb6627083b
@ -1,9 +1,9 @@
|
||||
%module javaupm_mic
|
||||
%include "../upm.i"
|
||||
%include "stdint.i"
|
||||
%include "typemaps.i"
|
||||
%include "arrays_java.i"
|
||||
|
||||
%apply uint16_t *OUTPUT { uint16_t *buffer };
|
||||
%apply unsigned short[] {uint16_t *buffer};
|
||||
|
||||
%{
|
||||
#include "mic.h"
|
||||
|
@ -8,6 +8,23 @@
|
||||
speed_t int_B9600 = B9600;
|
||||
%}
|
||||
|
||||
%typemap(jni) (char *buffer, size_t len) "jbyteArray";
|
||||
%typemap(jtype) (char *buffer, size_t len) "byte[]";
|
||||
%typemap(jstype) (char *buffer, size_t len) "byte[]";
|
||||
|
||||
%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);
|
||||
}
|
||||
|
||||
%include "ublox6.h"
|
||||
speed_t int_B9600 = B9600;
|
||||
%array_class(char, charArray);
|
||||
|
Loading…
x
Reference in New Issue
Block a user