Added bindings for iLight sensors.

Removed old interfaces C++ examples.

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Serban Waltter
2018-06-21 16:44:23 +03:00
committed by Mihai Tudor Panu
parent c3d5d951e1
commit 2405f933de
34 changed files with 123 additions and 471 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") a110x
%module (package="upm") a110x
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -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)

View File

@ -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 */

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") bmp280
%module (package="upm") bmp280
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") ehr
%module (package="upm") ehr
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -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)

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") ehr
%module (package="upm") ehr
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") hcsr04
%module (package="upm") hcsr04
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") htu21d
%module (package="upm") htu21d
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") hwxpxx
%module (package="upm") hwxpxx
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -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 */

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") lidarlitev3
%module (package="upm") lidarlitev3
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -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)

View File

@ -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 */

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") mb704x
%module (package="upm") mb704x
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") rhusb
%module (package="upm") rhusb
#endif
%import "interfaces/new_interfaces.i"

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") sht1x
%module (package="upm") sht1x
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -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 */

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") htu21d
%module (package="upm") htu21d
#endif
%import "interfaces/new_interfaces.i"

View File

@ -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)

View File

@ -1,5 +1,5 @@
#ifdef SWIGPYTHON
%module (package="pyupm_new_interfaces") urm37
%module (package="upm") urm37
#endif
%import "interfaces/new_interfaces.i"