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

@ -77,14 +77,12 @@ void ADXL335::values(int *xVal, int *yVal, int *zVal)
*zVal = mraa_aio_read(m_aioZ);
}
#ifdef SWIGJAVA
int *ADXL335::values()
std::vector<int> ADXL335::values()
{
int *v = new int[3];
std::vector<int> v(3);
values(&v[0], &v[1], &v[2]);
return v;
}
#endif
void ADXL335::acceleration(float *xAccel, float *yAccel, float *zAccel)
{
@ -101,14 +99,12 @@ void ADXL335::acceleration(float *xAccel, float *yAccel, float *zAccel)
*zAccel = (zVolts - m_zeroZ) / ADXL335_SENSITIVITY;
}
#ifdef SWIGJAVA
float *ADXL335::acceleration()
std::vector<float> ADXL335::acceleration()
{
float *v = new float[3];
std::vector<float> v(3);
acceleration(&v[0], &v[1], &v[2]);
return v;
}
#endif
void ADXL335::calibrate()
{

View File

@ -27,6 +27,7 @@
#pragma once
#include <string>
#include <vector>
#include <mraa/aio.h>
#define ADXL335_DEFAULT_AREF 5.0
@ -106,14 +107,12 @@ namespace upm {
*/
void values(int *xVal, int *yVal, int *zVal);
#ifdef SWIGJAVA
/**
* Gets the analog values for the 3 axes
*
* @return Array containing value of X, Y, Z axes
* @return std::vector of x, y, z analog acceleration values
*/
int *values();
#endif
std::vector<int> values();
/**
* Gets the acceleration along all 3 axes
@ -124,14 +123,12 @@ namespace upm {
*/
void acceleration(float *xAccel, float *yAccel, float *zAccel);
#ifdef SWIGJAVA
/**
* Gets the acceleration along all 3 axes
*
* @return Array containing acceleration on X, Y, Z axes
* @return std::vector of x, y, z acceleration values
*/
float *acceleration();
#endif
std::vector<float> acceleration();
/**
* While the sensor is still, measures the X-axis, Y-axis, and Z-axis