mirror of
https://github.com/eclipse/upm.git
synced 2025-07-05 11:21:12 +03:00
SWIGJAVA: Remove the last JAVA ifdefs from src
Removed all references to #ifdef SWIGJAVA and JAVACALLBACK from the library source. All java-specific source code has been moved to the corresponding library's .i file for java. * Update library source * Update examples where necessary * The function pointer methodology has been remove from libraries which provided callbacks as both a class and a function pointer implementation. Examples were updated to use the class version of callbacks. * Updated documentation for SWIGJAVA Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -3,40 +3,22 @@
|
||||
%include "typemaps.i"
|
||||
%include "arrays_java.i"
|
||||
%include "../java_buffer.i"
|
||||
%include "std_vector.i"
|
||||
|
||||
%template(FloatVector) std::vector<float>;
|
||||
|
||||
%apply int {mraa::Edge};
|
||||
|
||||
%{
|
||||
#include "mpu60x0.hpp"
|
||||
#include "mpu9150.hpp"
|
||||
#include "mpu60x0.hpp"
|
||||
#include "mpu9150.hpp"
|
||||
%}
|
||||
|
||||
|
||||
%typemap(jni) float * "jfloatArray"
|
||||
%typemap(jstype) float * "float[]"
|
||||
%typemap(jtype) float * "float[]"
|
||||
|
||||
%typemap(javaout) float * {
|
||||
return $jnicall;
|
||||
}
|
||||
|
||||
%typemap(out) float * {
|
||||
$result = JCALL1(NewFloatArray, jenv, 3);
|
||||
JCALL4(SetFloatArrayRegion, jenv, $result, 0, 3, $1);
|
||||
delete [] $1;
|
||||
}
|
||||
|
||||
%ignore getAccelerometer(float *, float *, float *);
|
||||
%ignore getGyroscope(float *, float *, float *);
|
||||
%ignore getMagnetometer(float *, float *, float *);
|
||||
|
||||
%include "mpu60x0.hpp"
|
||||
%include "mpu9150.hpp"
|
||||
|
||||
%ignore installISR(int , mraa::Edge , void *, void *);
|
||||
|
||||
%define GETTER get_gpioIRQ()
|
||||
%enddef
|
||||
|
||||
JAVA_ADD_INSTALLISR_GPIO(upm::MPU60X0)
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_mpu9150)
|
||||
|
@ -109,11 +109,9 @@ void MPU9150::getMagnetometer(float *x, float *y, float *z)
|
||||
*z = mz;
|
||||
}
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
float *MPU9150::getMagnetometer()
|
||||
std::vector<float> MPU9150::getMagnetometer()
|
||||
{
|
||||
float *v = new float[3];
|
||||
std::vector<float> v(3);
|
||||
getMagnetometer(&v[0], &v[1], &v[2]);
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "mpu60x0.hpp"
|
||||
#include "ak8975.hpp"
|
||||
@ -108,17 +109,13 @@ namespace upm {
|
||||
*/
|
||||
void getMagnetometer(float *x, float *y, float *z);
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
/**
|
||||
* Return the compensated values for the x, y, and z axes. The
|
||||
* unit of measurement is in micro-teslas (uT).
|
||||
*
|
||||
* @return Array containing X, Y, Z magnetometer values
|
||||
* @return std::vector containing X, Y, Z magnetometer values
|
||||
*/
|
||||
float *getMagnetometer();
|
||||
#endif
|
||||
|
||||
|
||||
std::vector<float> getMagnetometer();
|
||||
|
||||
protected:
|
||||
// magnetometer instance
|
||||
|
Reference in New Issue
Block a user