mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
Added bindings for iLight sensors.
Removed old interfaces C++ examples. Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
parent
555a0f9f82
commit
e489f6c180
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Author: Henry Bruce <henry.bruce@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "bme280.hpp"
|
||||
#include "iHumiditySensor.hpp"
|
||||
#include "mraa/common.h"
|
||||
#include "si7005.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
#define EDISON_I2C_BUS 1
|
||||
#define FT4222_I2C_BUS 0
|
||||
|
||||
#define EDISON_GPIO_SI7005_CS 20
|
||||
|
||||
//! [Interesting]
|
||||
// Simple example of using ILightSensor to determine
|
||||
// which sensor is present and return its name.
|
||||
// ILightSensor is then used to get readings from sensor
|
||||
|
||||
upm::IHumiditySensor*
|
||||
getHumiditySensor()
|
||||
{
|
||||
upm::IHumiditySensor* humiditySensor = NULL;
|
||||
|
||||
try {
|
||||
humiditySensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
||||
return humiditySensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "BME280: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
humiditySensor = new upm::SI7005(EDISON_I2C_BUS, EDISON_GPIO_SI7005_CS);
|
||||
return humiditySensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "SI7005: " << e.what() << std::endl;
|
||||
}
|
||||
return humiditySensor;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
upm::IHumiditySensor* humiditySensor = getHumiditySensor();
|
||||
if (humiditySensor == NULL) {
|
||||
std::cout << "Humidity sensor not detected" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Humidity sensor " << humiditySensor->getModuleName() << " detected" << std::endl;
|
||||
while (true) {
|
||||
try {
|
||||
int value = humiditySensor->getHumidityRelative();
|
||||
std::cout << "Humidity = " << value << "%" << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
upm_delay(1);
|
||||
}
|
||||
delete humiditySensor;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! [Interesting]
|
@ -1,98 +0,0 @@
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
#include "ds1808lc.hpp"
|
||||
#include "hlg150h.hpp"
|
||||
#include "iLightController.hpp"
|
||||
#include "lp8860.hpp"
|
||||
|
||||
#define EDISON_I2C_BUS 1 // Edison I2C-1
|
||||
#define GPIO_SI7005_CS 20 // Edison GP12
|
||||
#define HLG150H_GPIO_RELAY 21
|
||||
#define HLG150H_GPIO_PWM 22
|
||||
#define LP8860_GPIO_PWR 45 // Edison GP45
|
||||
#define DS1808_GPIO_PWR 15 // Edison GP165
|
||||
#define DS1808_GPIO_EDISON_LIVE 36 // Edison GP14
|
||||
|
||||
//! [Interesting]
|
||||
// Simple example of using ILightController to determine
|
||||
// which controller is present and return its name.
|
||||
// ILightController is then used to get readings from sensor
|
||||
|
||||
upm::ILightController*
|
||||
getLightController()
|
||||
{
|
||||
upm::ILightController* lightController = NULL;
|
||||
try {
|
||||
lightController = new upm::LP8860(LP8860_GPIO_PWR, EDISON_I2C_BUS);
|
||||
return lightController;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "LP8860: " << e.what() << std::endl;
|
||||
}
|
||||
try {
|
||||
lightController = new upm::DS1808LC(DS1808_GPIO_PWR, EDISON_I2C_BUS);
|
||||
return lightController;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "DS1808LC: " << e.what() << std::endl;
|
||||
}
|
||||
try {
|
||||
lightController = new upm::HLG150H(HLG150H_GPIO_RELAY, HLG150H_GPIO_PWM);
|
||||
return lightController;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "HLG150H: " << e.what() << std::endl;
|
||||
}
|
||||
return lightController;
|
||||
}
|
||||
|
||||
void
|
||||
printState(upm::ILightController* lightController)
|
||||
{
|
||||
if (lightController->isPowered()) {
|
||||
std::cout << "Light is powered, brightness = " << lightController->getBrightness()
|
||||
<< std::endl;
|
||||
} else {
|
||||
std::cout << "Light is not powered." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int status = 0;
|
||||
// MraaUtils::setGpio(GPIO_SI7005_CS, 1);
|
||||
|
||||
upm::ILightController* lightController = getLightController();
|
||||
if (lightController != NULL) {
|
||||
std::cout << "Detected light controller " << lightController->getModuleName() << std::endl;
|
||||
} else {
|
||||
std::cerr << "Error. Unsupported platform." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
std::cout << "Existing state: ";
|
||||
printState(lightController);
|
||||
if (argc == 2) {
|
||||
std::string arg = argv[1];
|
||||
int brightness = ::atoi(argv[1]);
|
||||
if (brightness > 0) {
|
||||
lightController->setPowerOn();
|
||||
lightController->setBrightness(brightness);
|
||||
} else
|
||||
lightController->setPowerOff();
|
||||
}
|
||||
std::cout << "Now: ";
|
||||
printState(lightController);
|
||||
} catch (std::exception& e) {
|
||||
std::cout << "Error: " << e.what() << std::endl;
|
||||
status = 1;
|
||||
}
|
||||
|
||||
delete lightController;
|
||||
return status;
|
||||
}
|
||||
|
||||
//! [Interesting]
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Author: Henry Bruce <henry.bruce@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "iLightSensor.hpp"
|
||||
#include "max44009.hpp"
|
||||
#include "mraa/common.h"
|
||||
#include "si1132.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
#define EDISON_I2C_BUS 1
|
||||
#define FT4222_I2C_BUS 0
|
||||
|
||||
//! [Interesting]
|
||||
// Simple example of using ILightSensor to determine
|
||||
// which sensor is present and return its name.
|
||||
// ILightSensor is then used to get readings from sensor
|
||||
|
||||
upm::ILightSensor*
|
||||
getLightSensor()
|
||||
{
|
||||
upm::ILightSensor* lightSensor = NULL;
|
||||
try {
|
||||
lightSensor = new upm::SI1132(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
||||
return lightSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "SI1132: " << e.what() << std::endl;
|
||||
}
|
||||
try {
|
||||
lightSensor = new upm::MAX44009(EDISON_I2C_BUS);
|
||||
return lightSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "MAX44009: " << e.what() << std::endl;
|
||||
}
|
||||
return lightSensor;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
/*upm::ILightSensor* lightSensor = getLightSensor();
|
||||
if (lightSensor == NULL) {
|
||||
std::cout << "Light sensor not detected" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Light sensor " << lightSensor->getModuleName() << " detected" << std::endl;
|
||||
while (true) {
|
||||
try {
|
||||
float value = lightSensor->getVisibleLux();
|
||||
std::cout << "Light level = " << value << " lux" << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
upm_delay(1);
|
||||
}
|
||||
delete lightSensor;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! [Interesting]
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Author: Henry Bruce <henry.bruce@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "bme280.hpp"
|
||||
#include "bmpx8x.hpp"
|
||||
#include "iPressureSensor.hpp"
|
||||
#include "mraa/common.h"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
#define EDISON_I2C_BUS 1
|
||||
#define FT4222_I2C_BUS 0
|
||||
|
||||
//! [Interesting]
|
||||
// Simple example of using ILightSensor to determine
|
||||
// which sensor is present and return its name.
|
||||
// ILightSensor is then used to get readings from sensor
|
||||
|
||||
upm::IPressureSensor*
|
||||
getPressureSensor()
|
||||
{
|
||||
upm::IPressureSensor* pressureSensor = NULL;
|
||||
try {
|
||||
pressureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
||||
return pressureSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "BME280: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
pressureSensor = new upm::BMPX8X(EDISON_I2C_BUS);
|
||||
return pressureSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "BMPX8X: " << e.what() << std::endl;
|
||||
}
|
||||
return pressureSensor;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
upm::IPressureSensor* pressureSensor = getPressureSensor();
|
||||
if (pressureSensor == NULL) {
|
||||
std::cout << "Pressure sensor not detected" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Pressure sensor " << pressureSensor->getModuleName() << " detected" << std::endl;
|
||||
while (true) {
|
||||
try {
|
||||
int value = pressureSensor->getPressurePa();
|
||||
std::cout << "Pressure = " << value << " Pa" << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
upm_delay(1);
|
||||
}
|
||||
delete pressureSensor;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! [Interesting]
|
@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Author: Henry Bruce <henry.bruce@intel.com>
|
||||
* Copyright (c) 2015 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "bme280.hpp"
|
||||
#include "bmpx8x.hpp"
|
||||
#include "iTemperatureSensor.hpp"
|
||||
#include "mraa/common.h"
|
||||
#include "si7005.hpp"
|
||||
#include "upm_utilities.h"
|
||||
|
||||
#define EDISON_I2C_BUS 1
|
||||
#define FT4222_I2C_BUS 0
|
||||
|
||||
#define EDISON_GPIO_SI7005_CS 20
|
||||
|
||||
//! [Interesting]
|
||||
// Simple example of using ITemperatureSensor to determine
|
||||
// which sensor is present and return its name.
|
||||
// ITemperatureSensor is then used to get readings from sensor
|
||||
|
||||
upm::ITemperatureSensor*
|
||||
getTemperatureSensor()
|
||||
{
|
||||
upm::ITemperatureSensor* temperatureSensor = NULL;
|
||||
|
||||
try {
|
||||
temperatureSensor = new upm::BME280(mraa_get_sub_platform_id(FT4222_I2C_BUS));
|
||||
return temperatureSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "BME280: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
temperatureSensor = new upm::SI7005(EDISON_I2C_BUS, EDISON_GPIO_SI7005_CS);
|
||||
return temperatureSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "SI7005: " << e.what() << std::endl;
|
||||
}
|
||||
try {
|
||||
temperatureSensor = new upm::BMPX8X(EDISON_I2C_BUS);
|
||||
return temperatureSensor;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "BMPX8X: " << e.what() << std::endl;
|
||||
}
|
||||
return temperatureSensor;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
upm::ITemperatureSensor* temperatureSensor = getTemperatureSensor();
|
||||
if (temperatureSensor == NULL) {
|
||||
std::cout << "Temperature sensor not detected" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Temperature sensor " << temperatureSensor->getModuleName() << " detected"
|
||||
<< std::endl;
|
||||
while (true) {
|
||||
try {
|
||||
int value = temperatureSensor->getTemperatureCelsius();
|
||||
std::cout << "Temperature = " << value << "C" << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
upm_delay(1);
|
||||
}
|
||||
delete temperatureSensor;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! [Interesting]
|
30
examples/java/iLight_Example.java
Normal file
30
examples/java/iLight_Example.java
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Author: Serban Waltter <serban.waltter@rinftech.com>
|
||||
*/
|
||||
|
||||
import upm_new_interfaces.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import upm_apds9002.*;
|
||||
import upm_bh1750.*;
|
||||
import upm_max44009.*;
|
||||
|
||||
/**
|
||||
* iLight_Example
|
||||
*/
|
||||
public class iLight_Example {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ArrayList<iLight> sensors = new ArrayList<iLight>();
|
||||
sensors.add(new APDS9002(0));
|
||||
sensors.add(new BH1750());
|
||||
sensors.add(new MAX44009(1));
|
||||
|
||||
while (true) {
|
||||
for (int i = 0; i < sensors.size(); i++) {
|
||||
System.out.println("Luminance from sensor " + i + " is " + sensors.get(i).getLuminance());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module pyupm_new_interfaces
|
||||
%module (package="upm") pyupm_new_interfaces
|
||||
#else
|
||||
%module new_interfaces
|
||||
#endif
|
||||
|
@ -254,9 +254,15 @@ function (_get_current_dot_i_file filePrefix varDotIFile)
|
||||
# And the SWIG import string
|
||||
string(REPLACE "#" "%" SWIG_PERCENT_INCLUDES "${SWIG_HASH_INCLUDES}")
|
||||
if(module_iface)
|
||||
foreach(_iface ${module_iface})
|
||||
set(SWIG_PERCENT_INCLUDES "%import \"interfaces/${_iface}\"")
|
||||
endforeach(_iface ${module_iface})
|
||||
# Set up Python bindings
|
||||
set(PYTHON_NEW_INTERFACES "#ifdef SWIGPYTHON\n")
|
||||
string(APPEND PYTHON_NEW_INTERFACES "%module (package=\"pyupm_new_interfaces\") ${libname}\n")
|
||||
string(APPEND PYTHON_NEW_INTERFACES "#endif")
|
||||
# Include interfaces
|
||||
set(IMPORT_NEW_INTERFACES "%import \"interfaces/new_interfaces.i\"")
|
||||
# Set up Java bindings
|
||||
string(APPEND JAVA_TYPEMAPS "%typemap(javaimports) SWIGTYPE %{\n")
|
||||
string(APPEND JAVA_TYPEMAPS "import upm_new_interfaces.*;\n%}")
|
||||
endif()
|
||||
# Write the interface file
|
||||
configure_file (${PROJECT_SOURCE_DIR}/src/swigme.i.in "${${varDotIFile}}" @ONLY)
|
||||
@ -419,6 +425,11 @@ function(upm_swig_node)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
${DEPEND_DIRS})
|
||||
|
||||
# Include interface directory
|
||||
if (module_iface)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
# Decide between ${libname}.i or a language-specific .i
|
||||
_get_current_dot_i_file(jsupm SWIG_CURRENT_DOT_I_FILE)
|
||||
# If this module is using ${libname}.i, provide a module name for UseSWIG AND SWIG_FLAGS
|
||||
@ -439,6 +450,12 @@ function(upm_swig_node)
|
||||
else ()
|
||||
swig_add_library (jsupm_${libname} LANGUAGE javascript SOURCES ${SWIG_CURRENT_DOT_I_FILE})
|
||||
endif ()
|
||||
|
||||
# Add interfaces if necessary
|
||||
if(module_iface)
|
||||
add_dependencies(jsupm_${libname} jsupm_new_interfaces)
|
||||
endif()
|
||||
|
||||
add_dependencies(jsupm_${libname} ${libname})
|
||||
swig_link_libraries (jsupm_${libname} ${NODE_LIBRARIES} ${libname})
|
||||
target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
|
||||
@ -533,6 +550,7 @@ function(upm_swig_java)
|
||||
endif ()
|
||||
if(module_iface)
|
||||
add_dependencies(javaupm_${libname} javaupm_new_interfaces)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
set (NEW_INTERFACES_JAR_FILE ${CMAKE_BINARY_DIR}/interfaces/upm_new_interfaces.jar)
|
||||
endif()
|
||||
# For linker to report unresolved symbols. Note, there is currently no test
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") a110x
|
||||
%module (package="upm") a110x
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -2,4 +2,5 @@ set (libname "apds9002")
|
||||
set (libdescription "Ambient Light Photo Sensor")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_hpp ${libname}.hpp)
|
||||
set (module_iface iLight.hpp)
|
||||
upm_module_init(mraa)
|
||||
|
@ -4,6 +4,7 @@ upm_mixed_module_init (NAME bh1750
|
||||
C_SRC bh1750.c
|
||||
CPP_HDR bh1750.hpp
|
||||
CPP_SRC bh1750.cxx
|
||||
IFACE_HDR iLight.hpp
|
||||
FTI_SRC bh1750_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_new_interfaces.*;
|
||||
%}
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_bh1750)
|
||||
#endif
|
||||
/* END Java syntax */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") bmp280
|
||||
%module (package="upm") bmp280
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") ehr
|
||||
%module (package="upm") ehr
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -2,4 +2,5 @@ set (libname "grove")
|
||||
set (libdescription "Grove Starter Kit Sensor Library")
|
||||
set (module_src grovebutton.cxx groveled.cxx grovelight.cxx groverelay.cxx groverotary.cxx groveslide.cxx grovetemp.cxx)
|
||||
set (module_hpp grovebutton.hpp groveled.hpp grovelight.hpp groverelay.hpp groverotary.hpp groveslide.hpp grovetemp.hpp grovebase.hpp grove.hpp)
|
||||
set (module_iface iLight.hpp)
|
||||
upm_module_init(mraa)
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_new_interfaces.*;
|
||||
%}
|
||||
|
||||
%apply int {mraa::Edge}
|
||||
|
||||
JAVA_ADD_INSTALLISR_EDGE(upm::GroveButton)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") ehr
|
||||
%module (package="upm") ehr
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") hcsr04
|
||||
%module (package="upm") hcsr04
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") htu21d
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") hwxpxx
|
||||
%module (package="upm") hwxpxx
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -4,6 +4,7 @@ upm_mixed_module_init (NAME ims
|
||||
C_SRC ims.c
|
||||
CPP_HDR ims.hpp
|
||||
CPP_SRC ims.cxx
|
||||
IFACE_HDR iLight.hpp iTemperature.hpp
|
||||
FTI_SRC ims_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_new_interfaces.*;
|
||||
%}
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_ims)
|
||||
#endif
|
||||
/* END Java syntax */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") lidarlitev3
|
||||
%module (package="upm") lidarlitev3
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -4,6 +4,7 @@ upm_mixed_module_init (NAME light
|
||||
C_SRC light.c
|
||||
CPP_HDR light.hpp
|
||||
CPP_SRC light.cxx
|
||||
IFACE_HDR iLight.hpp
|
||||
FTI_SRC light_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa m)
|
||||
|
@ -2,4 +2,5 @@ set (libname "max44009")
|
||||
set (libdescription "I2C Low-power Digital Ambient Light Sensor")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_hpp ${libname}.hpp)
|
||||
set (module_iface iLight.hpp)
|
||||
upm_module_init(mraa interfaces)
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_new_interfaces.*;
|
||||
%}
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_max44009)
|
||||
#endif
|
||||
/* END Java syntax */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") mb704x
|
||||
%module (package="upm") mb704x
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") rhusb
|
||||
%module (package="upm") rhusb
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") sht1x
|
||||
%module (package="upm") sht1x
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -2,4 +2,5 @@ set (libname "si1132")
|
||||
set (libdescription "UV and Ambient Light Sensor")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_hpp ${libname}.hpp)
|
||||
set (module_iface iLight.hpp)
|
||||
upm_module_init(mraa interfaces)
|
||||
|
@ -1,14 +1,21 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_new_interfaces.*;
|
||||
%}
|
||||
|
||||
#ifndef ANDROID
|
||||
%module(directors="1") javaupm_si1132
|
||||
#endif
|
||||
|
||||
%typemap(javaimports) SWIGTYPE %{import upm_interfaces.*;%}
|
||||
%import "../interfaces/javaupm_iLightSensor.i"
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_si1132)
|
||||
#endif
|
||||
/* END Java syntax */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") htu21d
|
||||
%module (package="upm") htu21d
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
@ -4,6 +4,7 @@ upm_mixed_module_init (NAME tsl2561
|
||||
C_SRC tsl2561.c
|
||||
CPP_HDR tsl2561.hpp
|
||||
CPP_SRC tsl2561.cxx
|
||||
IFACE_HDR iLight.hpp
|
||||
FTI_SRC tsl2561_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="pyupm_new_interfaces") urm37
|
||||
%module (package="upm") urm37
|
||||
#endif
|
||||
|
||||
%import "interfaces/new_interfaces.i"
|
||||
|
Loading…
x
Reference in New Issue
Block a user