Default to MONOTONIC clock for timer methods to avoid falling victim to
clock corrections. Changed signatures from accepting pointers since
this is not needed an complicates calls and Java/JS/Python bindings.
* Switched from nanosleep to clock_nanosleep to allow developers to
provide a clock for LINUX
* Default upm_clock_init to CLOCK_MONOTONIC
* Updated logic to calculating delay and elapsed to be more readable
* Added ns flavors for completeness
* Refactored all upm_* delay/timer methods
* Added #else for preprocessor cases w/o an #else
* Added test for AQI
* Added test fixture with logic to identify a minimum delay time
which is used as a metric for testing all delay methods
* Much more lenient unit testing of delays to minimize false CI
failures
Signed-off-by: Noel Eck <noel.eck@intel.com>
Added code to parse GPTXT nmea sentences. Added methods to calculate
sentences/second and raw bytes/second.
Signed-off-by: Noel Eck <noel.eck@intel.com>
NMEA GPS class now uses threads to handle parsing NMEA sentences.
Currently only handles GGA, GSV, and GLL types. Added queues for
holding parsed data.
* Parsing thread
* Parse GPS Fix from GGA and GLL
* Parse satellite info from GSV
* Provide a queue for GPS fix data as well as raw sentences
(for debugging)
* Target structures and NMEAGPS class have a __str__() method
which summarizes the objects into a std::string. These are
tied to the __str__ method in python
* Added google unit test for the above functionality
Signed-off-by: Noel Eck <noel.eck@intel.com>
Be a bit more lenient with the acceptable range for the microsecond
flavor of upm_delay (+/- 150us instead of +/- 100us).
Signed-off-by: Noel Eck <noel.eck@intel.com>
Added Google Test for unit testing. Currently NOT required by UPM
CMake.
* Added a test fixture for the utilities library.
* Fixed bug in delay methods provided by utilities library.
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit moves common SWIG syntax to a ${libname}.i for sensor
libraries. Much of the swig content was originally duplicated for
each wrapper language which has lead to inconsistencies between wrappers
over time. This commit moves all swig syntax to a common file. Language
specific swig syntax can be added with #ifdef SWIG<LANGUAGE>.
The src/CMakeLists.txt will look first for a language-specific .i file,
then fall back to ${libname}.i. In this way, it's possible to override
the common ${libname}.i file. If a fallback .i file does NOT exist,
UPM CMake will generate a simple interface file for all languages.
Example:
If no src/abp/pyupm_abp.i and no src/abp/abp.i then
generate ${CMAKE_CURRENT_BINARY_DIR}/abp.i
When src/CMakeLists.txt uses a common ${libname}.i, it adds a -module
<language>upm_${libname} to the swig command line.
In the example below, a -module argument is provided for both Java and
Javascript, while the python module takes all syntax from pyupm_abp.i.
SWIG FILE Language CMake added SWIG args
--------------- ---------- ---------------------
src/abp/abp.i java -module javaupm_abp
src/abp/abp.i javascript -module jsupm_abp
src/abp/pyupm_abp.i python
This commit removes ~4500 redundant lines for the UPM repository and
helps promote uniformity for the SWIG'ed languages.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Previously the JAVA packages re-compile UPM library source files. This
was a work-around for compiling JAVA-specific functionality from the UPM
source into the SWIG'ed JAVA pacakges.
This commit removes the source from the JAVA SWIG compile and provides
an example on how to add the JAVA-specific code with a swig extend call.
* Added _upm.i file for %import (not %include)
* Added macros to _upm.i; 1 which performs the loadLibrary, and one
which adds the java installISR runnable.
* Updated the src/CMakeLists.txt file to NOT build library src into
pacakges.
* Updated the a110x library with examples on how to use the macros.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Replace TemplateItem with SensorTemplate in the sensortemplate.json and
json ctest. Change to contributions.md which removes all objects
with a key starting with "//" from the generated sensor .json file.
This allows the json ctest to pass OOTB for new sensor libraries
generated from the make_new_sensor function.
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit adds node based tests provided by Nico to the ctest
framework already established in UPM.
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit translates C++ interfaces to Java interfaces, previously C++ Interfaces implemented java classes.
* Added java swig interface files for all C++ interfaces to simplify swig
javaupm_iADC.i
javaupm_iCO2Sensor.i
javaupm_iHumiditySensor.i
javaupm_iLightController.i
javaupm_iLightSensor.i
javaupm_iModuleStatus.i
javaupm_interfaces.i
javaupm_iPressureSensor.i
javaupm_iTemperatureSensor.i
<example Usage>
%include"../interfaces/javaupm_iADC.i"
* Modified swig interface files for few sensors that implements interfaces
ads1x15
bmp280
bmpx8x
ds1808lc
hlg150h
lp8860
max44009
ms5611
si1132
si7005
t6713
* Removed few methods that were mentioned Protected and made them public, so that menthods can be overridden
* Made IModuleStatus virtual to avoid ambiguity in multiple inheritance
For example
class A {};
class B : public A {};
class C : public A {};
class D : public B, public C {};
This can be solved as
class A {};
class B : virtual public A {};
class C : virtual public A {};
class D : public B, public C {};
* Modified java interface files to support multiple swig versions
* Modified javaupm interface file to support standard auto load library code
* Fixed autoloadlibrary tests for interfaces
* Created one interface example separately <BME280_InterfaceExample.java>,
<example Usage>
BME280_InterfaceExample.java
since we cann't define swig versions inside java example file.
So, instaed added swig versions in Cmake.
<example Usage>
if (SWIG_VERSION VERSION_GREATER 3.0.8)
add_example_with_path(BME280_InterfaceExample bmp280 bmp280)
endif()
Signed-off-by: sisinty sasmita patra <sisinty.s.patra@intel.com>
* Grouped UPM python modules into upm directory, for example:
/usr/local/lib/python2.7/dist-packages/upm
* Updated UPM example import statements
* Removed unused RPATH statements from UPM src CMakeLists.txt,
currently build collateral contains an explicit RPATH which
is stripped from the install collateral.
* Converted python examples to work on both python2 AND python3
* Added ctest for loading examples w/python3
* Removed returns from swig macros
* UPM python module use will change...
Before:
import pyupm_dfrph
After:
from upm import pyupm_dfrph
or
import upm.pyupm_dfrph
etc...
* This commit fixes#468
Signed-off-by: Noel Eck <noel.eck@intel.com>
The DetectPython cmake script now outputs a default python executable.
Updated other cmake scripts to use this concept. Used default where
python2/3 will work, use explicit PYTHON2/3_EXECUTABLE where an
explicit version is needed. Also, fail if python is required and NO
version of python was found.
Signed-off-by: Noel Eck <noel.eck@intel.com>
* Moved body of each python example to main. This allows for basic
load module testing for CI
* General cleanup of python modules (crlf/tabs/prints/etc)
* Chmod'ed to 755 to allow running examples without specifying the
python interpreter
* Added ctest for loading python2/3 modules
* Added jniclasscode pragma for java swig interface files.
* Updated check_examplenames.py module to check all languages vs. a
cxx example name
* Added tests for checking python module and test loading
* Added 'make test' to travis-ci run (run ctests)
* Print a more meaningful message when not building cxx docs into
python modules
* Updated check_clean.py to only check java wrapper files
* ENABLED ctests for UPM
* Deleted using_carrays.py python example - this is covered by other
examples
Signed-off-by: Noel Eck <noel.eck@intel.com>