diff --git a/examples/c++/interfaces-humiditysensor.cxx b/examples/c++/interfaces-humiditysensor.cxx deleted file mode 100644 index 52973dc3..00000000 --- a/examples/c++/interfaces-humiditysensor.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Author: Henry Bruce - * 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 -#include -#include - -#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] diff --git a/examples/c++/interfaces-lightcontroller.cxx b/examples/c++/interfaces-lightcontroller.cxx deleted file mode 100644 index cc99a119..00000000 --- a/examples/c++/interfaces-lightcontroller.cxx +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include -#include -#include - -#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] diff --git a/examples/c++/interfaces-lightsensor.cxx b/examples/c++/interfaces-lightsensor.cxx deleted file mode 100644 index b34ffebe..00000000 --- a/examples/c++/interfaces-lightsensor.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Author: Henry Bruce - * 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 -#include -#include - -#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] diff --git a/examples/c++/interfaces-pressuresensor.cxx b/examples/c++/interfaces-pressuresensor.cxx deleted file mode 100644 index 437011a2..00000000 --- a/examples/c++/interfaces-pressuresensor.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Author: Henry Bruce - * 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 -#include -#include - -#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] diff --git a/examples/c++/interfaces-temperaturesensor.cxx b/examples/c++/interfaces-temperaturesensor.cxx deleted file mode 100644 index 8871166f..00000000 --- a/examples/c++/interfaces-temperaturesensor.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Author: Henry Bruce - * 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 -#include -#include - -#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] diff --git a/examples/java/iLight_Example.java b/examples/java/iLight_Example.java new file mode 100644 index 00000000..c68a5ddb --- /dev/null +++ b/examples/java/iLight_Example.java @@ -0,0 +1,30 @@ +/** + * Author: Serban Waltter + */ + +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 sensors = new ArrayList(); + 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()); + } + } + } +} \ No newline at end of file diff --git a/include/interfaces/new_interfaces.i b/include/interfaces/new_interfaces.i index 85d0e1a3..e53dba8f 100644 --- a/include/interfaces/new_interfaces.i +++ b/include/interfaces/new_interfaces.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module pyupm_new_interfaces +%module (package="upm") pyupm_new_interfaces #else %module new_interfaces #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a7a0bc0..e95d9959 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/a110x/a110x.i b/src/a110x/a110x.i index d3a18b78..18f50c94 100644 --- a/src/a110x/a110x.i +++ b/src/a110x/a110x.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") a110x +%module (package="upm") a110x #endif %import "interfaces/new_interfaces.i" diff --git a/src/apds9002/CMakeLists.txt b/src/apds9002/CMakeLists.txt index ed8ed567..9deab353 100644 --- a/src/apds9002/CMakeLists.txt +++ b/src/apds9002/CMakeLists.txt @@ -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) diff --git a/src/bh1750/CMakeLists.txt b/src/bh1750/CMakeLists.txt index 0ffc6ea3..db7973c2 100644 --- a/src/bh1750/CMakeLists.txt +++ b/src/bh1750/CMakeLists.txt @@ -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) diff --git a/src/bh1750/bh1750.i b/src/bh1750/bh1750.i index e5778e87..b049d9a6 100644 --- a/src/bh1750/bh1750.i +++ b/src/bh1750/bh1750.i @@ -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 */ diff --git a/src/bmp280/bmp280.i b/src/bmp280/bmp280.i index 3ef01f00..68bf5cce 100644 --- a/src/bmp280/bmp280.i +++ b/src/bmp280/bmp280.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") bmp280 +%module (package="upm") bmp280 #endif %import "interfaces/new_interfaces.i" diff --git a/src/ehr/ehr.i b/src/ehr/ehr.i index 73a1293b..757581c6 100644 --- a/src/ehr/ehr.i +++ b/src/ehr/ehr.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") ehr +%module (package="upm") ehr #endif %import "interfaces/new_interfaces.i" diff --git a/src/grove/CMakeLists.txt b/src/grove/CMakeLists.txt index 9fb6b1c6..0d2c5935 100644 --- a/src/grove/CMakeLists.txt +++ b/src/grove/CMakeLists.txt @@ -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) diff --git a/src/grove/grove.i b/src/grove/grove.i index cb9cc590..fe79a254 100644 --- a/src/grove/grove.i +++ b/src/grove/grove.i @@ -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) diff --git a/src/groveehr/groveehr.i b/src/groveehr/groveehr.i index 7d9d4700..67ae986d 100644 --- a/src/groveehr/groveehr.i +++ b/src/groveehr/groveehr.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") ehr +%module (package="upm") ehr #endif %import "interfaces/new_interfaces.i" diff --git a/src/hcsr04/hcsr04.i b/src/hcsr04/hcsr04.i index 6427d205..0088abe0 100644 --- a/src/hcsr04/hcsr04.i +++ b/src/hcsr04/hcsr04.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") hcsr04 +%module (package="upm") hcsr04 #endif %import "interfaces/new_interfaces.i" diff --git a/src/htu21d/htu21d.i b/src/htu21d/htu21d.i index 7fb1d1f4..7a44d998 100644 --- a/src/htu21d/htu21d.i +++ b/src/htu21d/htu21d.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") htu21d +%module (package="upm") htu21d #endif %import "interfaces/new_interfaces.i" diff --git a/src/hwxpxx/hwxpxx.i b/src/hwxpxx/hwxpxx.i index 5ce7d4c5..7ea8fd0c 100644 --- a/src/hwxpxx/hwxpxx.i +++ b/src/hwxpxx/hwxpxx.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") hwxpxx +%module (package="upm") hwxpxx #endif %import "interfaces/new_interfaces.i" diff --git a/src/ims/CMakeLists.txt b/src/ims/CMakeLists.txt index 816b478e..be3aea22 100644 --- a/src/ims/CMakeLists.txt +++ b/src/ims/CMakeLists.txt @@ -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) diff --git a/src/ims/ims.i b/src/ims/ims.i index 2ccc2fa5..023b305b 100644 --- a/src/ims/ims.i +++ b/src/ims/ims.i @@ -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 */ diff --git a/src/lidarlitev3/lidarlitev3.i b/src/lidarlitev3/lidarlitev3.i index a957029a..692cb0d2 100644 --- a/src/lidarlitev3/lidarlitev3.i +++ b/src/lidarlitev3/lidarlitev3.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") lidarlitev3 +%module (package="upm") lidarlitev3 #endif %import "interfaces/new_interfaces.i" diff --git a/src/light/CMakeLists.txt b/src/light/CMakeLists.txt index b7c5c7f2..5883eace 100644 --- a/src/light/CMakeLists.txt +++ b/src/light/CMakeLists.txt @@ -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) diff --git a/src/max44009/CMakeLists.txt b/src/max44009/CMakeLists.txt index 7ab5b1fa..d337298c 100644 --- a/src/max44009/CMakeLists.txt +++ b/src/max44009/CMakeLists.txt @@ -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) diff --git a/src/max44009/max44009.i b/src/max44009/max44009.i index 4aaf94ad..3bc02a7b 100644 --- a/src/max44009/max44009.i +++ b/src/max44009/max44009.i @@ -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 */ diff --git a/src/mb704x/mb704x.i b/src/mb704x/mb704x.i index b31b679e..6c2792be 100644 --- a/src/mb704x/mb704x.i +++ b/src/mb704x/mb704x.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") mb704x +%module (package="upm") mb704x #endif %import "interfaces/new_interfaces.i" diff --git a/src/rhusb/rhusb.i b/src/rhusb/rhusb.i index 48a6930b..620ce9d8 100644 --- a/src/rhusb/rhusb.i +++ b/src/rhusb/rhusb.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") rhusb +%module (package="upm") rhusb #endif %import "interfaces/new_interfaces.i" diff --git a/src/sht1x/sht1x.i b/src/sht1x/sht1x.i index 14cf1705..bbdab458 100644 --- a/src/sht1x/sht1x.i +++ b/src/sht1x/sht1x.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") sht1x +%module (package="upm") sht1x #endif %import "interfaces/new_interfaces.i" diff --git a/src/si1132/CMakeLists.txt b/src/si1132/CMakeLists.txt index bada7ce4..e7a38f11 100644 --- a/src/si1132/CMakeLists.txt +++ b/src/si1132/CMakeLists.txt @@ -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) diff --git a/src/si1132/si1132.i b/src/si1132/si1132.i index 94f0d4b7..6c208598 100644 --- a/src/si1132/si1132.i +++ b/src/si1132/si1132.i @@ -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 */ diff --git a/src/t3311/t3311.i b/src/t3311/t3311.i index 96f9348f..e65baf16 100644 --- a/src/t3311/t3311.i +++ b/src/t3311/t3311.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") htu21d +%module (package="upm") htu21d #endif %import "interfaces/new_interfaces.i" diff --git a/src/tsl2561/CMakeLists.txt b/src/tsl2561/CMakeLists.txt index 9fe0d994..3ef3f471 100644 --- a/src/tsl2561/CMakeLists.txt +++ b/src/tsl2561/CMakeLists.txt @@ -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) diff --git a/src/urm37/urm37.i b/src/urm37/urm37.i index 9b13c3d9..0e4ef196 100644 --- a/src/urm37/urm37.i +++ b/src/urm37/urm37.i @@ -1,5 +1,5 @@ #ifdef SWIGPYTHON -%module (package="pyupm_new_interfaces") urm37 +%module (package="upm") urm37 #endif %import "interfaces/new_interfaces.i"