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:
Noel Eck
2018-01-23 11:58:12 -08:00
parent d49ab2ac95
commit 666452e873
44 changed files with 280 additions and 509 deletions

View File

@ -26,6 +26,7 @@
#include <iostream>
#include <stdexcept>
#include <string.h>
#include <vector>
#include "lsm9ds0.hpp"
@ -621,28 +622,26 @@ void LSM9DS0::getMagnetometer(float *x, float *y, float *z)
*z = (m_magZ * m_magScale) / 1000.0;
}
#ifdef JAVACALLBACK
float *LSM9DS0::getAccelerometer()
std::vector<float> LSM9DS0::getAccelerometer()
{
float *v = new float[3];
std::vector<float> v(3);
getAccelerometer(&v[0], &v[1], &v[2]);
return v;
}
float *LSM9DS0::getGyroscope()
std::vector<float> LSM9DS0::getGyroscope()
{
float *v = new float[3];
std::vector<float> v(3);
getGyroscope(&v[0], &v[1], &v[2]);
return v;
}
float *LSM9DS0::getMagnetometer()
std::vector<float> LSM9DS0::getMagnetometer()
{
float *v = new float[3];
std::vector<float> v(3);
getMagnetometer(&v[0], &v[1], &v[2]);
return v;
}
#endif
float LSM9DS0::getTemperature()
{

View File

@ -24,6 +24,7 @@
#pragma once
#include <string>
#include <vector>
#include <mraa/common.hpp>
#include <mraa/i2c.hpp>
@ -1266,28 +1267,26 @@ namespace upm {
*/
void getMagnetometer(float *x, float *y, float *z);
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
/**
* get the accelerometer values in gravities
*
* @return Array containing X, Y, Z acceleration values
* @return std::vector containing X, Y, Z acceleration values
*/
float *getAccelerometer();
std::vector<float> getAccelerometer();
/**
* get the gyroscope values in degrees per second
*
* @return Array containing X, Y, Z gyroscope values
* @return std::vector containing X, Y, Z gyroscope values
*/
float *getGyroscope();
std::vector<float> getGyroscope();
/**
* get the magnetometer values in gauss
*
* @return Array containing X, Y, Z magnetometer values
* @return std::vector containing X, Y, Z magnetometer values
*/
float *getMagnetometer();
#endif
std::vector<float> getMagnetometer();
/**
* get the temperature value. Unfortunately the datasheet does