mirror of
https://github.com/eclipse/upm.git
synced 2025-07-06 20:01:12 +03:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
16e72d2ff7 | |||
94be00a63d | |||
d5cb613ad0 | |||
c0c37028e4 | |||
eb8d64f52b | |||
1ddf969020 | |||
85608a9f61 | |||
4927311a0c | |||
b50b93272d | |||
ed4fe56ef8 |
@ -130,7 +130,7 @@ find_package (PkgConfig REQUIRED)
|
||||
|
||||
# Force a libmraa search and minimum required version every time a config is generated
|
||||
unset(MRAA_FOUND CACHE)
|
||||
set(MRAA_MINIMUM 1.9.0)
|
||||
set(MRAA_MINIMUM 2.0.0)
|
||||
pkg_check_modules (MRAA REQUIRED mraa>=${MRAA_MINIMUM})
|
||||
# Also, get full path to the mraa library
|
||||
find_library(MRAA_LIBRARY NAMES mraa HINTS ${MRAA_LIBDIR})
|
||||
@ -229,7 +229,7 @@ include (GetGitRevisionDescription)
|
||||
git_describe (VERSION "--tags")
|
||||
# If git_describe fails, use a dirty version
|
||||
if (${VERSION} MATCHES -NOTFOUND)
|
||||
set (VERSION "v1.7.0")
|
||||
set (VERSION "v1.7.1")
|
||||
message (WARNING "Failed to retrieve UPM version with 'git describe' (using "
|
||||
"${VERSION}). Check that git is installed and this is a valid git repo.")
|
||||
endif ()
|
||||
|
@ -4,6 +4,12 @@ Changelog {#changelog}
|
||||
Here's a list summarizing some of the key undergoing changes to our library
|
||||
from earlier versions:
|
||||
|
||||
### v1.7.1
|
||||
|
||||
* Bumped library compatibility to new MRAA 2.0 APIs
|
||||
* Added installation details for Fedora
|
||||
* Minor fixes based on static analysis vulnerability report
|
||||
|
||||
### v1.7.0
|
||||
|
||||
* Added Cordova bindings based on Java packages
|
||||
|
@ -54,6 +54,18 @@ sudo apt-get install libupm-dev libupm-java python-upm python3-upm node-upm upm-
|
||||
Running UPM applications on Ubuntu systems requires elevated permissions
|
||||
(e.g. run with `sudo`).
|
||||
|
||||
### Fedora Linux
|
||||
|
||||
MRAA and UPM are available through the default package repositories on Fedora and can be
|
||||
installed in the standard method using dnf.
|
||||
|
||||
To install:
|
||||
|
||||
```bash
|
||||
sudo dnf install upm
|
||||
sudo dnf install paython3-upm nodejs-upm upm-examples
|
||||
```
|
||||
|
||||
### Node.js bindings only (NPM)
|
||||
|
||||
This option allows compiling MRAA/UPM on any system with npm and node-gyp.
|
||||
|
@ -24,8 +24,11 @@
|
||||
|
||||
public class A110X_intr_Example {
|
||||
|
||||
public static int counter=0;
|
||||
|
||||
private static int counter=0;
|
||||
|
||||
public static void incrementCounter() {
|
||||
counter++;
|
||||
}
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
//! [Interesting]
|
||||
// Instantiate an A110X sensor on digital pin D2
|
||||
@ -52,6 +55,6 @@ class A110XISR implements Runnable {
|
||||
super();
|
||||
}
|
||||
public void run(){
|
||||
A110X_intr_Example.counter++;
|
||||
A110X_intr_Example.incrementCounter();
|
||||
}
|
||||
}
|
@ -24,9 +24,12 @@
|
||||
|
||||
public class Button_intr_Example {
|
||||
|
||||
public static int counter = 0;
|
||||
private static int counter = 0;
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
public static void incrementCounter() {
|
||||
counter++;
|
||||
}
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// ! [Interesting]
|
||||
upm_button.Button b = new upm_button.Button(2);
|
||||
|
||||
@ -47,7 +50,7 @@ class ButtonISR implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Button_intr_Example.counter++;
|
||||
Button_intr_Example.incrementCounter();
|
||||
System.out.println("Button pressed!");
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class FlexSensor_Example {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
}
|
||||
//! [Interesting]
|
||||
|
@ -24,8 +24,11 @@
|
||||
|
||||
public class GroveButton_intr_Example {
|
||||
|
||||
public static int counter = 0;
|
||||
private static int counter = 0;
|
||||
|
||||
public static void incrementCounter() {
|
||||
counter++;
|
||||
}
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// ! [Interesting]
|
||||
upm_grove.GroveButton b = new upm_grove.GroveButton(2);
|
||||
@ -47,7 +50,7 @@ class ButtonISR implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
GroveButton_intr_Example.counter++;
|
||||
GroveButton_intr_Example.incrementCounter();
|
||||
System.out.println("Button pressed!");
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class GroveQTouch_Example {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
}
|
||||
// ! [Interesting]
|
||||
|
@ -24,8 +24,11 @@
|
||||
|
||||
public class RPR220_intr_Example {
|
||||
|
||||
public static int counter = 0;
|
||||
private static int counter = 0;
|
||||
|
||||
public static void incrementCounter() {
|
||||
counter++;
|
||||
}
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// ! [Interesting]
|
||||
// This example uses an interrupt handler to increment a counter
|
||||
@ -49,6 +52,6 @@ class RPRISR implements Runnable {
|
||||
super();
|
||||
}
|
||||
public void run() {
|
||||
RPR220_intr_Example.counter++;
|
||||
RPR220_intr_Example.incrementCounter();
|
||||
}
|
||||
}
|
@ -85,7 +85,7 @@ public class WT5001_Example {
|
||||
vol = mp3.getVolume();
|
||||
System.out.println("The current volume is: " + vol);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -93,7 +93,7 @@ public class WT5001_Example {
|
||||
ps = mp3.getPlayState();
|
||||
System.out.println("The current play state is: " + ps);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -101,7 +101,7 @@ public class WT5001_Example {
|
||||
numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD);
|
||||
System.out.println("The number of files on the SD card is: " + numf);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -109,7 +109,7 @@ public class WT5001_Example {
|
||||
curf = mp3.getCurrentFile();
|
||||
System.out.println("The current file is: " + curf);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
|
||||
int year[] = new int[1];
|
||||
|
@ -53,6 +53,9 @@ sonar_cmd_base="build-wrapper-linux-x86-64 --out-dir ${bw_output_path} make -j8
|
||||
-Dsonar.inclusions='CMakeLists.txt,examples/**/*,include/**/*,src/**/*,tests/**/*' \
|
||||
-Dsonar.java.binaries='src' \
|
||||
-Dsonar.coverage.exclusions='**/*' \
|
||||
-Dsonar.issue.ignore.multicriteria=r1 \
|
||||
-Dsonar.issue.ignore.multicriteria.r1.ruleKey=squid:S2189 \
|
||||
-Dsonar.issue.ignore.multicriteria.r1.resourceKey=**/*.java \
|
||||
-Dsonar.cfamily.build-wrapper-output=${bw_output_path} \
|
||||
-Dsonar.host.url=https://sonarcloud.io \
|
||||
-Dsonar.organization=${SONAR_ORG} \
|
||||
|
@ -686,17 +686,17 @@ upm_result_t bh1749_registers_dump(bh1749_context dev, char *dump)
|
||||
|
||||
if(bh1749_read_registers(dev, BH1749_SYSTEM_CONTROL, reg_values, len) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
count += sprintf(dump, "0x40 ");
|
||||
count += snprintf(dump, 6, "0x40 ");
|
||||
for(int i = 0; i < len; i++)
|
||||
count += sprintf(dump + count, "%02X ", reg_values[i]);
|
||||
sprintf(dump + count - 1, "\n");
|
||||
count += snprintf(dump + count, 4, "%02X ", reg_values[i]);
|
||||
snprintf(dump + count - 1, 3, "\n");
|
||||
|
||||
len = 6;
|
||||
if(bh1749_read_registers(dev, BH1749_INTERRUPT, reg_values, len) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
count += sprintf(dump + count, "0x60 ");
|
||||
count += snprintf(dump + count, 6, "0x60 ");
|
||||
for(int i = 0; i < len; i++)
|
||||
count += sprintf(dump + count, "%02X ", reg_values[i]);
|
||||
count += snprintf(dump + count, 4, "%02X ", reg_values[i]);
|
||||
|
||||
return UPM_SUCCESS;
|
||||
}
|
||||
|
@ -873,17 +873,17 @@ upm_result_t bh1792_registers_dump(bh1792_context dev, char *dump)
|
||||
|
||||
if(bh1792_read_registers(dev, BH1792_MEAS_CONTROL1, reg_values, len) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
count += sprintf(dump, "0x41 ");
|
||||
count += snprintf(dump, 6, "0x41 ");
|
||||
for(int i = 0; i < len; i++)
|
||||
count += sprintf(dump + count, "%02X ", reg_values[i]);
|
||||
sprintf(dump + count - 1, "\n");
|
||||
count += snprintf(dump + count, 4, "%02X ", reg_values[i]);
|
||||
snprintf(dump + count - 1, 3, "\n");
|
||||
|
||||
len = 1;
|
||||
if(bh1792_read_registers(dev, BH1792_FIFO_LEV, reg_values, len) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
count += sprintf(dump + count, "0x4B ");
|
||||
count += snprintf(dump + count, 6, "0x4B ");
|
||||
for(int i = 0; i < len; i++)
|
||||
count += sprintf(dump + count, "%02X ", reg_values[i]);
|
||||
count += snprintf(dump + count, 4, "%02X ", reg_values[i]);
|
||||
|
||||
return UPM_SUCCESS;
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ void cleanUp()
|
||||
* See https://codereview.chromium.org/412163003 for this API change
|
||||
*/
|
||||
#if (SWIG_V8_VERSION < 0x032838)
|
||||
while (!v8::V8::IdleNotification())
|
||||
while (!v8::V8::IdleNotificationDeadline())
|
||||
#else
|
||||
while (!v8::Isolate::GetCurrent()->IdleNotification(1000))
|
||||
while (!v8::Isolate::GetCurrent()->IdleNotificationDeadline(1000))
|
||||
#endif
|
||||
{;}
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ static upm_result_t kxtj3_write_register(const kxtj3_context dev, uint8_t reg, u
|
||||
|
||||
static upm_result_t kxtj3_set_bit_on(const kxtj3_context dev, uint8_t reg, uint8_t bit_mask)
|
||||
{
|
||||
uint8_t reg_value;
|
||||
uint8_t reg_value = 0;
|
||||
if (kxtj3_read_register(dev, reg, ®_value) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -314,7 +314,7 @@ static upm_result_t kxtj3_set_bit_on(const kxtj3_context dev, uint8_t reg, uint8
|
||||
|
||||
static upm_result_t kxtj3_set_bit_off(const kxtj3_context dev, uint8_t reg, uint8_t bit_mask)
|
||||
{
|
||||
uint8_t reg_value;
|
||||
uint8_t reg_value = 0;
|
||||
if (kxtj3_read_register(dev, reg, ®_value) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -324,7 +324,7 @@ static upm_result_t kxtj3_set_bit_off(const kxtj3_context dev, uint8_t reg, uint
|
||||
|
||||
static upm_result_t kxtj3_set_bits_with_mask(const kxtj3_context dev, uint8_t reg, uint8_t val, uint8_t bit_mask)
|
||||
{
|
||||
uint8_t reg_val;
|
||||
uint8_t reg_val = 0;
|
||||
if (kxtj3_read_register(dev, reg, ®_val) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -600,7 +600,7 @@ upm_result_t kxtj3_set_odr_wakeup_function(const kxtj3_context dev, KXTJ3_ODR_WA
|
||||
|
||||
static bool kxtj3_check_digital_communication_reg_value(kxtj3_context dev, uint8_t expected_val)
|
||||
{
|
||||
uint8_t dcst_reg;
|
||||
uint8_t dcst_reg = 0;
|
||||
if (kxtj3_read_register(dev, KXTJ3_DCST_RESP, &dcst_reg) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -1017,7 +1017,7 @@ upm_result_t kxtj3_set_wakeup_motion_time(kxtj3_context dev, float desired_time)
|
||||
upm_result_t kxtj3_get_wakeup_motion_time(kxtj3_context dev, float *out_time)
|
||||
{
|
||||
assert(dev != NULL);
|
||||
uint8_t motion_count;
|
||||
uint8_t motion_count = 0;
|
||||
if (kxtj3_read_register(dev, KXTJ3_WAKEUP_COUNTER, &motion_count) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -1044,7 +1044,7 @@ upm_result_t kxtj3_set_wakeup_non_activity_time(kxtj3_context dev, float desired
|
||||
upm_result_t kxtj3_get_wakeup_non_activity_time(kxtj3_context dev, float *out_time)
|
||||
{
|
||||
assert(dev != NULL);
|
||||
uint8_t non_activity_reg_count;
|
||||
uint8_t non_activity_reg_count = 0;
|
||||
if (kxtj3_read_register(dev, KXTJ3_NA_COUNTER, &non_activity_reg_count) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
@ -1082,7 +1082,7 @@ upm_result_t kxtj3_set_wakeup_threshold_g_value(kxtj3_context dev, float g_thres
|
||||
upm_result_t kxtj3_get_wakeup_threshold(kxtj3_context dev, float *out_threshold)
|
||||
{
|
||||
assert(dev != NULL);
|
||||
uint8_t reg_value_h, reg_value_l;
|
||||
uint8_t reg_value_h = 0, reg_value_l = 0;
|
||||
if (kxtj3_read_register(dev, KXTJ3_WAKEUP_THRESHOLD_H, ®_value_h) != UPM_SUCCESS)
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
|
||||
|
@ -76,7 +76,7 @@ led_context led_init_str(const char* name){
|
||||
dev->gpio = NULL;
|
||||
|
||||
dev->name = name;
|
||||
dev->gpioled = mraa_led_init(name);
|
||||
dev->gpioled = mraa_led_init_raw(name);
|
||||
|
||||
if (!dev->gpioled) {
|
||||
printf("%s: Unable to initialize gpioled device (%s).\n", __FUNCTION__, dev->name);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
from __future__ import print_function
|
||||
|
||||
import unittest as u
|
||||
import re, fnmatch, os
|
||||
@ -34,7 +35,7 @@ class AutoLoadLibrary(u.TestCase):
|
||||
data = f.read()
|
||||
#Make sure it is module
|
||||
if not '%module' in data:
|
||||
print "%%module not found in %s, skipping" % fileName
|
||||
print ("%%module not found in %s, skipping" % fileName)
|
||||
continue
|
||||
# Check for the autoload code or the autoload macro
|
||||
if (not 'JAVA_JNI_LOADLIBRARY(javaupm_' in data) and \
|
||||
|
Reference in New Issue
Block a user