mraajava.i: Initialize mraa when library is loaded by the JVM
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com> Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c9c6ac785a
commit
35760929db
@@ -46,7 +46,7 @@ namespace mraa {
|
||||
class Spi;
|
||||
%typemap(out) uint8_t*
|
||||
{
|
||||
// need to loop over length
|
||||
/* need to loop over length */
|
||||
$result = JCALL1(NewByteArray, jenv, arg3);
|
||||
JCALL4(SetByteArrayRegion, jenv, $result, 0, arg3, (jbyte *) $1);
|
||||
free($1);
|
||||
@@ -55,3 +55,11 @@ class Spi;
|
||||
|
||||
%feature("director") IsrCallback;
|
||||
%include ../mraa.i
|
||||
|
||||
%wrapper %{
|
||||
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
/* initialize mraa */
|
||||
mraa_init();
|
||||
return JNI_VERSION_1_8;
|
||||
}
|
||||
%}
|
||||
|
||||
Reference in New Issue
Block a user