ANDROID: CMake/src changes to build on android-24

* Updated pom file generation: Generate pom files after all sensor
      library targets have been created - allows for dependencies
    * Changes for compiling on Android
    * Check for mraa build options: Look at symbols in mraa library to
      determine UPM build options (example: mraa_iio_init, mraa_firmata_init)
    * Add per target summary for C/C++/java/nodejs/python
    * Added hierarchy to fti include directory...
        old: #include "upm_voltage.h"
        new: #include "fti/upm_voltage.h"
    * Removed unimplemented methods from mpu9150 library and java example
    * Add utilities-c target for all c examples.  Most of the C examples
      rely on the upm_delay methods.  Add a dependency on the utilities-c
      target for all c examples.
    * Updated the examples/CMakeLists.txt to add dependencies passed via
      TARGETS to the target name parsed from the example name.  Also updated
      the interface example names to start with 'interfaces'.
    * Updated src/examples/CMakeLists.txt to ALWAYS remove examples from the
      example_src_list (moved this from end of function to beginning).

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck 2017-02-07 17:00:29 -08:00
parent b2aa2515b0
commit 0bd68e4e2b
93 changed files with 525 additions and 326 deletions

View File

@ -95,7 +95,7 @@ set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation -Wno-strict-aliasing)
# Warnings as errors?
if (WERROR)
set (C_CXX_WARNING_FLAGS "-Werror ${C_CXX_WARNING_FLAGS}")
list (APPEND C_CXX_WARNING_FLAGS -Werror)
message (STATUS "Warnings as errors enabled (-Werror), disable with -DWERROR=off")
endif (WERROR)
@ -113,6 +113,11 @@ upm_add_compile_flags(CXX ${C_CXX_WARNING_FLAGS}
-Woverloaded-virtual
-Wreorder)
# Allow exception error handling for Android C++
if (ANDROID)
upm_add_compile_flags(CXX -fexceptions)
endif (ANDROID)
find_package (Threads REQUIRED)
find_package (PkgConfig REQUIRED)
@ -121,7 +126,13 @@ unset(MRAA_FOUND CACHE)
set(MRAA_MINIMUM 1.6.1)
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
# Also, get full path to the mraa library
find_library(MRAA_LIBRARY NAMES mraa PATHS ${MRAA_LIBDIR} NO_DEFAULT_PATH)
find_library(MRAA_LIBRARY NAMES mraa PATHS ${MRAA_LIBDIR})
# Test MRAA for various compile options
include (CheckLibraryExists)
check_library_exists (${MRAA_LIBRARIES} mraa_iio_init "${MRAA_LIBDIR}" MRAA_IIO_FOUND)
check_library_exists (${MRAA_LIBRARIES} mraa_firmata_init "${MRAA_LIBDIR}" MRAA_FIRMATA_FOUND)
check_library_exists (${MRAA_LIBRARIES} mraa_uart_ow_init "${MRAA_LIBDIR}" MRAA_OW_FOUND)
# Check for BACNET
pkg_check_modules (BACNET libbacnet)
@ -146,7 +157,7 @@ if (BUILDSWIGJAVA)
find_package (JNI REQUIRED)
pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0)
# Also, get full path to the mraajava library
find_library(MRAAJAVA_LIBRARY NAMES mraajava PATHS ${MRAA_LIBDIR} NO_DEFAULT_PATH)
find_library(MRAAJAVA_LIBRARY NAMES mraajava PATHS ${MRAA_LIBDIR})
endif (BUILDSWIGJAVA)
# Find swig if any wrapper is enabled
@ -415,12 +426,10 @@ if (RPM)
endif()
# UPM common headers
set (UPM_COMMON_HEADER_DIRS
${CMAKE_HOME_DIRECTORY}/include
${CMAKE_HOME_DIRECTORY}/include/fti
${CMAKE_BINARY_DIR}/src)
set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/version.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/src/version.hpp @ONLY)
# Generate a build-only C++ header to add functionality to SWIG'ed modules
configure_file (${PROJECT_SOURCE_DIR}/cmake/modules/version.hpp.in ${PROJECT_BINARY_DIR}/src/version.hpp @ONLY)
# UPM source
add_subdirectory (src)

View File

@ -50,6 +50,11 @@ function (add_example example_src)
# Parse function parameters
cmake_parse_arguments(add_example "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Attempt to remove this example source file from a list of example
# sources. This allows for handling special case examples.
list (REMOVE_ITEM example_src_list ${example_src})
set (example_src_list ${example_src_list} PARENT_SCOPE)
# Get the base filename from the full filename
# For file /some/path/to/sensorfoo-bar.c, example_name = sensorfoo-bar
get_filename_component(example_name ${example_src} NAME_WE)
@ -84,7 +89,7 @@ function (add_example example_src)
# If a dependency target does NOT exist, print a warning and skip
foreach(_dep_target ${lib_target_names})
if (NOT TARGET ${_dep_target})
message(STATUS "Missing CMake target (${_dep_target}), skipping example ${example_src}")
message(STATUS "Example ${example_src} is missing a required CMake target (${_dep_target}), skipping...")
return()
endif ()
endforeach ()
@ -96,10 +101,6 @@ function (add_example example_src)
foreach(_dep_target ${lib_target_names})
target_link_libraries(${this_target_name} ${_dep_target} ${CMAKE_THREAD_LIBS_INIT})
endforeach ()
# Special case...
list (REMOVE_ITEM example_src_list ${example_src})
set (example_src_list ${example_src_list} PARENT_SCOPE)
endfunction (add_example example_src)
# Add subdirectories if BUILDEXAMPLES=on

View File

@ -23,7 +23,10 @@
*/
#include <signal.h>
#include <string>
#include "jhd1313m1.hpp"
#include "upm_utilities.h"
int shouldRun = true;
@ -64,7 +67,7 @@ main(int argc, char **argv)
// Echo via printf
printf("Hello World %d rgb: 0x%02x%02x%02x\n", ndx++, r, g, b);
sleep(1);
upm_delay(1);
}
//! [Interesting]

View File

@ -7,5 +7,5 @@ file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
# - Create an executable for all other src files in this directory -------------
foreach (_example_src ${example_src_list})
add_example(${_example_src} SUFFIX "-c")
add_example(${_example_src} TARGETS utilities-c SUFFIX "-c")
endforeach ()

View File

@ -111,7 +111,9 @@ add_example(RotaryEncoderSample rotaryencoder)
add_example(RPR220_intrSample rpr220)
add_example(RPR220Sample rpr220)
add_example(ST7735Sample st7735)
add_example(StepMotorSample stepmotor)
if (NOT ANDROID)
add_example(StepMotorSample stepmotor)
endif ()
add_example(TM1637Sample tm1637)
add_example(TP401Sample gas)
add_example(TSL2561Sample tsl2561)
@ -145,7 +147,9 @@ if (BACNET_FOUND)
add_example(T8100_Example t8100)
add_example(TB7300_Example tb7300)
endif()
add_example(VCAP_Example vcap)
if (JPEG_FOUND)
add_example(VCAP_Example vcap)
endif()
add_example(BMP280_Example bmp280)
add_example(BNO055_Example bno055)
add_example(BMX055_Example bmx055)

View File

@ -34,13 +34,14 @@ public class MPU9150Sample {
while (true) {
sensor.update();
float[] accel = sensor.getAccelerometer();
System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
+ accel[2]);
float[] gyro = sensor.getGyroscope();
System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
+ gyro[2]);
// These don't exist
// float[] accel = sensor.getAccelerometer();
// System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
// + accel[2]);
//
// float[] gyro = sensor.getGyroscope();
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
// + gyro[2]);
float[] magn = sensor.getMagnetometer();
System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
@ -50,4 +51,4 @@ public class MPU9150Sample {
}
// ! [Interesting]
}
}
}

View File

@ -26,6 +26,8 @@
#ifndef UPM_FTI_H_
#define UPM_FTI_H_
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -9,6 +9,11 @@ set (SWIG_CXX_DISABLE_WARNINGS -Wno-error
-Wno-maybe-uninitialized
-Wno-strict-aliasing)
# If building under android, make sure swig gets an ANDROID flag
if (ANDROID)
list (APPEND CMAKE_SWIG_FLAGS -DANDROID)
endif (ANDROID)
macro (file_to_list readfile outlist)
FILE(READ "${readfile}" contents)
STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}")
@ -37,32 +42,60 @@ macro (upm_create_install_pkgconfig generated_file install_location)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
endmacro(upm_create_install_pkgconfig)
# This function iterates over all target names stored in CACHE variable
# UPM_LIBRARY_TARGETS and writes a .pc file to each build directory
function (_gen_pkg_config_per_target)
list(LENGTH UPM_LIBRARY_TARGETS n_targets)
message(STATUS "Generating pkg-config files for ${n_targets} libraries...")
set (n_ctargets 0)
set (n_cxxtargets 0)
# Given a target name, return all in-project targets ALREADY defined (ie, this
# does not comprehend targets that have yet to be added.
function (_get_dependency_targets target return_variable)
# Clear the variable
set(${return_variable} "")
# Get the LINK_LIBRARIES property of the target
get_target_property(_dep_libs ${target} LINK_LIBRARIES)
# Remove this libname from the _dep_libs (if it exists)
list(REMOVE_ITEM _dep_libs ${libname})
# Check if any of the LINK_LIBRARIES are targets in this project,
# if so, add them to ${return_variable}
foreach (deplib ${_dep_libs})
# Only add targets that exist
if (TARGET ${deplib})
list(APPEND ${return_variable} ${deplib})
# Special case - mraa is NOT in this project, but add it to the
# reqlibname list (used in various items like pom files, .pc files, etc
elseif (${deplib} MATCHES mraa)
list(APPEND ${return_variable} mraa)
endif (TARGET ${deplib})
endforeach (deplib ${_dep_libs})
# Uniquify
list(REMOVE_DUPLICATES ${return_variable})
# Make the list available outside this function
set (${return_variable} ${${return_variable}} PARENT_SCOPE)
endfunction (_get_dependency_targets target)
# This function iterates over all provided target names and
# writes a .pc file to each build directory
function (_gen_pkg_config_per_target LABEL)
list(LENGTH ARGN n_targets)
message(STATUS "Generating pkg-config files for ${n_targets} ${LABEL} libraries...")
# Iterate over the targets an build package config (.pc) files
foreach (target ${UPM_LIBRARY_TARGETS})
foreach (target ${ARGN})
if (TARGET ${target})
get_target_property(libname ${target} PKG_CONFIG_NAME)
get_target_property(libdescription ${target} PKG_CONFIG_DESCRIPTION)
get_target_property(reqlibname ${target} PKG_EXT_REQ_LIBS)
get_target_property(BINARY_DIR ${target} BINARY_DIR)
get_target_property(DEPLIBS ${target} LINK_LIBRARIES)
# Remove this libname from the DEPLIBS (if it's there)
list(REMOVE_ITEM DEPLIBS ${libname})
# Get a list of in-project dependency targets for this target
_get_dependency_targets(${target} DEPLIBS)
# Check if any of the LINK_LIBRARIES are targets in this project,
# if so, add them to reqlibname
foreach (deplib ${DEPLIBS})
# If this target exists, get the actual library name (which equates
# to it's .pc filename, example: target dfrph = <upm-dfrph>.pc
# Get the actual library name (which equates to it's .pc filename,
# example: target dfrph = <upm-dfrph>.pc
if (TARGET ${deplib})
get_target_property(deplibname ${deplib} PKG_CONFIG_NAME)
list(APPEND reqlibname ${deplibname})
# If the deplib is mraa, add that verbatim (mraa's .pc file is mraa.pc)
elseif (${deplib} MATCHES mraa)
list(APPEND reqlibname mraa)
endif (TARGET ${deplib})
@ -73,21 +106,100 @@ function (_gen_pkg_config_per_target)
# Switch to comma separated Requires: field (per pkg-config docs)
string(REPLACE ";" "," reqlibname "${reqlibname}")
# Keep some stats
string(REGEX MATCH "-c$" _isC ${target})
if (_isC)
MATH(EXPR n_ctargets "${n_ctargets}+1")
else ()
MATH(EXPR n_cxxtargets "${n_cxxtargets}+1")
endif()
# Create the .pc file
upm_create_install_pkgconfig (${libname}.pc ${LIB_INSTALL_DIR}/pkgconfig)
endif (TARGET ${target})
endforeach (target ${UPM_LIBRARY_TARGETS})
message(STATUS "\tFound C libraries: ${n_ctargets}")
message(STATUS "\tFound CXX libraries: ${n_cxxtargets}")
message(STATUS "Generating pkg-config files for ${n_targets} libraries... Complete")
endforeach (target ${ARGN})
message(STATUS "Generating pkg-config files for ${n_targets} ${LABEL} libraries... Complete")
endfunction (_gen_pkg_config_per_target)
# This function iterates over all provided target names and
# writes a pom file to each build directory
function (_gen_pom_per_target)
list(LENGTH ARGN n_targets)
message(STATUS "Generating pom files for ${n_targets} CXX libraries...")
# Iterate over the targets an build pom files
foreach (target ${ARGN})
if (TARGET ${target})
get_target_property(libname ${target} PKG_CONFIG_NAME)
get_target_property(libdescription ${target} PKG_CONFIG_DESCRIPTION)
get_target_property(reqlibname ${target} PKG_EXT_REQ_LIBS)
get_target_property(BINARY_DIR ${target} BINARY_DIR)
# Get a list of in-project dependency targets for this target
_get_dependency_targets(${target} DEPLIBS)
# Default the packaging for java
set (pom_packaging jar)
# Default the groupid for java
set (pom_base_groupId io.mraa)
if (ANDROID)
# Android overrides
set (pom_packaging aar)
set (pom_base_groupId io.mraa.at)
endif (ANDROID)
# Top-level pom groupId
set (pom_groupId ${pom_base_groupId}.upm)
# Template for a single dependency
set (pom_dep_template "
<dependency>
<groupId>\@pom_dep_groupId\@</groupId>
<artifactId>\@deplib\@</artifactId>
<version>[\@pom_version_minimum\@, \)</version>
<scope>compile</scope>
</dependency>")
# Iterate over the dependency targets, build an XML vector of dependencies
set (pom_dependencies "")
foreach (deplib ${DEPLIBS})
unset(_tmp_pom_dep)
# mraa is a special case
if (${deplib} MATCHES mraa)
set (pom_dep_groupId "${pom_base_groupId}")
set (pom_version_minimum ${MRAA_MINIMUM})
string(CONFIGURE ${pom_dep_template} _tmp_pom_dep @ONLY)
# Only match CXX target dependencies
elseif ("${UPM_TARGETS_CXX}" MATCHES ";${deplib};")
set (deplib upm_${deplib})
set (pom_dep_groupId "${pom_base_groupId}.upm")
set (pom_version_minimum ${upm_VERSION_STRING})
string(CONFIGURE ${pom_dep_template} _tmp_pom_dep @ONLY)
endif (${deplib} MATCHES mraa)
# Add this dependency to the list of pom dependencies
set (pom_dependencies "${pom_dependencies}${_tmp_pom_dep}")
endforeach (deplib ${DEPLIBS})
# Separate the dependency elements
STRING(REGEX REPLACE ";" "\\n;" pom_dependencies "${pom_dependencies}")
# Configure the pom file
configure_file (${CMAKE_SOURCE_DIR}/src/pom.xml.in
${BINARY_DIR}/upm_${target}-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.pom)
endif (TARGET ${target})
endforeach (target ${ARGN})
message(STATUS "Generating pom files for ${n_targets} CXX libraries... Complete")
endfunction (_gen_pom_per_target)
# Print out a quick summary of the UPM targets
function (_print_target_summary)
list(LENGTH UPM_TARGETS_C N_C)
list(LENGTH UPM_TARGETS_CXX N_CXX)
list(LENGTH UPM_TARGETS_JAVA N_JAVA)
list(LENGTH UPM_TARGETS_NODEJS N_NODEJS)
list(LENGTH UPM_TARGETS_PYTHON2 N_PYTHON2)
list(LENGTH UPM_TARGETS_PYTHON3 N_PYTHON3)
message(STATUS "UPM target summary:")
message(STATUS "\tFound C libraries: ${N_C}")
message(STATUS "\tFound CXX libraries: ${N_CXX}")
message(STATUS "\tFound JAVA libraries: ${N_JAVA}")
message(STATUS "\tFound NODEJS libraries: ${N_NODEJS}")
message(STATUS "\tFound PYTHON2 libraries: ${N_PYTHON2}")
message(STATUS "\tFound PYTHON3 libraries: ${N_PYTHON3}")
endfunction (_print_target_summary)
function (_get_target_dependency_interface_include_dirs target varIncludeDirs)
set (${varIncludeDirs} "")
@ -117,7 +229,8 @@ macro(_upm_swig_python)
# wrapper generation. Get them manually and add them here.
_get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS)
include_directories (${UPM_COMMON_HEADER_DIRS}
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${DEPEND_DIRS})
set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
@ -139,6 +252,7 @@ macro(_upm_swig_python)
swig_add_module (${python_wrapper_name} python pyupm_${libname}.i)
# Get target library name (example _pyupm_a110x-python2)
set (python_wrapper_target ${SWIG_MODULE_${python_wrapper_name}_REAL_NAME})
add_dependencies(${python_wrapper_target} ${libname})
swig_link_libraries (${python_wrapper_name} ${PYTHON_LIBRARIES} ${libname})
target_include_directories (${python_wrapper_target}
@ -196,6 +310,10 @@ macro(upm_swig_python)
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
set(PYTHON_PACKAGES_PATH ${PYTHON2_PACKAGES_PATH})
_upm_swig_python()
# Keep track of all Python2 targets
set(UPM_TARGETS_PYTHON2 ${UPM_TARGETS_PYTHON2} ${python_wrapper_target}
CACHE INTERNAL "List of Python target names")
endif (PYTHON2LIBS_FOUND)
# Generate python3 module if python3 libs are available
@ -207,6 +325,10 @@ macro(upm_swig_python)
set(PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR})
set(PYTHON_PACKAGES_PATH ${PYTHON3_PACKAGES_PATH})
_upm_swig_python()
# Keep track of all Python3 targets
set(UPM_TARGETS_PYTHON3 ${UPM_TARGETS_PYTHON3} ${python_wrapper_target}
CACHE INTERNAL "List of Python target names")
endif (PYTHON3LIBS_FOUND)
endif (NOT ";${PYTHONSWIG_BLACKLIST};" MATCHES ";${libname};")
endmacro(upm_swig_python)
@ -229,14 +351,14 @@ macro(upm_swig_node)
# wrapper generation. Get them manually and add them here.
_get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS)
include_directories (
${UPM_COMMON_HEADER_DIRS}
${DEPEND_DIRS}
)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${DEPEND_DIRS})
set_property (SOURCE jsupm_${libname}.i PROPERTY SWIG_FLAGS "-node" "-DV8_VERSION=${V8_VERSION_HEX}")
set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i)
add_dependencies(jsupm_${libname} ${libname})
swig_link_libraries (jsupm_${libname} ${NODE_LIBRARIES} ${libname})
target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
PUBLIC
@ -277,6 +399,9 @@ macro(upm_swig_node)
install (TARGETS jsupm_${libname} DESTINATION ${NODE_MODULE_INSTALL_PATH})
endif (NOT ";${NODESWIG_BLACKLIST};" MATCHES ";${libname};")
# Keep track of all NODE targets
set(UPM_TARGETS_NODEJS ${UPM_TARGETS_NODEJS} jsupm_${libname} CACHE INTERNAL "List of NodeJs target names")
endmacro(upm_swig_node)
macro(upm_swig_java)
@ -289,7 +414,8 @@ macro(upm_swig_java)
include_directories (
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
${UPM_COMMON_HEADER_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${DEPEND_DIRS}
)
@ -302,7 +428,8 @@ macro(upm_swig_java)
# See issue #518
# TODO: Fix this somehow
swig_add_module (javaupm_${libname} java javaupm_${libname}.i ${module_src})
swig_link_libraries (javaupm_${libname} ${MRAAJAVA_LIBRARY} ${JAVA_LIBRARIES} ${libname} interfaces)
swig_link_libraries (javaupm_${libname} ${MRAAJAVA_LIBRARY} ${JAVA_LIBRARIES} ${libname})
add_dependencies(javaupm_${libname} ${libname})
target_include_directories ( ${SWIG_MODULE_javaupm_${libname}_REAL_NAME}
PUBLIC
"${JAVA_INCLUDE_DIRS}"
@ -347,8 +474,8 @@ macro(upm_swig_java)
COMMAND ${JAR} cvf upm_${libname}.jar upm_${libname}
)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/../pom.xml.in
${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.pom)
# Keep track of all JAVA targets
set(UPM_TARGETS_JAVA ${UPM_TARGETS_JAVA} javaupm_${libname} CACHE INTERNAL "List of JAVA target names")
endif (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};")
endmacro(upm_swig_java)
@ -483,11 +610,6 @@ function (UPM_MIXED_MODULE_INIT)
set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC})
set (module_hpp ${UPM_MIXED_MODULE_INIT_C_HDR})
# Append the utilities-c target to each c target
if (NOT ${libname} MATCHES "utilities")
list (APPEND UPM_MIXED_MODULE_INIT_REQUIRES utilities-c)
endif()
# If building FTI, and FTI src exists, add it in
if (BUILDFTI AND UPM_MIXED_MODULE_INIT_FTI_SRC)
#set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC} ${UPM_MIXED_MODULE_INIT_FTI_SRC})
@ -498,11 +620,17 @@ function (UPM_MIXED_MODULE_INIT)
set (IS_C_LIBRARY TRUE)
upm_module_init(${UPM_MIXED_MODULE_INIT_REQUIRES})
# add upmc-utilities as a dependancy to all C libs (but NOT to the
# utilities lib itself)
if (NOT ${libname} MATCHES "utilities-c")
target_link_libraries (${libname} utilities-c)
endif()
# If a c target has a dependency on utilities-c, then swap the corresponding
# C++ target's dependency on utilities-c to utilities. This solves a niche
# problem for Android Things (C++ which depends on C which depends on
# utilities-c is not getting the utilities-c library). Since only C++
# packages get swig'ed to Java, the only way to get the utilities-c library
# is to packages with a utilites C++ library and add a dependency.
# TODO: Find a better way to do this.
if ("${UPM_MIXED_MODULE_INIT_REQUIRES}" MATCHES utilities-c)
list (REMOVE_ITEM UPM_MIXED_MODULE_INIT_REQUIRES utilities-c)
list (APPEND UPM_MIXED_MODULE_INIT_REQUIRES utilities)
endif ()
## "export" the logical C lib target for the calling module's
## CMakeLists.txt
@ -543,21 +671,24 @@ function(upm_module_init)
# If this is a C library, export C library target name to parent's libname
set (libname ${libname} PARENT_SCOPE)
set (libprefix upmc-)
# Keep track of all C targets
set(UPM_TARGETS_C ${UPM_TARGETS_C} ${libname} CACHE INTERNAL "List of C target names")
else ()
# Keep track of all CXX targets
set(UPM_TARGETS_CXX ${UPM_TARGETS_CXX} ${libname} CACHE INTERNAL "List of CXX target names")
set (libprefix upm-)
endif (IS_C_LIBRARY)
# Create the target library from src/hdrs
add_library (${libname} SHARED ${module_src} ${module_hpp})
target_include_directories (${libname} PUBLIC
${UPM_COMMON_HEADER_DIRS}
${CMAKE_SOURCE_DIR}/src/utilities)
# Specify the current source directory as an INTERFACE include dir.
# This allows for transitive header dependencies via target_link_libraries
target_include_directories(${libname} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# Also add common header directories to this target
target_include_directories (${libname} PUBLIC ${UPM_COMMON_HEADER_DIRS})
# Iterate over all arguments passed to upm_module_init.
# 1. Add them via target_link_libraries
# 2. If mraa, then add a link and include dependency
@ -594,8 +725,7 @@ function(upm_module_init)
endif (BUILDSWIGJAVA)
endif (NOT IS_C_LIBRARY)
# Add this target to the list of library target names
set(UPM_LIBRARY_TARGETS ${UPM_LIBRARY_TARGETS} ${libname} CACHE INTERNAL "List of ALL target names")
# Add additional properties to this target (used later for .pc file creation)
set_target_properties(${libname} PROPERTIES PKG_CONFIG_NAME "${libprefix}${basename}")
set_target_properties(${libname} PROPERTIES PKG_CONFIG_DESCRIPTION "${libdescription}")
set_target_properties(${libname} PROPERTIES PKG_EXT_REQ_LIBS "${reqlibname}")
@ -647,8 +777,13 @@ elseif (BUILDSWIGPYTHON)
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub")
endif (BUILDDOC AND BUILDSWIGPYTHON)
# Provide a cached variable to save a list of library target names
set(UPM_LIBRARY_TARGETS "" CACHE INTERNAL "List of ALL target names")
# Provide a cached variable to groups of targets
set(UPM_TARGETS_C "" CACHE INTERNAL "List of C target names")
set(UPM_TARGETS_CXX "" CACHE INTERNAL "List of CXX target names")
set(UPM_TARGETS_JAVA "" CACHE INTERNAL "List of JAVA target names")
set(UPM_TARGETS_NODEJS "" CACHE INTERNAL "List of NodeJs target names")
set(UPM_TARGETS_PYTHON2 "" CACHE INTERNAL "List of Python2 target names")
set(UPM_TARGETS_PYTHON3 "" CACHE INTERNAL "List of Python3 target names")
# Add subdirectories from MODULE_LIST if defined
# Example -DMODULE_LIST="dfrph;rotaryencoder"
@ -674,5 +809,14 @@ foreach(subdir ${SUBDIRS})
endif()
endforeach()
# Print stats for all targets
_print_target_summary()
# Generate a pkg-config file (.pc) per target
_gen_pkg_config_per_target()
_gen_pkg_config_per_target(C ${UPM_TARGETS_C})
_gen_pkg_config_per_target(CXX ${UPM_TARGETS_CXX})
# Generate a pom file per CXX target
if (BUILDSWIGJAVA)
_gen_pom_per_target(${UPM_TARGETS_CXX})
endif (BUILDSWIGJAVA)

View File

@ -1,5 +1,7 @@
set (libname "apds9930")
set (libdescription "Digital Ambient Light and Proximity Sensor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
if (MRAA_IIO_FOUND)
set (libname "apds9930")
set (libdescription "Digital Ambient Light and Proximity Sensor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
endif (MRAA_IIO_FOUND)

View File

@ -285,7 +285,7 @@ BACNETMSTP* BACNETMSTP::instance()
return m_instance;
}
void BACNETMSTP::initMaster(std::string port, int baudRate,
void BACNETMSTP::initMaster(string port, int baudRate,
int deviceInstanceID, int macAddr, int maxMaster,
int maxInfoFrames)
{
@ -305,7 +305,7 @@ void BACNETMSTP::initMaster(std::string port, int baudRate,
if ( !(baudRate == 9600 || baudRate == 19200 || baudRate == 38400
|| baudRate == 57600 || baudRate == 76800 || baudRate == 115200) )
{
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": baudRate must be 9600, 19200, 38400, "
+ " 57600, 76800, or 115200");
}
@ -314,26 +314,26 @@ void BACNETMSTP::initMaster(std::string port, int baudRate,
// maxMaster must be less than or equal to 127
if (maxMaster < 0 || maxMaster > DEFAULT_MAX_MASTER)
{
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": maxMaster must be between 0 and "
+ std::to_string(DEFAULT_MAX_MASTER));
+ to_string(DEFAULT_MAX_MASTER));
}
// As a master ourselves, we must have a MAC address also within the
// constraints of maxMaster
if (macAddr < 0 || macAddr > DEFAULT_MAX_MASTER)
{
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": macAddr must be between 0 and "
+ std::to_string(DEFAULT_MAX_MASTER));
+ to_string(DEFAULT_MAX_MASTER));
}
// this should be unique on the network
if (deviceInstanceID >= BACNET_MAX_INSTANCE)
{
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": deviceInstanceID must be less than "
+ std::to_string(BACNET_MAX_INSTANCE)
+ to_string(BACNET_MAX_INSTANCE)
+ ", and must be unique on the network");
}
@ -506,7 +506,7 @@ bool BACNETMSTP::dispatchRequest()
break;
default:
syslog(LOG_WARNING, "%s: switch case not defined",
std::string(__FUNCTION__).c_str());
string(__FUNCTION__).c_str());
}
}
else if (tsm_invoke_id_free(m_invokeID))
@ -584,9 +584,9 @@ bool BACNETMSTP::readProperty(uint32_t targetDeviceInstanceID,
// some sanity checking...
if (objInstance >= BACNET_MAX_INSTANCE)
{
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": objInstance must be less than "
+ std::to_string(BACNET_MAX_INSTANCE));
+ to_string(BACNET_MAX_INSTANCE));
}
// fill in the command structure and dispatch
@ -620,9 +620,9 @@ bool BACNETMSTP::writeProperty(uint32_t targetDeviceInstanceID,
// some sanity checking...
if (objInstance >= BACNET_MAX_INSTANCE)
{
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": objInstance must be less than "
+ std::to_string(BACNET_MAX_INSTANCE));
+ to_string(BACNET_MAX_INSTANCE));
}
// fill in the command structure and dispatch
@ -681,9 +681,9 @@ float BACNETMSTP::getDataTypeReal(int index)
case BACNET_APPLICATION_TAG_SIGNED_INT:
return float(getDataTypeSignedInt(index));
default:
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to Real");
}
}
@ -694,9 +694,9 @@ bool BACNETMSTP::getDataTypeBoolean(int index)
if (getDataType(index) == BACNET_APPLICATION_TAG_BOOLEAN)
return ((m_returnedValue.at(index).type.Boolean) ? true : false);
else
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to Bool");
}
@ -705,9 +705,9 @@ unsigned int BACNETMSTP::getDataTypeUnsignedInt(int index)
if (getDataType(index) == BACNET_APPLICATION_TAG_UNSIGNED_INT)
return m_returnedValue.at(index).type.Unsigned_Int;
else
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to UnsignedInt");
}
@ -716,9 +716,9 @@ int BACNETMSTP::getDataTypeSignedInt(int index)
if (getDataType(index) == BACNET_APPLICATION_TAG_SIGNED_INT)
return m_returnedValue.at(index).type.Signed_Int;
else
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to SignedInt");
}
@ -744,9 +744,9 @@ double BACNETMSTP::getDataTypeDouble(int index)
case BACNET_APPLICATION_TAG_SIGNED_INT:
return double(getDataTypeSignedInt(index));
default:
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to Double");
}
}
@ -758,35 +758,35 @@ unsigned int BACNETMSTP::getDataTypeEnum(int index)
if (getDataType(index) == BACNET_APPLICATION_TAG_ENUMERATED)
return m_returnedValue.at(index).type.Enumerated;
else
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to Enum");
}
std::string BACNETMSTP::getDataTypeString(int index)
string BACNETMSTP::getDataTypeString(int index)
{
string retval;
string retval;
// Here, we can try to accomodate all the types
switch(getDataType(index))
{
case BACNET_APPLICATION_TAG_REAL:
retval = std::to_string(getDataTypeReal(index));
retval = to_string(getDataTypeReal(index));
break;
#if defined(BACAPP_DOUBLE)
case BACNET_APPLICATION_TAG_DOUBLE:
retval = std::to_string(getDataTypeDouble(index));
retval = to_string(getDataTypeDouble(index));
break;
#endif // BACAPP_DOUBLE
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
retval = std::to_string(getDataTypeUnsignedInt(index));
retval = to_string(getDataTypeUnsignedInt(index));
break;
case BACNET_APPLICATION_TAG_SIGNED_INT:
retval = std::to_string(getDataTypeSignedInt(index));
retval = to_string(getDataTypeSignedInt(index));
break;
case BACNET_APPLICATION_TAG_BOOLEAN:
@ -801,7 +801,7 @@ std::string BACNETMSTP::getDataTypeString(int index)
case BACNET_APPLICATION_TAG_OCTET_STRING:
{
string tmpstr((char *)octetstring_value(&m_returnedValue.at(index).type.Octet_String),
string tmpstr((char *)octetstring_value(&m_returnedValue.at(index).type.Octet_String),
octetstring_length(&m_returnedValue.at(index).type.Octet_String));
retval = string2HexString(tmpstr);
@ -829,9 +829,9 @@ std::string BACNETMSTP::getDataTypeString(int index)
break;
default:
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": data type ("
+ std::to_string(int(getDataType(index)))
+ to_string(int(getDataType(index)))
+ ") is not convertible to String");
break;
}
@ -891,9 +891,9 @@ BACNET_APPLICATION_DATA_VALUE BACNETMSTP::createDataString(string value)
{
if (value.size() > (MAX_CHARACTER_STRING_BYTES - 1))
{
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": value must be less than or equal to "
+ std::to_string(MAX_CHARACTER_STRING_BYTES - 1)
+ to_string(MAX_CHARACTER_STRING_BYTES - 1)
+ " characters long");
}

View File

@ -70,7 +70,7 @@ BACNETUTIL::~BACNETUTIL()
{
}
void BACNETUTIL::initMaster(std::string port, int baudRate,
void BACNETUTIL::initMaster(string port, int baudRate,
int deviceInstanceID, int macAddr, int maxMaster,
int maxInfoFrames)
{
@ -109,7 +109,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
cerr << __FUNCTION__ << ": (reliability): " << getAllErrorString()
<< endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ getAllErrorString());
}
@ -121,7 +121,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": Reliability check failed");
}
}
@ -134,7 +134,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
cerr << __FUNCTION__ << ": (value): " << getAllErrorString()
<< endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -158,7 +158,7 @@ void BACNETUTIL::setAnalogValue(uint32_t objInstance,
if (m_debugging)
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -201,7 +201,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
cerr << __FUNCTION__ << ": (reliability): "
<< getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ getAllErrorString());
}
@ -213,7 +213,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": Reliability check failed");
}
}
@ -225,7 +225,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -248,7 +248,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
cerr << __FUNCTION__ << ": (reliability): "
<< getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ getAllErrorString());
}
@ -260,7 +260,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": Reliability check failed");
}
}
@ -272,7 +272,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -298,7 +298,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
cerr << __FUNCTION__ << ": (reliability): "
<< getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ getAllErrorString());
}
@ -310,7 +310,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": Reliability check failed");
}
}
@ -322,7 +322,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -351,7 +351,7 @@ void BACNETUTIL::setBinaryValue(uint32_t objInstance,
if (m_debugging)
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -398,7 +398,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
cerr << __FUNCTION__ << ": (reliability): "
<< getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ getAllErrorString());
}
@ -410,7 +410,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": Reliability check failed");
}
}
@ -423,7 +423,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
if (m_debugging)
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -451,7 +451,7 @@ void BACNETUTIL::updateMultiStateValueInfo(uint32_t objInstance)
<< getAllErrorString()
<< endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -525,10 +525,10 @@ string BACNETUTIL::lookupMultiStateValueText(uint32_t objInstance,
// verify that value is valid for this object
if (value == 0 || value > m_msvInfo[objInstance].numStates)
throw std::out_of_range(std::string(__FUNCTION__)
throw out_of_range(string(__FUNCTION__)
+ ": value supplied is invalid. Maximum "
+ "allowed values are 1 to "
+ std::to_string(m_msvInfo[objInstance].numStates)
+ to_string(m_msvInfo[objInstance].numStates)
+ " for this object");
@ -549,7 +549,7 @@ string BACNETUTIL::lookupMultiStateValueText(uint32_t objInstance,
}
// no stateList text available, so just return value as a string
return std::to_string(value);
return to_string(value);
}
unsigned int BACNETUTIL::getMultiStateValueMaxStates(uint32_t objInstance)
@ -576,10 +576,10 @@ void BACNETUTIL::setMultiStateValue(uint32_t objInstance,
// Check value against the valid limits
if (value == 0 || value > m_msvInfo[objInstance].numStates)
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": value supplied is invalid. Maximum "
+ "allowed values are 1 to "
+ std::to_string(m_msvInfo[objInstance].numStates)
+ to_string(m_msvInfo[objInstance].numStates)
+ " for this object");
// Write the value
@ -596,7 +596,7 @@ void BACNETUTIL::setMultiStateValue(uint32_t objInstance,
if (m_debugging)
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
throw std::runtime_error(std::string(__FUNCTION__)
throw runtime_error(string(__FUNCTION__)
+ ": "
+ getAllErrorString());
}
@ -772,7 +772,7 @@ uint8_t BACNETUTIL::getRejectReason()
return m_instance->getRejectReason();
}
std::string BACNETUTIL::getRejectString()
string BACNETUTIL::getRejectString()
{
return m_instance->getRejectString();
}
@ -782,7 +782,7 @@ uint8_t BACNETUTIL::getAbortReason()
return m_instance->getAbortReason();
}
std::string BACNETUTIL::getAbortString()
string BACNETUTIL::getAbortString()
{
return m_instance->getAbortString();
}
@ -797,12 +797,12 @@ BACNET_ERROR_CODE BACNETUTIL::getErrorCode()
return m_instance->getErrorCode();
}
std::string BACNETUTIL::getUPMErrorString()
string BACNETUTIL::getUPMErrorString()
{
return m_instance->getUPMErrorString();
}
std::string BACNETUTIL::getErrorString()
string BACNETUTIL::getErrorString()
{
return m_instance->getErrorString();
};
@ -904,7 +904,7 @@ bool BACNETUTIL::setDeviceName(string name)
{
if (name.size() < 1)
{
throw std::invalid_argument(std::string(__FUNCTION__)
throw invalid_argument(string(__FUNCTION__)
+ ": name must have at least one character");
}

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bh1750
CPP_SRC bh1750.cxx
FTI_SRC bh1750_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bma250e
CPP_SRC bma250e.cxx
FTI_SRC bma250e_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmg160
CPP_SRC bmg160.cxx
FTI_SRC bmg160_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmi160
CPP_SRC bmi160.cxx
# FTI_SRC bmi160_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmm150
CPP_SRC bmm150.cxx
FTI_SRC bmm150_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,5 +5,5 @@ upm_mixed_module_init (NAME bmp280
CPP_HDR bmp280.hpp bme280.hpp
CPP_SRC bmp280.cxx bme280.cxx
CPP_WRAPS_C
REQUIRES mraa interfaces)
REQUIRES mraa interfaces utilities-c)
target_link_libraries(${libnamec} m)

View File

@ -54,5 +54,3 @@ void BME280::setOversampleRateHumidity(BME280_OSRS_H_T rate)
{
bmp280_set_oversample_rate_humidity(m_bmp280, rate);
}

View File

@ -6,5 +6,5 @@ upm_mixed_module_init (NAME bmpx8x
CPP_SRC bmpx8x.cxx
FTI_SRC bmpx8x_fti.c
CPP_WRAPS_C
REQUIRES mraa interfaces)
REQUIRES mraa interfaces utilities-c)
target_link_libraries(${libnamec} m)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME bno055
CPP_HDR bno055.hpp
CPP_SRC bno055.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME buzzer
CPP_SRC buzzer.cxx
# FTI_SRC buzzer_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME cjq4435
CPP_HDR cjq4435.hpp
CPP_SRC cjq4435.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,8 +1,4 @@
include (CheckFunctionExists)
include (CheckLibraryExists)
include (CheckIncludeFiles)
check_library_exists (${MRAA_LIBRARIES} mraa_firmata_init "" HAVE_FIRMATA)
if (HAVE_FIRMATA)
if (MRAA_FIRMATA_FOUND)
set (libname "curieimu")
set (libdescription "Curie IMU Sensor using Firmata")
set (module_src ${libname}.cpp)

View File

@ -1,13 +1,14 @@
upm_mixed_module_init (NAME dfrec
DESCRIPTION "Analog Electrical Conductivity (EC) Sensor"
C_HDR dfrec.h
C_SRC dfrec.c
CPP_HDR dfrec.hpp
CPP_SRC dfrec.cxx
FTI_SRC dfrec_fti.c
CPP_WRAPS_C
REQUIRES ds18b20 mraa)
# make sure the C library has the appropriate dependency on the UPM
# DS18B20 C library
target_link_libraries(${libnamec} ds18b20-c)
if (MRAA_OW_FOUND)
upm_mixed_module_init (NAME dfrec
DESCRIPTION "Analog Electrical Conductivity (EC) Sensor"
C_HDR dfrec.h
C_SRC dfrec.c
CPP_HDR dfrec.hpp
CPP_SRC dfrec.cxx
FTI_SRC dfrec_fti.c
CPP_WRAPS_C
REQUIRES ds18b20 mraa utilities-c)
# make sure the C library has the appropriate dependency on the UPM
# DS18B20 C library
target_link_libraries(${libnamec} ds18b20-c)
endif (MRAA_OW_FOUND)

View File

@ -23,6 +23,7 @@
*/
#include <iostream>
#include <string>
#include <stdexcept>
#include "dfrec.hpp"

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME dfrorp
CPP_SRC dfrorp.cxx
FTI_SRC dfrorp_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -51,7 +51,7 @@ void DFRORP::update()
{
throw std::runtime_error(string(__FUNCTION__)
+ ": dfrorp_update() failed with UPM error "
+ std::to_string(int(rv)) );
+ to_string(int(rv)) );
}
}

View File

@ -22,10 +22,13 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdexcept>
#include <string>
#include "mraa-utils.hpp"
#include "mraa/gpio.hpp"
#define UPM_THROW(msg) throw std::runtime_error(std::string(__FUNCTION__) + ": " + (msg))
#define UPM_THROW(msg) throw std::runtime_error(std::string(__FUNCTION__) + ": " + (msg))
void MraaUtils::setGpio(int pin, int level)
{

View File

@ -1,9 +1,11 @@
upm_mixed_module_init (NAME ds18b20
DESCRIPTION "Programmable Resolution 1-Wire Digital Thermometer"
C_HDR ds18b20.h ds18b20_defs.h
C_SRC ds18b20.c
CPP_HDR ds18b20.hpp
CPP_SRC ds18b20.cxx
FTI_SRC ds18b20_fti.c
CPP_WRAPS_C
REQUIRES mraa)
if (MRAA_OW_FOUND)
upm_mixed_module_init (NAME ds18b20
DESCRIPTION "Programmable Resolution 1-Wire Digital Thermometer"
C_HDR ds18b20.h ds18b20_defs.h
C_SRC ds18b20.c
CPP_HDR ds18b20.hpp
CPP_SRC ds18b20.cxx
FTI_SRC ds18b20_fti.c
CPP_WRAPS_C
REQUIRES mraa utilities-c)
endif (MRAA_OW_FOUND)

View File

@ -28,7 +28,7 @@
#include <stdlib.h>
#include "upm_fti.h"
#include "upm_sensor.h"
#include "fti/upm_sensor.h"
/**
* This file implements the Function Table Interface (FTI) for this sensor

View File

@ -1,5 +1,7 @@
set (libname "ds2413")
set (libdescription "1-Wire Dual Channel Addressable Switch")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
if (MRAA_OW_FOUND)
set (libname "ds2413")
set (libdescription "1-Wire Dual Channel Addressable Switch")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
endif (MRAA_OW_FOUND)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ecezo
CPP_SRC ecezo.cxx
FTI_SRC ecezo_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME enc03r
CPP_SRC enc03r.cxx
FTI_SRC enc03r_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME guvas12d
CPP_SRC guvas12d.cxx
FTI_SRC guvas12d_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME hka5
CPP_SRC hka5.cxx
FTI_SRC hka5_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -22,10 +22,13 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdexcept>
#include <string>
#include "mraa-utils.hpp"
#include "mraa/gpio.hpp"
#define UPM_THROW(msg) throw std::runtime_error(std::string(__FUNCTION__) + ": " + (msg))
#define UPM_THROW(msg) throw std::runtime_error(std::string(__FUNCTION__) + ": " + (msg))
void MraaUtils::setGpio(int pin, int level)
{

View File

@ -154,12 +154,12 @@ HTU21D::getDewPoint(int bSampleData)
sampleData();
}
float fA = 8.1332;
float fB = 1762.39;
float fC = 235.66;
float fT = getTemperature(false);
float fRH = getHumidity(false);
float fPP = exp10(fA - (fB / (fT + fC)));
float fA = 8.1332;
float fB = 1762.39;
float fC = 235.66;
float fT = getTemperature(false);
float fRH = getHumidity(false);
float fPP = powf(10, fA - (fB / (fT + fC)));
float fDP = -(fB / (log10(fRH * fPP / 100) - fA) + fC);
return (fDP);

View File

@ -5,14 +5,10 @@
%apply float *OUTPUT {float *fHum};
%apply float *OUTPUT {float *fHumTemp};
%apply float *OUTPUT {float *fDewPt};
%inline %{
extern int getHumidityData(float* fHum, float* fHumTemp, float* fDewPt);
%}
%{
#include "htu21d.hpp"
%}
%include "htu21d.hpp"
%pragma(java) jniclasscode=%{

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ims
CPP_SRC ims.cxx
FTI_SRC ims_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -23,6 +23,7 @@
*/
#include <stdexcept>
#include <string>
#include "ims.hpp"

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME jhd1313m1
CPP_HDR jhd1313m1.hpp
CPP_SRC jhd1313m1.cxx
CPP_WRAPS_C
REQUIRES mraa lcm1602)
REQUIRES mraa lcm1602 utilities-c)

View File

@ -1,5 +1,7 @@
set (libname "kxcjk1013")
set (libdescription "Tri-axis Digital Accelerometer")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
if (MRAA_IIO_FOUND)
set (libname "kxcjk1013")
set (libdescription "Tri-axis Digital Accelerometer")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
endif (MRAA_IIO_FOUND)

View File

@ -1,5 +1,7 @@
set (libname "l3gd20")
set (libdescription "Tri-axis Digital Gyroscope")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
if (MRAA_IIO_FOUND)
set (libname "l3gd20")
set (libdescription "Tri-axis Digital Gyroscope")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
endif (MRAA_IIO_FOUND)

View File

@ -138,11 +138,11 @@ L3GD20::L3GD20(int bus, int addr)
{
throw std::runtime_error(std::string(__FUNCTION__) +
": Invalid Chip ID: expected "
+ std::to_string(L3GD20_DEFAULT_CHIP_ID)
+ to_string(L3GD20_DEFAULT_CHIP_ID)
+ " or "
+ std::to_string(L3GD20H_DEFAULT_CHIP_ID)
+ to_string(L3GD20H_DEFAULT_CHIP_ID)
+ ", got "
+ std::to_string(int(cid)));
+ to_string(int(cid)));
return;
}
@ -282,7 +282,7 @@ void L3GD20::update()
{
throw std::runtime_error(std::string(__FUNCTION__)
+ ": readRegs() failed to read "
+ std::to_string(bufLen)
+ to_string(bufLen)
+ " bytes");
}

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME lcm1602
CPP_HDR lcm1602.hpp
CPP_SRC lcm1602.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -28,7 +28,7 @@
#include <stdlib.h>
#include "upm_fti.h"
#include "upm_sensor.h"
#include "fti/upm_sensor.h"
/**
* This file implements the Function Table Interface (FTI) for this sensor

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string>
#include "mraa-utils.hpp"
#include "mraa/gpio.hpp"

View File

@ -1,9 +1,9 @@
upm_mixed_module_init (NAME lsm303agr
DESCRIPTION "3-Axis eCompass module"
DESCRIPTION "3-Axis eCompass Module"
C_HDR lsm303agr.h lsm303agr_defs.h
C_SRC lsm303agr.c
CPP_HDR lsm303agr.hpp
CPP_SRC lsm303agr.cxx
FTI_SRC lsm303agr_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,8 +1,8 @@
upm_mixed_module_init (NAME lsm303d
DESCRIPTION "3-Axis eCompass module"
DESCRIPTION "3-Axis eCompass Module"
C_HDR lsm303d.h lsm303d_defs.h
C_SRC lsm303d.c
CPP_HDR lsm303d.hpp
CPP_SRC lsm303d.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME m24lr64e
CPP_SRC m24lr64e.cxx
FTI_SRC m24lr64e_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME max30100
CPP_SRC max30100.cxx
FTI_SRC max30100_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,11 +1,19 @@
%module(directors="1", threads="1") javaupm_max30100
#ifdef ANDROID
%module javaupm_max30100
#else
%module(directors="1", threads="1") javaupm_max30100
#endif
%include "../upm.i"
%{
#include "max30100.hpp"
%}
%feature("director") upm::Callback;
#ifndef ANDROID
%feature("director") upm::Callback;
#endif
%include "max30100_regs.h"
%include "max30100.hpp"

View File

@ -23,6 +23,8 @@
*/
#include <stdexcept>
#include <string>
#include "max30100.hpp"
using namespace upm;

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME mb704x
CPP_SRC mb704x.cxx
FTI_SRC mb704x_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME mcp2515
CPP_HDR mcp2515.hpp
CPP_SRC mcp2515.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME md
CPP_HDR md.hpp
CPP_SRC md.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME mma7361
CPP_SRC mma7361.cxx
FTI_SRC mma7361_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -24,6 +24,7 @@
#include <iostream>
#include <stdexcept>
#include <string>
#include "mma7361.hpp"
@ -66,7 +67,7 @@ bool MMA7361::isInFreefall()
{
throw std::runtime_error(string(__FUNCTION__)
+ ": mma7361_freefall() failed with UPM error "
+ std::to_string(int(rv)) );
+ to_string(int(rv)) );
}
return freefall;
@ -80,7 +81,7 @@ void MMA7361::enableSelftest(bool enable)
{
throw std::runtime_error(string(__FUNCTION__)
+ ": mma7361_selftest() failed with UPM error "
+ std::to_string(int(rv)) );
+ to_string(int(rv)) );
}
}
@ -92,7 +93,7 @@ void MMA7361::update()
{
throw std::runtime_error(string(__FUNCTION__)
+ ": mma7361_update() failed with UPM error "
+ std::to_string(int(rv)) );
+ to_string(int(rv)) );
}
}

View File

@ -1,5 +1,7 @@
set (libname "mmc35240")
set (libdescription "mmc35240 sensor module")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
if (MRAA_IIO_FOUND)
set (libname "mmc35240")
set (libdescription "mmc35240 sensor module")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
endif (MRAA_IIO_FOUND)

View File

@ -801,23 +801,6 @@ namespace upm {
*/
void getGyroscope(float *x, float *y, float *z);
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
/**
* get the accelerometer values
*
* @return Array containing X, Y, Z accelerometer values
*/
float *getAccelerometer();
/**
* get the gyroscope values
*
* @return Array containing X, Y, Z gyroscope values
*/
float *getGyroscope();
#endif
/**
* get the temperature value
*

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ms5803
CPP_SRC ms5803.cxx
FTI_SRC ms5803_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME my9221
CPP_HDR my9221.hpp groveledbar.hpp grovecircularled.hpp
CPP_SRC my9221.cxx groveledbar.cxx grovecircularled.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME nmea_gps
CPP_SRC nmea_gps.cxx
FTI_SRC nmea_gps_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,8 +1,13 @@
%module(directors="1") javaupm_nrf24l01
%include "../upm.i"
%feature("director") Callback;
SWIG_DIRECTOR_OWNED(Callback)
#ifdef ANDROID
%module javaupm_nrf24l01
#else
%module(directors="1") javaupm_nrf24l01
%feature("director") Callback;
SWIG_DIRECTOR_OWNED(Callback)
#endif
%include "arrays_java.i";
%apply signed char[] {uint8_t *};
@ -23,4 +28,4 @@ SWIG_DIRECTOR_OWNED(Callback)
System.exit(1);
}
}
%}
%}

View File

@ -28,6 +28,7 @@
*/
#include <stdexcept>
#include <string>
#include <syslog.h>
#include "hal_platform.h"

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME nunchuck
CPP_SRC nunchuck.cxx
FTI_SRC nunchuck_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME otp538u
CPP_SRC otp538u.cxx
FTI_SRC otp538u_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -26,7 +26,7 @@
#include "otp538u.h"
#include "upm_fti.h"
#include "upm_sensor.h"
#include "fti/upm_sensor.h"
/**
* This file implements the Function Table Interface (FTI) for this sensor

View File

@ -1,25 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.mraa.upm</groupId>
<artifactId>upm_@libname@</artifactId>
<groupId>@pom_groupId@</groupId>
<artifactId>upm_@target@</artifactId>
<version>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</version>
<packaging>jar</packaging>
<name>@libname@</name>
<description>High level repository for sensors that use mraa</description>
<packaging>@pom_packaging@</packaging>
<name>@target@</name>
<description>@libdescription@</description>
<url>http://upm.mraa.io</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/intel-iot-devkit/upm/blob/master/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<name>Upm contributors https://github.com/intel-iot-devkit/upm/graphs/contributors</name>
@ -28,20 +22,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<organizationUrl>https://github.com/intel-iot-devkit</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/intel-iot-devkit/upm.git</connection>
<developerConnection>scm:git:ssh://github.com:intel-iot-devkit/upm.git</developerConnection>
<url>https://github.com/intel-iot-devkit/upm/tree/master</url>
</scm>
<dependencies>
<dependency>
<groupId>io.mraa</groupId>
<artifactId>mraa</artifactId>
<version>[@MRAA_MINIMUM@, )</version>
<scope>compile</scope>
</dependency>
<dependencies>@pom_dependencies@
</dependencies>
</project>

View File

@ -5,5 +5,5 @@ upm_mixed_module_init (NAME ppd42ns
CPP_HDR ppd42ns.hpp
CPP_SRC ppd42ns.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)
target_link_libraries(${libnamec} m)

View File

@ -1,9 +1,16 @@
%module(directors="1") javaupm_pulsensor
#ifdef ANDROID
%module javaupm_pulsensor
#else
%module(directors="1") javaupm_pulsensor
#endif
%include "../upm.i"
%include "arrays_java.i"
%feature("director") Callback;
SWIG_DIRECTOR_OWNED(Callback)
#ifndef ANDROID
%feature("director") Callback;
SWIG_DIRECTOR_OWNED(Callback)
#endif
%ignore sample_thread;
%ignore pin_ctx;
@ -26,4 +33,4 @@ SWIG_DIRECTOR_OWNED(Callback)
System.exit(1);
}
}
%}
%}

View File

@ -1,4 +1,9 @@
%module(directors="1") javaupm_rf22
#ifdef ANDROID
%module javaupm_rf22
#else
%module(directors="1") javaupm_rf22
#endif
%include "../upm.i"
%include "arrays_java.i"
%include "typemaps.i"
@ -21,4 +26,4 @@
System.exit(1);
}
}
%}
%}

View File

@ -28,7 +28,7 @@
#include <stdlib.h>
#include "upm_fti.h"
#include "upm_sensor.h"
#include "fti/upm_sensor.h"
/**
* This file implements the Function Table Interface (FTI) for this sensor

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME rsc
CPP_HDR rsc.hpp
CPP_SRC rsc.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME servo
CPP_SRC servo.cxx es08a.cxx es9257.cxx
FTI_SRC es08a_fti.c es9257_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME sht1x
CPP_SRC sht1x.cxx
FTI_SRC sht1x_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,4 +1,9 @@
%module(directors="1") javaupm_si1132
#ifdef ANDROID
%module javaupm_si1132
#else
%module(directors="1") javaupm_si1132
#endif
%include "../upm.i"
%include "../interfaces/javaupm_iLightSensor.i"

View File

@ -22,6 +22,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string>
#include "mraa-utils.hpp"
#include "mraa/gpio.hpp"

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME speaker
CPP_SRC speaker.cxx
# FTI_SRC speaker_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -27,7 +27,6 @@
#include <string>
#include <mraa/common.hpp>
#include <mraa/gpio.hpp>
#include <mraa/spi.hpp>
#include "ssd1351_gfx.hpp"

View File

@ -1,6 +1,9 @@
set (libname "stepmotor")
set (libdescription "Stepper Motor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
target_link_libraries(${libname} rt)
# Currently no librt in android
if (NOT ANDROID)
set (libname "stepmotor")
set (libdescription "Stepper Motor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init(mraa)
target_link_libraries(${libname} rt)
endif (NOT ANDROID)

View File

@ -29,7 +29,7 @@
#include "temperature.h"
#include "upm_fti.h"
#include "upm_sensor.h"
#include "fti/upm_sensor.h"
/**
* This file implements the Function Table Interface (FTI) for this sensor

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME tsl2561
CPP_SRC tsl2561.cxx
FTI_SRC tsl2561_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME uartat
CPP_HDR uartat.hpp
CPP_SRC uartat.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME uln200xa
CPP_HDR uln200xa.hpp
CPP_SRC uln200xa.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -6,4 +6,4 @@ upm_mixed_module_init (NAME urm37
CPP_SRC urm37.cxx
FTI_SRC urm37_fti.c
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)

View File

@ -1,4 +1,6 @@
upm_mixed_module_init (NAME utilities
DESCRIPTION "C Utilities Library"
DESCRIPTION "Utilities Library"
CPP_HDR upm_utilities.hpp
CPP_SRC upm_utilities.cxx
C_HDR upm_utilities.h
C_SRC upm_utilities.c)

View File

@ -0,0 +1,12 @@
%module javaupm_utilities
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_utilities");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -0,0 +1 @@
%module jsupm_utilities

View File

@ -0,0 +1 @@
%module pyupm_utilities

View File

View File

View File

@ -5,4 +5,4 @@ upm_mixed_module_init (NAME wfs
CPP_HDR wfs.hpp
CPP_SRC wfs.cxx
CPP_WRAPS_C
REQUIRES mraa)
REQUIRES mraa utilities-c)