mirror of
https://github.com/eclipse/upm.git
synced 2025-03-14 20:47:30 +03:00
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:
parent
b2aa2515b0
commit
0bd68e4e2b
@ -95,7 +95,7 @@ set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation -Wno-strict-aliasing)
|
|||||||
|
|
||||||
# Warnings as errors?
|
# Warnings as errors?
|
||||||
if (WERROR)
|
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")
|
message (STATUS "Warnings as errors enabled (-Werror), disable with -DWERROR=off")
|
||||||
endif (WERROR)
|
endif (WERROR)
|
||||||
|
|
||||||
@ -113,6 +113,11 @@ upm_add_compile_flags(CXX ${C_CXX_WARNING_FLAGS}
|
|||||||
-Woverloaded-virtual
|
-Woverloaded-virtual
|
||||||
-Wreorder)
|
-Wreorder)
|
||||||
|
|
||||||
|
# Allow exception error handling for Android C++
|
||||||
|
if (ANDROID)
|
||||||
|
upm_add_compile_flags(CXX -fexceptions)
|
||||||
|
endif (ANDROID)
|
||||||
|
|
||||||
find_package (Threads REQUIRED)
|
find_package (Threads REQUIRED)
|
||||||
find_package (PkgConfig REQUIRED)
|
find_package (PkgConfig REQUIRED)
|
||||||
|
|
||||||
@ -121,7 +126,13 @@ unset(MRAA_FOUND CACHE)
|
|||||||
set(MRAA_MINIMUM 1.6.1)
|
set(MRAA_MINIMUM 1.6.1)
|
||||||
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
|
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
|
||||||
# Also, get full path to the mraa library
|
# 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
|
# Check for BACNET
|
||||||
pkg_check_modules (BACNET libbacnet)
|
pkg_check_modules (BACNET libbacnet)
|
||||||
@ -146,7 +157,7 @@ if (BUILDSWIGJAVA)
|
|||||||
find_package (JNI REQUIRED)
|
find_package (JNI REQUIRED)
|
||||||
pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0)
|
pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0)
|
||||||
# Also, get full path to the mraajava library
|
# 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)
|
endif (BUILDSWIGJAVA)
|
||||||
|
|
||||||
# Find swig if any wrapper is enabled
|
# Find swig if any wrapper is enabled
|
||||||
@ -415,12 +426,10 @@ if (RPM)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# UPM common headers
|
# UPM common headers
|
||||||
set (UPM_COMMON_HEADER_DIRS
|
set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include)
|
||||||
${CMAKE_HOME_DIRECTORY}/include
|
|
||||||
${CMAKE_HOME_DIRECTORY}/include/fti
|
|
||||||
${CMAKE_BINARY_DIR}/src)
|
|
||||||
|
|
||||||
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
|
# UPM source
|
||||||
add_subdirectory (src)
|
add_subdirectory (src)
|
||||||
|
@ -50,6 +50,11 @@ function (add_example example_src)
|
|||||||
# Parse function parameters
|
# Parse function parameters
|
||||||
cmake_parse_arguments(add_example "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
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
|
# Get the base filename from the full filename
|
||||||
# For file /some/path/to/sensorfoo-bar.c, example_name = sensorfoo-bar
|
# For file /some/path/to/sensorfoo-bar.c, example_name = sensorfoo-bar
|
||||||
get_filename_component(example_name ${example_src} NAME_WE)
|
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
|
# If a dependency target does NOT exist, print a warning and skip
|
||||||
foreach(_dep_target ${lib_target_names})
|
foreach(_dep_target ${lib_target_names})
|
||||||
if (NOT TARGET ${_dep_target})
|
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()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
@ -96,10 +101,6 @@ function (add_example example_src)
|
|||||||
foreach(_dep_target ${lib_target_names})
|
foreach(_dep_target ${lib_target_names})
|
||||||
target_link_libraries(${this_target_name} ${_dep_target} ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(${this_target_name} ${_dep_target} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endforeach ()
|
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)
|
endfunction (add_example example_src)
|
||||||
|
|
||||||
# Add subdirectories if BUILDEXAMPLES=on
|
# Add subdirectories if BUILDEXAMPLES=on
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "jhd1313m1.hpp"
|
#include "jhd1313m1.hpp"
|
||||||
|
#include "upm_utilities.h"
|
||||||
|
|
||||||
int shouldRun = true;
|
int shouldRun = true;
|
||||||
|
|
||||||
@ -64,7 +67,7 @@ main(int argc, char **argv)
|
|||||||
// Echo via printf
|
// Echo via printf
|
||||||
printf("Hello World %d rgb: 0x%02x%02x%02x\n", ndx++, r, g, b);
|
printf("Hello World %d rgb: 0x%02x%02x%02x\n", ndx++, r, g, b);
|
||||||
|
|
||||||
sleep(1);
|
upm_delay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
@ -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 -------------
|
# - Create an executable for all other src files in this directory -------------
|
||||||
foreach (_example_src ${example_src_list})
|
foreach (_example_src ${example_src_list})
|
||||||
add_example(${_example_src} SUFFIX "-c")
|
add_example(${_example_src} TARGETS utilities-c SUFFIX "-c")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
@ -111,7 +111,9 @@ add_example(RotaryEncoderSample rotaryencoder)
|
|||||||
add_example(RPR220_intrSample rpr220)
|
add_example(RPR220_intrSample rpr220)
|
||||||
add_example(RPR220Sample rpr220)
|
add_example(RPR220Sample rpr220)
|
||||||
add_example(ST7735Sample st7735)
|
add_example(ST7735Sample st7735)
|
||||||
add_example(StepMotorSample stepmotor)
|
if (NOT ANDROID)
|
||||||
|
add_example(StepMotorSample stepmotor)
|
||||||
|
endif ()
|
||||||
add_example(TM1637Sample tm1637)
|
add_example(TM1637Sample tm1637)
|
||||||
add_example(TP401Sample gas)
|
add_example(TP401Sample gas)
|
||||||
add_example(TSL2561Sample tsl2561)
|
add_example(TSL2561Sample tsl2561)
|
||||||
@ -145,7 +147,9 @@ if (BACNET_FOUND)
|
|||||||
add_example(T8100_Example t8100)
|
add_example(T8100_Example t8100)
|
||||||
add_example(TB7300_Example tb7300)
|
add_example(TB7300_Example tb7300)
|
||||||
endif()
|
endif()
|
||||||
add_example(VCAP_Example vcap)
|
if (JPEG_FOUND)
|
||||||
|
add_example(VCAP_Example vcap)
|
||||||
|
endif()
|
||||||
add_example(BMP280_Example bmp280)
|
add_example(BMP280_Example bmp280)
|
||||||
add_example(BNO055_Example bno055)
|
add_example(BNO055_Example bno055)
|
||||||
add_example(BMX055_Example bmx055)
|
add_example(BMX055_Example bmx055)
|
||||||
|
@ -34,13 +34,14 @@ public class MPU9150Sample {
|
|||||||
while (true) {
|
while (true) {
|
||||||
sensor.update();
|
sensor.update();
|
||||||
|
|
||||||
float[] accel = sensor.getAccelerometer();
|
// These don't exist
|
||||||
System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
|
// float[] accel = sensor.getAccelerometer();
|
||||||
+ accel[2]);
|
// 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: "
|
// float[] gyro = sensor.getGyroscope();
|
||||||
+ gyro[2]);
|
// System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
|
||||||
|
// + gyro[2]);
|
||||||
|
|
||||||
float[] magn = sensor.getMagnetometer();
|
float[] magn = sensor.getMagnetometer();
|
||||||
System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
|
System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
|
||||||
@ -50,4 +51,4 @@ public class MPU9150Sample {
|
|||||||
}
|
}
|
||||||
// ! [Interesting]
|
// ! [Interesting]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#ifndef UPM_FTI_H_
|
#ifndef UPM_FTI_H_
|
||||||
#define UPM_FTI_H_
|
#define UPM_FTI_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,6 +9,11 @@ set (SWIG_CXX_DISABLE_WARNINGS -Wno-error
|
|||||||
-Wno-maybe-uninitialized
|
-Wno-maybe-uninitialized
|
||||||
-Wno-strict-aliasing)
|
-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)
|
macro (file_to_list readfile outlist)
|
||||||
FILE(READ "${readfile}" contents)
|
FILE(READ "${readfile}" contents)
|
||||||
STRING(REGEX REPLACE ";" "\\\\;" contents "${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})
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
|
||||||
endmacro(upm_create_install_pkgconfig)
|
endmacro(upm_create_install_pkgconfig)
|
||||||
|
|
||||||
# This function iterates over all target names stored in CACHE variable
|
# Given a target name, return all in-project targets ALREADY defined (ie, this
|
||||||
# UPM_LIBRARY_TARGETS and writes a .pc file to each build directory
|
# does not comprehend targets that have yet to be added.
|
||||||
function (_gen_pkg_config_per_target)
|
function (_get_dependency_targets target return_variable)
|
||||||
list(LENGTH UPM_LIBRARY_TARGETS n_targets)
|
# Clear the variable
|
||||||
message(STATUS "Generating pkg-config files for ${n_targets} libraries...")
|
set(${return_variable} "")
|
||||||
set (n_ctargets 0)
|
|
||||||
set (n_cxxtargets 0)
|
# 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
|
# Iterate over the targets an build package config (.pc) files
|
||||||
foreach (target ${UPM_LIBRARY_TARGETS})
|
foreach (target ${ARGN})
|
||||||
if (TARGET ${target})
|
if (TARGET ${target})
|
||||||
get_target_property(libname ${target} PKG_CONFIG_NAME)
|
get_target_property(libname ${target} PKG_CONFIG_NAME)
|
||||||
get_target_property(libdescription ${target} PKG_CONFIG_DESCRIPTION)
|
get_target_property(libdescription ${target} PKG_CONFIG_DESCRIPTION)
|
||||||
get_target_property(reqlibname ${target} PKG_EXT_REQ_LIBS)
|
get_target_property(reqlibname ${target} PKG_EXT_REQ_LIBS)
|
||||||
get_target_property(BINARY_DIR ${target} BINARY_DIR)
|
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)
|
# Get a list of in-project dependency targets for this target
|
||||||
list(REMOVE_ITEM DEPLIBS ${libname})
|
_get_dependency_targets(${target} DEPLIBS)
|
||||||
|
|
||||||
# Check if any of the LINK_LIBRARIES are targets in this project,
|
# Check if any of the LINK_LIBRARIES are targets in this project,
|
||||||
# if so, add them to reqlibname
|
# if so, add them to reqlibname
|
||||||
foreach (deplib ${DEPLIBS})
|
foreach (deplib ${DEPLIBS})
|
||||||
# If this target exists, get the actual library name (which equates
|
# Get the actual library name (which equates to it's .pc filename,
|
||||||
# to it's .pc filename, example: target dfrph = <upm-dfrph>.pc
|
# example: target dfrph = <upm-dfrph>.pc
|
||||||
if (TARGET ${deplib})
|
if (TARGET ${deplib})
|
||||||
get_target_property(deplibname ${deplib} PKG_CONFIG_NAME)
|
get_target_property(deplibname ${deplib} PKG_CONFIG_NAME)
|
||||||
list(APPEND reqlibname ${deplibname})
|
list(APPEND reqlibname ${deplibname})
|
||||||
# If the deplib is mraa, add that verbatim (mraa's .pc file is mraa.pc)
|
|
||||||
elseif (${deplib} MATCHES mraa)
|
elseif (${deplib} MATCHES mraa)
|
||||||
list(APPEND reqlibname mraa)
|
list(APPEND reqlibname mraa)
|
||||||
endif (TARGET ${deplib})
|
endif (TARGET ${deplib})
|
||||||
@ -73,21 +106,100 @@ function (_gen_pkg_config_per_target)
|
|||||||
# Switch to comma separated Requires: field (per pkg-config docs)
|
# Switch to comma separated Requires: field (per pkg-config docs)
|
||||||
string(REPLACE ";" "," reqlibname "${reqlibname}")
|
string(REPLACE ";" "," reqlibname "${reqlibname}")
|
||||||
|
|
||||||
# Keep some stats
|
# Create the .pc file
|
||||||
string(REGEX MATCH "-c$" _isC ${target})
|
|
||||||
if (_isC)
|
|
||||||
MATH(EXPR n_ctargets "${n_ctargets}+1")
|
|
||||||
else ()
|
|
||||||
MATH(EXPR n_cxxtargets "${n_cxxtargets}+1")
|
|
||||||
endif()
|
|
||||||
upm_create_install_pkgconfig (${libname}.pc ${LIB_INSTALL_DIR}/pkgconfig)
|
upm_create_install_pkgconfig (${libname}.pc ${LIB_INSTALL_DIR}/pkgconfig)
|
||||||
endif (TARGET ${target})
|
endif (TARGET ${target})
|
||||||
endforeach (target ${UPM_LIBRARY_TARGETS})
|
endforeach (target ${ARGN})
|
||||||
message(STATUS "\tFound C libraries: ${n_ctargets}")
|
message(STATUS "Generating pkg-config files for ${n_targets} ${LABEL} libraries... Complete")
|
||||||
message(STATUS "\tFound CXX libraries: ${n_cxxtargets}")
|
|
||||||
message(STATUS "Generating pkg-config files for ${n_targets} libraries... Complete")
|
|
||||||
endfunction (_gen_pkg_config_per_target)
|
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)
|
function (_get_target_dependency_interface_include_dirs target varIncludeDirs)
|
||||||
set (${varIncludeDirs} "")
|
set (${varIncludeDirs} "")
|
||||||
|
|
||||||
@ -117,7 +229,8 @@ macro(_upm_swig_python)
|
|||||||
# wrapper generation. Get them manually and add them here.
|
# wrapper generation. Get them manually and add them here.
|
||||||
_get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS)
|
_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})
|
${DEPEND_DIRS})
|
||||||
|
|
||||||
set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
|
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)
|
swig_add_module (${python_wrapper_name} python pyupm_${libname}.i)
|
||||||
# Get target library name (example _pyupm_a110x-python2)
|
# Get target library name (example _pyupm_a110x-python2)
|
||||||
set (python_wrapper_target ${SWIG_MODULE_${python_wrapper_name}_REAL_NAME})
|
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})
|
swig_link_libraries (${python_wrapper_name} ${PYTHON_LIBRARIES} ${libname})
|
||||||
target_include_directories (${python_wrapper_target}
|
target_include_directories (${python_wrapper_target}
|
||||||
@ -196,6 +310,10 @@ macro(upm_swig_python)
|
|||||||
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
|
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
|
||||||
set(PYTHON_PACKAGES_PATH ${PYTHON2_PACKAGES_PATH})
|
set(PYTHON_PACKAGES_PATH ${PYTHON2_PACKAGES_PATH})
|
||||||
_upm_swig_python()
|
_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)
|
endif (PYTHON2LIBS_FOUND)
|
||||||
|
|
||||||
# Generate python3 module if python3 libs are available
|
# 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_VERSION_MINOR ${PYTHON3_VERSION_MINOR})
|
||||||
set(PYTHON_PACKAGES_PATH ${PYTHON3_PACKAGES_PATH})
|
set(PYTHON_PACKAGES_PATH ${PYTHON3_PACKAGES_PATH})
|
||||||
_upm_swig_python()
|
_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 (PYTHON3LIBS_FOUND)
|
||||||
endif (NOT ";${PYTHONSWIG_BLACKLIST};" MATCHES ";${libname};")
|
endif (NOT ";${PYTHONSWIG_BLACKLIST};" MATCHES ";${libname};")
|
||||||
endmacro(upm_swig_python)
|
endmacro(upm_swig_python)
|
||||||
@ -229,14 +351,14 @@ macro(upm_swig_node)
|
|||||||
# wrapper generation. Get them manually and add them here.
|
# wrapper generation. Get them manually and add them here.
|
||||||
_get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS)
|
_get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS)
|
||||||
|
|
||||||
include_directories (
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
${UPM_COMMON_HEADER_DIRS}
|
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||||
${DEPEND_DIRS}
|
${DEPEND_DIRS})
|
||||||
)
|
|
||||||
|
|
||||||
set_property (SOURCE jsupm_${libname}.i PROPERTY SWIG_FLAGS "-node" "-DV8_VERSION=${V8_VERSION_HEX}")
|
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)
|
set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
|
||||||
swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i)
|
swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i)
|
||||||
|
add_dependencies(jsupm_${libname} ${libname})
|
||||||
swig_link_libraries (jsupm_${libname} ${NODE_LIBRARIES} ${libname})
|
swig_link_libraries (jsupm_${libname} ${NODE_LIBRARIES} ${libname})
|
||||||
target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
|
target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
@ -277,6 +399,9 @@ macro(upm_swig_node)
|
|||||||
|
|
||||||
install (TARGETS jsupm_${libname} DESTINATION ${NODE_MODULE_INSTALL_PATH})
|
install (TARGETS jsupm_${libname} DESTINATION ${NODE_MODULE_INSTALL_PATH})
|
||||||
endif (NOT ";${NODESWIG_BLACKLIST};" MATCHES ";${libname};")
|
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)
|
endmacro(upm_swig_node)
|
||||||
|
|
||||||
macro(upm_swig_java)
|
macro(upm_swig_java)
|
||||||
@ -289,7 +414,8 @@ macro(upm_swig_java)
|
|||||||
include_directories (
|
include_directories (
|
||||||
${JAVA_INCLUDE_PATH}
|
${JAVA_INCLUDE_PATH}
|
||||||
${JAVA_INCLUDE_PATH2}
|
${JAVA_INCLUDE_PATH2}
|
||||||
${UPM_COMMON_HEADER_DIRS}
|
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||||
${DEPEND_DIRS}
|
${DEPEND_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -302,7 +428,8 @@ macro(upm_swig_java)
|
|||||||
# See issue #518
|
# See issue #518
|
||||||
# TODO: Fix this somehow
|
# TODO: Fix this somehow
|
||||||
swig_add_module (javaupm_${libname} java javaupm_${libname}.i ${module_src})
|
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}
|
target_include_directories ( ${SWIG_MODULE_javaupm_${libname}_REAL_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${JAVA_INCLUDE_DIRS}"
|
"${JAVA_INCLUDE_DIRS}"
|
||||||
@ -347,8 +474,8 @@ macro(upm_swig_java)
|
|||||||
COMMAND ${JAR} cvf upm_${libname}.jar upm_${libname}
|
COMMAND ${JAR} cvf upm_${libname}.jar upm_${libname}
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/../pom.xml.in
|
# Keep track of all JAVA targets
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/upm_${libname}-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.pom)
|
set(UPM_TARGETS_JAVA ${UPM_TARGETS_JAVA} javaupm_${libname} CACHE INTERNAL "List of JAVA target names")
|
||||||
endif (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};")
|
endif (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};")
|
||||||
endmacro(upm_swig_java)
|
endmacro(upm_swig_java)
|
||||||
|
|
||||||
@ -483,11 +610,6 @@ function (UPM_MIXED_MODULE_INIT)
|
|||||||
set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC})
|
set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC})
|
||||||
set (module_hpp ${UPM_MIXED_MODULE_INIT_C_HDR})
|
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 building FTI, and FTI src exists, add it in
|
||||||
if (BUILDFTI AND UPM_MIXED_MODULE_INIT_FTI_SRC)
|
if (BUILDFTI AND UPM_MIXED_MODULE_INIT_FTI_SRC)
|
||||||
#set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC} ${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)
|
set (IS_C_LIBRARY TRUE)
|
||||||
upm_module_init(${UPM_MIXED_MODULE_INIT_REQUIRES})
|
upm_module_init(${UPM_MIXED_MODULE_INIT_REQUIRES})
|
||||||
|
|
||||||
# add upmc-utilities as a dependancy to all C libs (but NOT to the
|
# If a c target has a dependency on utilities-c, then swap the corresponding
|
||||||
# utilities lib itself)
|
# C++ target's dependency on utilities-c to utilities. This solves a niche
|
||||||
if (NOT ${libname} MATCHES "utilities-c")
|
# problem for Android Things (C++ which depends on C which depends on
|
||||||
target_link_libraries (${libname} utilities-c)
|
# utilities-c is not getting the utilities-c library). Since only C++
|
||||||
endif()
|
# 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
|
## "export" the logical C lib target for the calling module's
|
||||||
## CMakeLists.txt
|
## 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
|
# If this is a C library, export C library target name to parent's libname
|
||||||
set (libname ${libname} PARENT_SCOPE)
|
set (libname ${libname} PARENT_SCOPE)
|
||||||
set (libprefix upmc-)
|
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 ()
|
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-)
|
set (libprefix upm-)
|
||||||
endif (IS_C_LIBRARY)
|
endif (IS_C_LIBRARY)
|
||||||
|
|
||||||
# Create the target library from src/hdrs
|
# Create the target library from src/hdrs
|
||||||
add_library (${libname} SHARED ${module_src} ${module_hpp})
|
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.
|
# Specify the current source directory as an INTERFACE include dir.
|
||||||
# This allows for transitive header dependencies via target_link_libraries
|
# This allows for transitive header dependencies via target_link_libraries
|
||||||
target_include_directories(${libname} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
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.
|
# Iterate over all arguments passed to upm_module_init.
|
||||||
# 1. Add them via target_link_libraries
|
# 1. Add them via target_link_libraries
|
||||||
# 2. If mraa, then add a link and include dependency
|
# 2. If mraa, then add a link and include dependency
|
||||||
@ -594,8 +725,7 @@ function(upm_module_init)
|
|||||||
endif (BUILDSWIGJAVA)
|
endif (BUILDSWIGJAVA)
|
||||||
endif (NOT IS_C_LIBRARY)
|
endif (NOT IS_C_LIBRARY)
|
||||||
|
|
||||||
# Add this target to the list of library target names
|
# Add additional properties to this target (used later for .pc file creation)
|
||||||
set(UPM_LIBRARY_TARGETS ${UPM_LIBRARY_TARGETS} ${libname} CACHE INTERNAL "List of ALL target names")
|
|
||||||
set_target_properties(${libname} PROPERTIES PKG_CONFIG_NAME "${libprefix}${basename}")
|
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_CONFIG_DESCRIPTION "${libdescription}")
|
||||||
set_target_properties(${libname} PROPERTIES PKG_EXT_REQ_LIBS "${reqlibname}")
|
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")
|
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub")
|
||||||
endif (BUILDDOC AND BUILDSWIGPYTHON)
|
endif (BUILDDOC AND BUILDSWIGPYTHON)
|
||||||
|
|
||||||
# Provide a cached variable to save a list of library target names
|
# Provide a cached variable to groups of targets
|
||||||
set(UPM_LIBRARY_TARGETS "" CACHE INTERNAL "List of ALL target names")
|
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
|
# Add subdirectories from MODULE_LIST if defined
|
||||||
# Example -DMODULE_LIST="dfrph;rotaryencoder"
|
# Example -DMODULE_LIST="dfrph;rotaryencoder"
|
||||||
@ -674,5 +809,14 @@ foreach(subdir ${SUBDIRS})
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# Print stats for all targets
|
||||||
|
_print_target_summary()
|
||||||
|
|
||||||
# Generate a pkg-config file (.pc) per target
|
# 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)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
set (libname "apds9930")
|
if (MRAA_IIO_FOUND)
|
||||||
set (libdescription "Digital Ambient Light and Proximity Sensor")
|
set (libname "apds9930")
|
||||||
set (module_src ${libname}.cxx)
|
set (libdescription "Digital Ambient Light and Proximity Sensor")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_src ${libname}.cxx)
|
||||||
upm_module_init(mraa)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
endif (MRAA_IIO_FOUND)
|
||||||
|
@ -285,7 +285,7 @@ BACNETMSTP* BACNETMSTP::instance()
|
|||||||
return m_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 deviceInstanceID, int macAddr, int maxMaster,
|
||||||
int maxInfoFrames)
|
int maxInfoFrames)
|
||||||
{
|
{
|
||||||
@ -305,7 +305,7 @@ void BACNETMSTP::initMaster(std::string port, int baudRate,
|
|||||||
if ( !(baudRate == 9600 || baudRate == 19200 || baudRate == 38400
|
if ( !(baudRate == 9600 || baudRate == 19200 || baudRate == 38400
|
||||||
|| baudRate == 57600 || baudRate == 76800 || baudRate == 115200) )
|
|| baudRate == 57600 || baudRate == 76800 || baudRate == 115200) )
|
||||||
{
|
{
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": baudRate must be 9600, 19200, 38400, "
|
+ ": baudRate must be 9600, 19200, 38400, "
|
||||||
+ " 57600, 76800, or 115200");
|
+ " 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
|
// maxMaster must be less than or equal to 127
|
||||||
if (maxMaster < 0 || maxMaster > DEFAULT_MAX_MASTER)
|
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 "
|
+ ": 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
|
// As a master ourselves, we must have a MAC address also within the
|
||||||
// constraints of maxMaster
|
// constraints of maxMaster
|
||||||
if (macAddr < 0 || macAddr > DEFAULT_MAX_MASTER)
|
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 "
|
+ ": macAddr must be between 0 and "
|
||||||
+ std::to_string(DEFAULT_MAX_MASTER));
|
+ to_string(DEFAULT_MAX_MASTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should be unique on the network
|
// this should be unique on the network
|
||||||
if (deviceInstanceID >= BACNET_MAX_INSTANCE)
|
if (deviceInstanceID >= BACNET_MAX_INSTANCE)
|
||||||
{
|
{
|
||||||
throw std::out_of_range(std::string(__FUNCTION__)
|
throw out_of_range(string(__FUNCTION__)
|
||||||
+ ": deviceInstanceID must be less than "
|
+ ": deviceInstanceID must be less than "
|
||||||
+ std::to_string(BACNET_MAX_INSTANCE)
|
+ to_string(BACNET_MAX_INSTANCE)
|
||||||
+ ", and must be unique on the network");
|
+ ", and must be unique on the network");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ bool BACNETMSTP::dispatchRequest()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
syslog(LOG_WARNING, "%s: switch case not defined",
|
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))
|
else if (tsm_invoke_id_free(m_invokeID))
|
||||||
@ -584,9 +584,9 @@ bool BACNETMSTP::readProperty(uint32_t targetDeviceInstanceID,
|
|||||||
// some sanity checking...
|
// some sanity checking...
|
||||||
if (objInstance >= BACNET_MAX_INSTANCE)
|
if (objInstance >= BACNET_MAX_INSTANCE)
|
||||||
{
|
{
|
||||||
throw std::out_of_range(std::string(__FUNCTION__)
|
throw out_of_range(string(__FUNCTION__)
|
||||||
+ ": objInstance must be less than "
|
+ ": objInstance must be less than "
|
||||||
+ std::to_string(BACNET_MAX_INSTANCE));
|
+ to_string(BACNET_MAX_INSTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill in the command structure and dispatch
|
// fill in the command structure and dispatch
|
||||||
@ -620,9 +620,9 @@ bool BACNETMSTP::writeProperty(uint32_t targetDeviceInstanceID,
|
|||||||
// some sanity checking...
|
// some sanity checking...
|
||||||
if (objInstance >= BACNET_MAX_INSTANCE)
|
if (objInstance >= BACNET_MAX_INSTANCE)
|
||||||
{
|
{
|
||||||
throw std::out_of_range(std::string(__FUNCTION__)
|
throw out_of_range(string(__FUNCTION__)
|
||||||
+ ": objInstance must be less than "
|
+ ": objInstance must be less than "
|
||||||
+ std::to_string(BACNET_MAX_INSTANCE));
|
+ to_string(BACNET_MAX_INSTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill in the command structure and dispatch
|
// fill in the command structure and dispatch
|
||||||
@ -681,9 +681,9 @@ float BACNETMSTP::getDataTypeReal(int index)
|
|||||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||||
return float(getDataTypeSignedInt(index));
|
return float(getDataTypeSignedInt(index));
|
||||||
default:
|
default:
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to Real");
|
+ ") is not convertible to Real");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,9 +694,9 @@ bool BACNETMSTP::getDataTypeBoolean(int index)
|
|||||||
if (getDataType(index) == BACNET_APPLICATION_TAG_BOOLEAN)
|
if (getDataType(index) == BACNET_APPLICATION_TAG_BOOLEAN)
|
||||||
return ((m_returnedValue.at(index).type.Boolean) ? true : false);
|
return ((m_returnedValue.at(index).type.Boolean) ? true : false);
|
||||||
else
|
else
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to Bool");
|
+ ") is not convertible to Bool");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,9 +705,9 @@ unsigned int BACNETMSTP::getDataTypeUnsignedInt(int index)
|
|||||||
if (getDataType(index) == BACNET_APPLICATION_TAG_UNSIGNED_INT)
|
if (getDataType(index) == BACNET_APPLICATION_TAG_UNSIGNED_INT)
|
||||||
return m_returnedValue.at(index).type.Unsigned_Int;
|
return m_returnedValue.at(index).type.Unsigned_Int;
|
||||||
else
|
else
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to UnsignedInt");
|
+ ") is not convertible to UnsignedInt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,9 +716,9 @@ int BACNETMSTP::getDataTypeSignedInt(int index)
|
|||||||
if (getDataType(index) == BACNET_APPLICATION_TAG_SIGNED_INT)
|
if (getDataType(index) == BACNET_APPLICATION_TAG_SIGNED_INT)
|
||||||
return m_returnedValue.at(index).type.Signed_Int;
|
return m_returnedValue.at(index).type.Signed_Int;
|
||||||
else
|
else
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to SignedInt");
|
+ ") is not convertible to SignedInt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -744,9 +744,9 @@ double BACNETMSTP::getDataTypeDouble(int index)
|
|||||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||||
return double(getDataTypeSignedInt(index));
|
return double(getDataTypeSignedInt(index));
|
||||||
default:
|
default:
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to Double");
|
+ ") is not convertible to Double");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,35 +758,35 @@ unsigned int BACNETMSTP::getDataTypeEnum(int index)
|
|||||||
if (getDataType(index) == BACNET_APPLICATION_TAG_ENUMERATED)
|
if (getDataType(index) == BACNET_APPLICATION_TAG_ENUMERATED)
|
||||||
return m_returnedValue.at(index).type.Enumerated;
|
return m_returnedValue.at(index).type.Enumerated;
|
||||||
else
|
else
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to Enum");
|
+ ") 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
|
// Here, we can try to accomodate all the types
|
||||||
switch(getDataType(index))
|
switch(getDataType(index))
|
||||||
{
|
{
|
||||||
case BACNET_APPLICATION_TAG_REAL:
|
case BACNET_APPLICATION_TAG_REAL:
|
||||||
retval = std::to_string(getDataTypeReal(index));
|
retval = to_string(getDataTypeReal(index));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(BACAPP_DOUBLE)
|
#if defined(BACAPP_DOUBLE)
|
||||||
case BACNET_APPLICATION_TAG_DOUBLE:
|
case BACNET_APPLICATION_TAG_DOUBLE:
|
||||||
retval = std::to_string(getDataTypeDouble(index));
|
retval = to_string(getDataTypeDouble(index));
|
||||||
break;
|
break;
|
||||||
#endif // BACAPP_DOUBLE
|
#endif // BACAPP_DOUBLE
|
||||||
|
|
||||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||||
retval = std::to_string(getDataTypeUnsignedInt(index));
|
retval = to_string(getDataTypeUnsignedInt(index));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||||
retval = std::to_string(getDataTypeSignedInt(index));
|
retval = to_string(getDataTypeSignedInt(index));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BACNET_APPLICATION_TAG_BOOLEAN:
|
case BACNET_APPLICATION_TAG_BOOLEAN:
|
||||||
@ -801,7 +801,7 @@ std::string BACNETMSTP::getDataTypeString(int index)
|
|||||||
|
|
||||||
case BACNET_APPLICATION_TAG_OCTET_STRING:
|
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));
|
octetstring_length(&m_returnedValue.at(index).type.Octet_String));
|
||||||
retval = string2HexString(tmpstr);
|
retval = string2HexString(tmpstr);
|
||||||
@ -829,9 +829,9 @@ std::string BACNETMSTP::getDataTypeString(int index)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": data type ("
|
+ ": data type ("
|
||||||
+ std::to_string(int(getDataType(index)))
|
+ to_string(int(getDataType(index)))
|
||||||
+ ") is not convertible to String");
|
+ ") is not convertible to String");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -891,9 +891,9 @@ BACNET_APPLICATION_DATA_VALUE BACNETMSTP::createDataString(string value)
|
|||||||
{
|
{
|
||||||
if (value.size() > (MAX_CHARACTER_STRING_BYTES - 1))
|
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 "
|
+ ": 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");
|
+ " characters long");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 deviceInstanceID, int macAddr, int maxMaster,
|
||||||
int maxInfoFrames)
|
int maxInfoFrames)
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (reliability): " << getAllErrorString()
|
cerr << __FUNCTION__ << ": (reliability): " << getAllErrorString()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": Reliability check failed");
|
+ ": Reliability check failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ float BACNETUTIL::getAnalogValue(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (value): " << getAllErrorString()
|
cerr << __FUNCTION__ << ": (value): " << getAllErrorString()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void BACNETUTIL::setAnalogValue(uint32_t objInstance,
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (reliability): "
|
cerr << __FUNCTION__ << ": (reliability): "
|
||||||
<< getAllErrorString() << endl;
|
<< getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": Reliability check failed");
|
+ ": Reliability check failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ float BACNETUTIL::getAnalogInput(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (reliability): "
|
cerr << __FUNCTION__ << ": (reliability): "
|
||||||
<< getAllErrorString() << endl;
|
<< getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": Reliability check failed");
|
+ ": Reliability check failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ bool BACNETUTIL::getBinaryInput(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (reliability): "
|
cerr << __FUNCTION__ << ": (reliability): "
|
||||||
<< getAllErrorString() << endl;
|
<< getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": Reliability check failed");
|
+ ": Reliability check failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ bool BACNETUTIL::getBinaryValue(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ void BACNETUTIL::setBinaryValue(uint32_t objInstance,
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
|
|||||||
cerr << __FUNCTION__ << ": (reliability): "
|
cerr << __FUNCTION__ << ": (reliability): "
|
||||||
<< getAllErrorString() << endl;
|
<< getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
cerr << __FUNCTION__ << ": Reliability check failed" << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": Reliability check failed");
|
+ ": Reliability check failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ unsigned int BACNETUTIL::getMultiStateValue(uint32_t objInstance)
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": (value): " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -451,7 +451,7 @@ void BACNETUTIL::updateMultiStateValueInfo(uint32_t objInstance)
|
|||||||
<< getAllErrorString()
|
<< getAllErrorString()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -525,10 +525,10 @@ string BACNETUTIL::lookupMultiStateValueText(uint32_t objInstance,
|
|||||||
|
|
||||||
// verify that value is valid for this object
|
// verify that value is valid for this object
|
||||||
if (value == 0 || value > m_msvInfo[objInstance].numStates)
|
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 "
|
+ ": value supplied is invalid. Maximum "
|
||||||
+ "allowed values are 1 to "
|
+ "allowed values are 1 to "
|
||||||
+ std::to_string(m_msvInfo[objInstance].numStates)
|
+ to_string(m_msvInfo[objInstance].numStates)
|
||||||
+ " for this object");
|
+ " for this object");
|
||||||
|
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ string BACNETUTIL::lookupMultiStateValueText(uint32_t objInstance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no stateList text available, so just return value as a string
|
// 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)
|
unsigned int BACNETUTIL::getMultiStateValueMaxStates(uint32_t objInstance)
|
||||||
@ -576,10 +576,10 @@ void BACNETUTIL::setMultiStateValue(uint32_t objInstance,
|
|||||||
// Check value against the valid limits
|
// Check value against the valid limits
|
||||||
|
|
||||||
if (value == 0 || value > m_msvInfo[objInstance].numStates)
|
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 "
|
+ ": value supplied is invalid. Maximum "
|
||||||
+ "allowed values are 1 to "
|
+ "allowed values are 1 to "
|
||||||
+ std::to_string(m_msvInfo[objInstance].numStates)
|
+ to_string(m_msvInfo[objInstance].numStates)
|
||||||
+ " for this object");
|
+ " for this object");
|
||||||
|
|
||||||
// Write the value
|
// Write the value
|
||||||
@ -596,7 +596,7 @@ void BACNETUTIL::setMultiStateValue(uint32_t objInstance,
|
|||||||
if (m_debugging)
|
if (m_debugging)
|
||||||
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
cerr << __FUNCTION__ << ": " << getAllErrorString() << endl;
|
||||||
|
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw runtime_error(string(__FUNCTION__)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ getAllErrorString());
|
+ getAllErrorString());
|
||||||
}
|
}
|
||||||
@ -772,7 +772,7 @@ uint8_t BACNETUTIL::getRejectReason()
|
|||||||
return m_instance->getRejectReason();
|
return m_instance->getRejectReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BACNETUTIL::getRejectString()
|
string BACNETUTIL::getRejectString()
|
||||||
{
|
{
|
||||||
return m_instance->getRejectString();
|
return m_instance->getRejectString();
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ uint8_t BACNETUTIL::getAbortReason()
|
|||||||
return m_instance->getAbortReason();
|
return m_instance->getAbortReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BACNETUTIL::getAbortString()
|
string BACNETUTIL::getAbortString()
|
||||||
{
|
{
|
||||||
return m_instance->getAbortString();
|
return m_instance->getAbortString();
|
||||||
}
|
}
|
||||||
@ -797,12 +797,12 @@ BACNET_ERROR_CODE BACNETUTIL::getErrorCode()
|
|||||||
return m_instance->getErrorCode();
|
return m_instance->getErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BACNETUTIL::getUPMErrorString()
|
string BACNETUTIL::getUPMErrorString()
|
||||||
{
|
{
|
||||||
return m_instance->getUPMErrorString();
|
return m_instance->getUPMErrorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BACNETUTIL::getErrorString()
|
string BACNETUTIL::getErrorString()
|
||||||
{
|
{
|
||||||
return m_instance->getErrorString();
|
return m_instance->getErrorString();
|
||||||
};
|
};
|
||||||
@ -904,7 +904,7 @@ bool BACNETUTIL::setDeviceName(string name)
|
|||||||
{
|
{
|
||||||
if (name.size() < 1)
|
if (name.size() < 1)
|
||||||
{
|
{
|
||||||
throw std::invalid_argument(std::string(__FUNCTION__)
|
throw invalid_argument(string(__FUNCTION__)
|
||||||
+ ": name must have at least one character");
|
+ ": name must have at least one character");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bh1750
|
|||||||
CPP_SRC bh1750.cxx
|
CPP_SRC bh1750.cxx
|
||||||
FTI_SRC bh1750_fti.c
|
FTI_SRC bh1750_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bma250e
|
|||||||
CPP_SRC bma250e.cxx
|
CPP_SRC bma250e.cxx
|
||||||
FTI_SRC bma250e_fti.c
|
FTI_SRC bma250e_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmg160
|
|||||||
CPP_SRC bmg160.cxx
|
CPP_SRC bmg160.cxx
|
||||||
FTI_SRC bmg160_fti.c
|
FTI_SRC bmg160_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmi160
|
|||||||
CPP_SRC bmi160.cxx
|
CPP_SRC bmi160.cxx
|
||||||
# FTI_SRC bmi160_fti.c
|
# FTI_SRC bmi160_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bmm150
|
|||||||
CPP_SRC bmm150.cxx
|
CPP_SRC bmm150.cxx
|
||||||
FTI_SRC bmm150_fti.c
|
FTI_SRC bmm150_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,5 +5,5 @@ upm_mixed_module_init (NAME bmp280
|
|||||||
CPP_HDR bmp280.hpp bme280.hpp
|
CPP_HDR bmp280.hpp bme280.hpp
|
||||||
CPP_SRC bmp280.cxx bme280.cxx
|
CPP_SRC bmp280.cxx bme280.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa interfaces)
|
REQUIRES mraa interfaces utilities-c)
|
||||||
target_link_libraries(${libnamec} m)
|
target_link_libraries(${libnamec} m)
|
||||||
|
@ -54,5 +54,3 @@ void BME280::setOversampleRateHumidity(BME280_OSRS_H_T rate)
|
|||||||
{
|
{
|
||||||
bmp280_set_oversample_rate_humidity(m_bmp280, rate);
|
bmp280_set_oversample_rate_humidity(m_bmp280, rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@ upm_mixed_module_init (NAME bmpx8x
|
|||||||
CPP_SRC bmpx8x.cxx
|
CPP_SRC bmpx8x.cxx
|
||||||
FTI_SRC bmpx8x_fti.c
|
FTI_SRC bmpx8x_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa interfaces)
|
REQUIRES mraa interfaces utilities-c)
|
||||||
target_link_libraries(${libnamec} m)
|
target_link_libraries(${libnamec} m)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME bno055
|
|||||||
CPP_HDR bno055.hpp
|
CPP_HDR bno055.hpp
|
||||||
CPP_SRC bno055.cxx
|
CPP_SRC bno055.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME buzzer
|
|||||||
CPP_SRC buzzer.cxx
|
CPP_SRC buzzer.cxx
|
||||||
# FTI_SRC buzzer_fti.c
|
# FTI_SRC buzzer_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME cjq4435
|
|||||||
CPP_HDR cjq4435.hpp
|
CPP_HDR cjq4435.hpp
|
||||||
CPP_SRC cjq4435.cxx
|
CPP_SRC cjq4435.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
include (CheckFunctionExists)
|
if (MRAA_FIRMATA_FOUND)
|
||||||
include (CheckLibraryExists)
|
|
||||||
include (CheckIncludeFiles)
|
|
||||||
check_library_exists (${MRAA_LIBRARIES} mraa_firmata_init "" HAVE_FIRMATA)
|
|
||||||
if (HAVE_FIRMATA)
|
|
||||||
set (libname "curieimu")
|
set (libname "curieimu")
|
||||||
set (libdescription "Curie IMU Sensor using Firmata")
|
set (libdescription "Curie IMU Sensor using Firmata")
|
||||||
set (module_src ${libname}.cpp)
|
set (module_src ${libname}.cpp)
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
upm_mixed_module_init (NAME dfrec
|
if (MRAA_OW_FOUND)
|
||||||
DESCRIPTION "Analog Electrical Conductivity (EC) Sensor"
|
upm_mixed_module_init (NAME dfrec
|
||||||
C_HDR dfrec.h
|
DESCRIPTION "Analog Electrical Conductivity (EC) Sensor"
|
||||||
C_SRC dfrec.c
|
C_HDR dfrec.h
|
||||||
CPP_HDR dfrec.hpp
|
C_SRC dfrec.c
|
||||||
CPP_SRC dfrec.cxx
|
CPP_HDR dfrec.hpp
|
||||||
FTI_SRC dfrec_fti.c
|
CPP_SRC dfrec.cxx
|
||||||
CPP_WRAPS_C
|
FTI_SRC dfrec_fti.c
|
||||||
REQUIRES ds18b20 mraa)
|
CPP_WRAPS_C
|
||||||
|
REQUIRES ds18b20 mraa utilities-c)
|
||||||
# make sure the C library has the appropriate dependency on the UPM
|
# make sure the C library has the appropriate dependency on the UPM
|
||||||
# DS18B20 C library
|
# DS18B20 C library
|
||||||
target_link_libraries(${libnamec} ds18b20-c)
|
target_link_libraries(${libnamec} ds18b20-c)
|
||||||
|
endif (MRAA_OW_FOUND)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "dfrec.hpp"
|
#include "dfrec.hpp"
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME dfrorp
|
|||||||
CPP_SRC dfrorp.cxx
|
CPP_SRC dfrorp.cxx
|
||||||
FTI_SRC dfrorp_fti.c
|
FTI_SRC dfrorp_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -51,7 +51,7 @@ void DFRORP::update()
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(string(__FUNCTION__)
|
throw std::runtime_error(string(__FUNCTION__)
|
||||||
+ ": dfrorp_update() failed with UPM error "
|
+ ": dfrorp_update() failed with UPM error "
|
||||||
+ std::to_string(int(rv)) );
|
+ to_string(int(rv)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,13 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mraa-utils.hpp"
|
#include "mraa-utils.hpp"
|
||||||
#include "mraa/gpio.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)
|
void MraaUtils::setGpio(int pin, int level)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
upm_mixed_module_init (NAME ds18b20
|
if (MRAA_OW_FOUND)
|
||||||
DESCRIPTION "Programmable Resolution 1-Wire Digital Thermometer"
|
upm_mixed_module_init (NAME ds18b20
|
||||||
C_HDR ds18b20.h ds18b20_defs.h
|
DESCRIPTION "Programmable Resolution 1-Wire Digital Thermometer"
|
||||||
C_SRC ds18b20.c
|
C_HDR ds18b20.h ds18b20_defs.h
|
||||||
CPP_HDR ds18b20.hpp
|
C_SRC ds18b20.c
|
||||||
CPP_SRC ds18b20.cxx
|
CPP_HDR ds18b20.hpp
|
||||||
FTI_SRC ds18b20_fti.c
|
CPP_SRC ds18b20.cxx
|
||||||
CPP_WRAPS_C
|
FTI_SRC ds18b20_fti.c
|
||||||
REQUIRES mraa)
|
CPP_WRAPS_C
|
||||||
|
REQUIRES mraa utilities-c)
|
||||||
|
endif (MRAA_OW_FOUND)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "upm_fti.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
|
* This file implements the Function Table Interface (FTI) for this sensor
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
set (libname "ds2413")
|
if (MRAA_OW_FOUND)
|
||||||
set (libdescription "1-Wire Dual Channel Addressable Switch")
|
set (libname "ds2413")
|
||||||
set (module_src ${libname}.cxx)
|
set (libdescription "1-Wire Dual Channel Addressable Switch")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_src ${libname}.cxx)
|
||||||
upm_module_init(mraa)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
endif (MRAA_OW_FOUND)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ecezo
|
|||||||
CPP_SRC ecezo.cxx
|
CPP_SRC ecezo.cxx
|
||||||
FTI_SRC ecezo_fti.c
|
FTI_SRC ecezo_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME enc03r
|
|||||||
CPP_SRC enc03r.cxx
|
CPP_SRC enc03r.cxx
|
||||||
FTI_SRC enc03r_fti.c
|
FTI_SRC enc03r_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME guvas12d
|
|||||||
CPP_SRC guvas12d.cxx
|
CPP_SRC guvas12d.cxx
|
||||||
FTI_SRC guvas12d_fti.c
|
FTI_SRC guvas12d_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME hka5
|
|||||||
CPP_SRC hka5.cxx
|
CPP_SRC hka5.cxx
|
||||||
FTI_SRC hka5_fti.c
|
FTI_SRC hka5_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -22,10 +22,13 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mraa-utils.hpp"
|
#include "mraa-utils.hpp"
|
||||||
#include "mraa/gpio.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)
|
void MraaUtils::setGpio(int pin, int level)
|
||||||
{
|
{
|
||||||
|
@ -154,12 +154,12 @@ HTU21D::getDewPoint(int bSampleData)
|
|||||||
sampleData();
|
sampleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
float fA = 8.1332;
|
float fA = 8.1332;
|
||||||
float fB = 1762.39;
|
float fB = 1762.39;
|
||||||
float fC = 235.66;
|
float fC = 235.66;
|
||||||
float fT = getTemperature(false);
|
float fT = getTemperature(false);
|
||||||
float fRH = getHumidity(false);
|
float fRH = getHumidity(false);
|
||||||
float fPP = exp10(fA - (fB / (fT + fC)));
|
float fPP = powf(10, fA - (fB / (fT + fC)));
|
||||||
float fDP = -(fB / (log10(fRH * fPP / 100) - fA) + fC);
|
float fDP = -(fB / (log10(fRH * fPP / 100) - fA) + fC);
|
||||||
|
|
||||||
return (fDP);
|
return (fDP);
|
||||||
|
@ -5,14 +5,10 @@
|
|||||||
%apply float *OUTPUT {float *fHum};
|
%apply float *OUTPUT {float *fHum};
|
||||||
%apply float *OUTPUT {float *fHumTemp};
|
%apply float *OUTPUT {float *fHumTemp};
|
||||||
%apply float *OUTPUT {float *fDewPt};
|
%apply float *OUTPUT {float *fDewPt};
|
||||||
%inline %{
|
|
||||||
extern int getHumidityData(float* fHum, float* fHumTemp, float* fDewPt);
|
|
||||||
%}
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include "htu21d.hpp"
|
#include "htu21d.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%include "htu21d.hpp"
|
%include "htu21d.hpp"
|
||||||
|
|
||||||
%pragma(java) jniclasscode=%{
|
%pragma(java) jniclasscode=%{
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ims
|
|||||||
CPP_SRC ims.cxx
|
CPP_SRC ims.cxx
|
||||||
FTI_SRC ims_fti.c
|
FTI_SRC ims_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "ims.hpp"
|
#include "ims.hpp"
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME jhd1313m1
|
|||||||
CPP_HDR jhd1313m1.hpp
|
CPP_HDR jhd1313m1.hpp
|
||||||
CPP_SRC jhd1313m1.cxx
|
CPP_SRC jhd1313m1.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa lcm1602)
|
REQUIRES mraa lcm1602 utilities-c)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
set (libname "kxcjk1013")
|
if (MRAA_IIO_FOUND)
|
||||||
set (libdescription "Tri-axis Digital Accelerometer")
|
set (libname "kxcjk1013")
|
||||||
set (module_src ${libname}.cxx)
|
set (libdescription "Tri-axis Digital Accelerometer")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_src ${libname}.cxx)
|
||||||
upm_module_init(mraa)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
endif (MRAA_IIO_FOUND)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
set (libname "l3gd20")
|
if (MRAA_IIO_FOUND)
|
||||||
set (libdescription "Tri-axis Digital Gyroscope")
|
set (libname "l3gd20")
|
||||||
set (module_src ${libname}.cxx)
|
set (libdescription "Tri-axis Digital Gyroscope")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_src ${libname}.cxx)
|
||||||
upm_module_init(mraa)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
endif (MRAA_IIO_FOUND)
|
||||||
|
@ -138,11 +138,11 @@ L3GD20::L3GD20(int bus, int addr)
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": Invalid Chip ID: expected "
|
": Invalid Chip ID: expected "
|
||||||
+ std::to_string(L3GD20_DEFAULT_CHIP_ID)
|
+ to_string(L3GD20_DEFAULT_CHIP_ID)
|
||||||
+ " or "
|
+ " or "
|
||||||
+ std::to_string(L3GD20H_DEFAULT_CHIP_ID)
|
+ to_string(L3GD20H_DEFAULT_CHIP_ID)
|
||||||
+ ", got "
|
+ ", got "
|
||||||
+ std::to_string(int(cid)));
|
+ to_string(int(cid)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ void L3GD20::update()
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(std::string(__FUNCTION__)
|
throw std::runtime_error(std::string(__FUNCTION__)
|
||||||
+ ": readRegs() failed to read "
|
+ ": readRegs() failed to read "
|
||||||
+ std::to_string(bufLen)
|
+ to_string(bufLen)
|
||||||
+ " bytes");
|
+ " bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME lcm1602
|
|||||||
CPP_HDR lcm1602.hpp
|
CPP_HDR lcm1602.hpp
|
||||||
CPP_SRC lcm1602.cxx
|
CPP_SRC lcm1602.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "upm_fti.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
|
* This file implements the Function Table Interface (FTI) for this sensor
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mraa-utils.hpp"
|
#include "mraa-utils.hpp"
|
||||||
#include "mraa/gpio.hpp"
|
#include "mraa/gpio.hpp"
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
upm_mixed_module_init (NAME lsm303agr
|
upm_mixed_module_init (NAME lsm303agr
|
||||||
DESCRIPTION "3-Axis eCompass module"
|
DESCRIPTION "3-Axis eCompass Module"
|
||||||
C_HDR lsm303agr.h lsm303agr_defs.h
|
C_HDR lsm303agr.h lsm303agr_defs.h
|
||||||
C_SRC lsm303agr.c
|
C_SRC lsm303agr.c
|
||||||
CPP_HDR lsm303agr.hpp
|
CPP_HDR lsm303agr.hpp
|
||||||
CPP_SRC lsm303agr.cxx
|
CPP_SRC lsm303agr.cxx
|
||||||
FTI_SRC lsm303agr_fti.c
|
FTI_SRC lsm303agr_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
upm_mixed_module_init (NAME lsm303d
|
upm_mixed_module_init (NAME lsm303d
|
||||||
DESCRIPTION "3-Axis eCompass module"
|
DESCRIPTION "3-Axis eCompass Module"
|
||||||
C_HDR lsm303d.h lsm303d_defs.h
|
C_HDR lsm303d.h lsm303d_defs.h
|
||||||
C_SRC lsm303d.c
|
C_SRC lsm303d.c
|
||||||
CPP_HDR lsm303d.hpp
|
CPP_HDR lsm303d.hpp
|
||||||
CPP_SRC lsm303d.cxx
|
CPP_SRC lsm303d.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME m24lr64e
|
|||||||
CPP_SRC m24lr64e.cxx
|
CPP_SRC m24lr64e.cxx
|
||||||
FTI_SRC m24lr64e_fti.c
|
FTI_SRC m24lr64e_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME max30100
|
|||||||
CPP_SRC max30100.cxx
|
CPP_SRC max30100.cxx
|
||||||
FTI_SRC max30100_fti.c
|
FTI_SRC max30100_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -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 "../upm.i"
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include "max30100.hpp"
|
#include "max30100.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%feature("director") upm::Callback;
|
#ifndef ANDROID
|
||||||
|
%feature("director") upm::Callback;
|
||||||
|
#endif
|
||||||
|
|
||||||
%include "max30100_regs.h"
|
%include "max30100_regs.h"
|
||||||
%include "max30100.hpp"
|
%include "max30100.hpp"
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "max30100.hpp"
|
#include "max30100.hpp"
|
||||||
|
|
||||||
using namespace upm;
|
using namespace upm;
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME mb704x
|
|||||||
CPP_SRC mb704x.cxx
|
CPP_SRC mb704x.cxx
|
||||||
FTI_SRC mb704x_fti.c
|
FTI_SRC mb704x_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME mcp2515
|
|||||||
CPP_HDR mcp2515.hpp
|
CPP_HDR mcp2515.hpp
|
||||||
CPP_SRC mcp2515.cxx
|
CPP_SRC mcp2515.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME md
|
|||||||
CPP_HDR md.hpp
|
CPP_HDR md.hpp
|
||||||
CPP_SRC md.cxx
|
CPP_SRC md.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME mma7361
|
|||||||
CPP_SRC mma7361.cxx
|
CPP_SRC mma7361.cxx
|
||||||
FTI_SRC mma7361_fti.c
|
FTI_SRC mma7361_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mma7361.hpp"
|
#include "mma7361.hpp"
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ bool MMA7361::isInFreefall()
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(string(__FUNCTION__)
|
throw std::runtime_error(string(__FUNCTION__)
|
||||||
+ ": mma7361_freefall() failed with UPM error "
|
+ ": mma7361_freefall() failed with UPM error "
|
||||||
+ std::to_string(int(rv)) );
|
+ to_string(int(rv)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return freefall;
|
return freefall;
|
||||||
@ -80,7 +81,7 @@ void MMA7361::enableSelftest(bool enable)
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(string(__FUNCTION__)
|
throw std::runtime_error(string(__FUNCTION__)
|
||||||
+ ": mma7361_selftest() failed with UPM error "
|
+ ": 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__)
|
throw std::runtime_error(string(__FUNCTION__)
|
||||||
+ ": mma7361_update() failed with UPM error "
|
+ ": mma7361_update() failed with UPM error "
|
||||||
+ std::to_string(int(rv)) );
|
+ to_string(int(rv)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
set (libname "mmc35240")
|
if (MRAA_IIO_FOUND)
|
||||||
set (libdescription "mmc35240 sensor module")
|
set (libname "mmc35240")
|
||||||
set (module_src ${libname}.cxx)
|
set (libdescription "mmc35240 sensor module")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_src ${libname}.cxx)
|
||||||
upm_module_init(mraa)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
endif (MRAA_IIO_FOUND)
|
||||||
|
@ -801,23 +801,6 @@ namespace upm {
|
|||||||
*/
|
*/
|
||||||
void getGyroscope(float *x, float *y, float *z);
|
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
|
* get the temperature value
|
||||||
*
|
*
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ms5803
|
|||||||
CPP_SRC ms5803.cxx
|
CPP_SRC ms5803.cxx
|
||||||
FTI_SRC ms5803_fti.c
|
FTI_SRC ms5803_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME my9221
|
|||||||
CPP_HDR my9221.hpp groveledbar.hpp grovecircularled.hpp
|
CPP_HDR my9221.hpp groveledbar.hpp grovecircularled.hpp
|
||||||
CPP_SRC my9221.cxx groveledbar.cxx grovecircularled.cxx
|
CPP_SRC my9221.cxx groveledbar.cxx grovecircularled.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME nmea_gps
|
|||||||
CPP_SRC nmea_gps.cxx
|
CPP_SRC nmea_gps.cxx
|
||||||
FTI_SRC nmea_gps_fti.c
|
FTI_SRC nmea_gps_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
%module(directors="1") javaupm_nrf24l01
|
|
||||||
%include "../upm.i"
|
%include "../upm.i"
|
||||||
|
|
||||||
%feature("director") Callback;
|
#ifdef ANDROID
|
||||||
SWIG_DIRECTOR_OWNED(Callback)
|
%module javaupm_nrf24l01
|
||||||
|
#else
|
||||||
|
%module(directors="1") javaupm_nrf24l01
|
||||||
|
%feature("director") Callback;
|
||||||
|
SWIG_DIRECTOR_OWNED(Callback)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
%include "arrays_java.i";
|
%include "arrays_java.i";
|
||||||
%apply signed char[] {uint8_t *};
|
%apply signed char[] {uint8_t *};
|
||||||
@ -23,4 +28,4 @@ SWIG_DIRECTOR_OWNED(Callback)
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#include "hal_platform.h"
|
#include "hal_platform.h"
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME nunchuck
|
|||||||
CPP_SRC nunchuck.cxx
|
CPP_SRC nunchuck.cxx
|
||||||
FTI_SRC nunchuck_fti.c
|
FTI_SRC nunchuck_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME otp538u
|
|||||||
CPP_SRC otp538u.cxx
|
CPP_SRC otp538u.cxx
|
||||||
FTI_SRC otp538u_fti.c
|
FTI_SRC otp538u_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "otp538u.h"
|
#include "otp538u.h"
|
||||||
|
|
||||||
#include "upm_fti.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
|
* This file implements the Function Table Interface (FTI) for this sensor
|
||||||
|
@ -1,25 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<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">
|
||||||
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>@pom_groupId@</groupId>
|
||||||
<groupId>io.mraa.upm</groupId>
|
<artifactId>upm_@target@</artifactId>
|
||||||
<artifactId>upm_@libname@</artifactId>
|
|
||||||
<version>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</version>
|
<version>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>@pom_packaging@</packaging>
|
||||||
|
<name>@target@</name>
|
||||||
<name>@libname@</name>
|
<description>@libdescription@</description>
|
||||||
<description>High level repository for sensors that use mraa</description>
|
|
||||||
<url>http://upm.mraa.io</url>
|
<url>http://upm.mraa.io</url>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>MIT License</name>
|
<name>MIT License</name>
|
||||||
<url>https://github.com/intel-iot-devkit/upm/blob/master/LICENSE</url>
|
<url>https://github.com/intel-iot-devkit/upm/blob/master/LICENSE</url>
|
||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Upm contributors https://github.com/intel-iot-devkit/upm/graphs/contributors</name>
|
<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>
|
<organizationUrl>https://github.com/intel-iot-devkit</organizationUrl>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:git://github.com/intel-iot-devkit/upm.git</connection>
|
<connection>scm:git:git://github.com/intel-iot-devkit/upm.git</connection>
|
||||||
<developerConnection>scm:git:ssh://github.com:intel-iot-devkit/upm.git</developerConnection>
|
<developerConnection>scm:git:ssh://github.com:intel-iot-devkit/upm.git</developerConnection>
|
||||||
<url>https://github.com/intel-iot-devkit/upm/tree/master</url>
|
<url>https://github.com/intel-iot-devkit/upm/tree/master</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
<dependencies>@pom_dependencies@
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.mraa</groupId>
|
|
||||||
<artifactId>mraa</artifactId>
|
|
||||||
<version>[@MRAA_MINIMUM@, )</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -5,5 +5,5 @@ upm_mixed_module_init (NAME ppd42ns
|
|||||||
CPP_HDR ppd42ns.hpp
|
CPP_HDR ppd42ns.hpp
|
||||||
CPP_SRC ppd42ns.cxx
|
CPP_SRC ppd42ns.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
target_link_libraries(${libnamec} m)
|
target_link_libraries(${libnamec} m)
|
||||||
|
@ -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 "../upm.i"
|
||||||
%include "arrays_java.i"
|
%include "arrays_java.i"
|
||||||
|
|
||||||
%feature("director") Callback;
|
#ifndef ANDROID
|
||||||
SWIG_DIRECTOR_OWNED(Callback)
|
%feature("director") Callback;
|
||||||
|
SWIG_DIRECTOR_OWNED(Callback)
|
||||||
|
#endif
|
||||||
|
|
||||||
%ignore sample_thread;
|
%ignore sample_thread;
|
||||||
%ignore pin_ctx;
|
%ignore pin_ctx;
|
||||||
@ -26,4 +33,4 @@ SWIG_DIRECTOR_OWNED(Callback)
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
@ -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 "../upm.i"
|
||||||
%include "arrays_java.i"
|
%include "arrays_java.i"
|
||||||
%include "typemaps.i"
|
%include "typemaps.i"
|
||||||
@ -21,4 +26,4 @@
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "upm_fti.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
|
* This file implements the Function Table Interface (FTI) for this sensor
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME rsc
|
|||||||
CPP_HDR rsc.hpp
|
CPP_HDR rsc.hpp
|
||||||
CPP_SRC rsc.cxx
|
CPP_SRC rsc.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME servo
|
|||||||
CPP_SRC servo.cxx es08a.cxx es9257.cxx
|
CPP_SRC servo.cxx es08a.cxx es9257.cxx
|
||||||
FTI_SRC es08a_fti.c es9257_fti.c
|
FTI_SRC es08a_fti.c es9257_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME sht1x
|
|||||||
CPP_SRC sht1x.cxx
|
CPP_SRC sht1x.cxx
|
||||||
FTI_SRC sht1x_fti.c
|
FTI_SRC sht1x_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -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 "../upm.i"
|
||||||
|
|
||||||
%include "../interfaces/javaupm_iLightSensor.i"
|
%include "../interfaces/javaupm_iLightSensor.i"
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mraa-utils.hpp"
|
#include "mraa-utils.hpp"
|
||||||
#include "mraa/gpio.hpp"
|
#include "mraa/gpio.hpp"
|
||||||
|
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME speaker
|
|||||||
CPP_SRC speaker.cxx
|
CPP_SRC speaker.cxx
|
||||||
# FTI_SRC speaker_fti.c
|
# FTI_SRC speaker_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <mraa/common.hpp>
|
|
||||||
#include <mraa/gpio.hpp>
|
#include <mraa/gpio.hpp>
|
||||||
#include <mraa/spi.hpp>
|
#include <mraa/spi.hpp>
|
||||||
#include "ssd1351_gfx.hpp"
|
#include "ssd1351_gfx.hpp"
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
set (libname "stepmotor")
|
# Currently no librt in android
|
||||||
set (libdescription "Stepper Motor")
|
if (NOT ANDROID)
|
||||||
set (module_src ${libname}.cxx)
|
set (libname "stepmotor")
|
||||||
set (module_hpp ${libname}.hpp)
|
set (libdescription "Stepper Motor")
|
||||||
upm_module_init(mraa)
|
set (module_src ${libname}.cxx)
|
||||||
target_link_libraries(${libname} rt)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
upm_module_init(mraa)
|
||||||
|
target_link_libraries(${libname} rt)
|
||||||
|
endif (NOT ANDROID)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "upm_fti.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
|
* This file implements the Function Table Interface (FTI) for this sensor
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME tsl2561
|
|||||||
CPP_SRC tsl2561.cxx
|
CPP_SRC tsl2561.cxx
|
||||||
FTI_SRC tsl2561_fti.c
|
FTI_SRC tsl2561_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME uartat
|
|||||||
CPP_HDR uartat.hpp
|
CPP_HDR uartat.hpp
|
||||||
CPP_SRC uartat.cxx
|
CPP_SRC uartat.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME uln200xa
|
|||||||
CPP_HDR uln200xa.hpp
|
CPP_HDR uln200xa.hpp
|
||||||
CPP_SRC uln200xa.cxx
|
CPP_SRC uln200xa.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -6,4 +6,4 @@ upm_mixed_module_init (NAME urm37
|
|||||||
CPP_SRC urm37.cxx
|
CPP_SRC urm37.cxx
|
||||||
FTI_SRC urm37_fti.c
|
FTI_SRC urm37_fti.c
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
upm_mixed_module_init (NAME utilities
|
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_HDR upm_utilities.h
|
||||||
C_SRC upm_utilities.c)
|
C_SRC upm_utilities.c)
|
||||||
|
12
src/utilities/javaupm_utilities.i
Normal file
12
src/utilities/javaupm_utilities.i
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
1
src/utilities/jsupm_utilities.i
Normal file
1
src/utilities/jsupm_utilities.i
Normal file
@ -0,0 +1 @@
|
|||||||
|
%module jsupm_utilities
|
1
src/utilities/pyupm_utilities.i
Normal file
1
src/utilities/pyupm_utilities.i
Normal file
@ -0,0 +1 @@
|
|||||||
|
%module pyupm_utilities
|
0
src/utilities/upm_utilities.cxx
Normal file
0
src/utilities/upm_utilities.cxx
Normal file
0
src/utilities/upm_utilities.hpp
Normal file
0
src/utilities/upm_utilities.hpp
Normal file
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME wfs
|
|||||||
CPP_HDR wfs.hpp
|
CPP_HDR wfs.hpp
|
||||||
CPP_SRC wfs.cxx
|
CPP_SRC wfs.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user