From 50f98a0c0407f6b3ba2a809f8822545300bf4015 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 30 Jul 2015 00:37:34 +0100 Subject: [PATCH 001/295] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 344e9f9..68472aa 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ An Android library that provides Continuous Sensing functionality to your applic ## Supported Sensors -The following sensor modules are currently supported in SensingKit-Android, (listed in [SKSensorModuleType](SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleType.java) enum): +The following sensor modules are currently supported in SensingKit-Android, (listed in [SKSensorModuleType](SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java) enum): - Accelerometer - Gravity From d3117dfd894af1894ed9064342f4e9565bb64731 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 13:30:49 +0100 Subject: [PATCH 002/295] Update gradle to 1.3.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9405f3f..1b7886d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 015acff0a9e410787c2ed7c9bbb2b319aeee0ca5 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 13:31:07 +0100 Subject: [PATCH 003/295] Update for Android Studio 1.3.1 --- SensingKitLib/SensingKitLib.iml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 2a23a7d..5700503 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -37,13 +37,13 @@ - + - + From fef36117aec5a74687d10ad37eb93d8ddf58db2b Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 13:35:59 +0100 Subject: [PATCH 004/295] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a82b3c..3ef4459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### Next + - Added support for Android Studio 1.3.1 + - Update gradle to 1.3.0 + ### 0.2.0 - Added support for Bluetooth sensor module. - DataInterface method getDataInString() has been renamed to getDataInCSV() From b49ed480e2b4bb748ee8a56f639d11022713582f Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 21:28:56 +0100 Subject: [PATCH 005/295] Update Google Play Services to 7.8.0 --- CHANGELOG.md | 5 +++-- SensingKitLib/build.gradle | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ef4459..78f0549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Changelog ### Next + - Updated Google Play Services to 7.8.0 - Added support for Android Studio 1.3.1 - - Update gradle to 1.3.0 + - Updated gradle to 1.3.0 ### 0.2.0 - - Added support for Bluetooth sensor module. + - Added support for Bluetooth sensor module - DataInterface method getDataInString() has been renamed to getDataInCSV() - SKDataInterface has been renamed to SKSensorData - Added getSensorModuleType() to SKSensorData diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 1fa6fc9..0c2aa58 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,5 +20,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.android.gms:play-services-location:7.5.0' + compile 'com.google.android.gms:play-services-location:7.8.0' } From b0b710c95a4f6753208327aa9742a436a2a7ff8e Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 22:32:11 +0100 Subject: [PATCH 006/295] Add support for Humidity sensor module. --- CHANGELOG.md | 1 + README.md | 1 + .../sensingkitlib/SKSensorModuleManager.java | 6 ++- .../sensingkitlib/SKSensorModuleType.java | 3 +- .../sensingkitlib/data/SKHumidityData.java | 52 ++++++++++++++++++ .../modules/SKAbstractNativeSensorModule.java | 3 ++ .../sensingkitlib/modules/SKHumidity.java | 53 +++++++++++++++++++ .../modules/SKSensorModuleUtilities.java | 3 ++ 8 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f0549..c650908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ### Next + - Added support for Humidity sensor module. - Updated Google Play Services to 7.8.0 - Added support for Android Studio 1.3.1 - Updated gradle to 1.3.0 diff --git a/README.md b/README.md index 9867015..2c71be0 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ The following sensor modules are currently supported in SensingKit-Android, (lis - Audio Recorder - Audio Level - Bluetooth +- Humidity ## Configuring the Library diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java index fb0aeb8..d0f6803 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java @@ -33,7 +33,7 @@ public class SKSensorModuleManager { @SuppressWarnings("unused") private static final String TAG = "SKSensorModuleManager"; - private static final int TOTAL_SENSOR_MODULES = 17; + private static final int TOTAL_SENSOR_MODULES = 18; private static SKSensorModuleManager sSensorModuleManager; private final Context mApplicationContext; @@ -194,6 +194,10 @@ protected SKAbstractSensorModule createSensorModule(SKSensorModuleType moduleTyp sensorModule = new SKBluetooth(mApplicationContext); break; + case HUMIDITY: + sensorModule = new SKHumidity(mApplicationContext); + break; + // Don't forget the break; here default: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java index 63a8454..09d35bd 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java @@ -38,5 +38,6 @@ public enum SKSensorModuleType { SCREEN_STATUS, AUDIO_RECORDER, AUDIO_LEVEL, - BLUETOOTH + BLUETOOTH, + HUMIDITY } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java new file mode 100644 index 0000000..600680f --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + +package org.sensingkit.sensingkitlib.data; + +import org.sensingkit.sensingkitlib.SKSensorModuleType; + +import java.util.Locale; + +public class SKHumidityData extends SKAbstractData { + + @SuppressWarnings("unused") + private static final String TAG = "SKHumidityData"; + + protected final float humidity; + + public SKHumidityData(long timestamp, float humidity) { + + super(SKSensorModuleType.HUMIDITY, timestamp); + + this.humidity = humidity; + } + + @Override + public String getDataInCSV() { + return String.format(Locale.US, "%d,%f", this.timestamp, this.humidity); + } + + @SuppressWarnings("unused") + public float getLight() { + return this.humidity; + } + +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java index 3b562a7..43b6333 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java @@ -139,6 +139,9 @@ private static int getSensorType(SKSensorModuleType sensorType) throws SKExcepti case LIGHT: return Sensor.TYPE_LIGHT; + case HUMIDITY: + return Sensor.TYPE_RELATIVE_HUMIDITY; + case LOCATION: case ACTIVITY: case BATTERY: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java new file mode 100644 index 0000000..6e7fb7a --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + +package org.sensingkit.sensingkitlib.modules; + +import android.content.Context; +import android.hardware.SensorEvent; + +import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.data.SKAbstractData; +import org.sensingkit.sensingkitlib.data.SKHumidityData; + +public class SKHumidity extends SKAbstractNativeSensorModule { + + @SuppressWarnings("unused") + private static final String TAG = "SKHumidity"; + + public SKHumidity(final Context context) throws SKException { + super(context, SKSensorModuleType.HUMIDITY); + } + + @Override + protected SKAbstractData buildData(SensorEvent event) + { + return new SKHumidityData(System.currentTimeMillis(), event.values[0]); + } + + @Override + protected boolean shouldPostSensorData(SKAbstractData data) { + + // Always post sensor data + return true; + } +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java index da40807..aefea01 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java @@ -85,6 +85,9 @@ public static String getSensorModuleInString(SKSensorModuleType moduleType) thro case BLUETOOTH: return "Bluetooth"; + case HUMIDITY: + return "Humidity"; + default: throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); } From 12f387c8d780f9e3670f738ce2861b493ca1e94f Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 13 Aug 2015 22:40:29 +0100 Subject: [PATCH 007/295] Add support for Air Pressure sensor module --- CHANGELOG.md | 3 +- README.md | 1 + .../sensingkitlib/SKSensorModuleManager.java | 6 ++- .../sensingkitlib/SKSensorModuleType.java | 3 +- .../sensingkitlib/data/SKAirPressureData.java | 52 ++++++++++++++++++ .../modules/SKAbstractNativeSensorModule.java | 3 ++ .../sensingkitlib/modules/SKAirPressure.java | 53 +++++++++++++++++++ .../modules/SKSensorModuleUtilities.java | 3 ++ 8 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java diff --git a/CHANGELOG.md b/CHANGELOG.md index c650908..e790924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog ### Next - - Added support for Humidity sensor module. + - Added support for Air Pressure sensor module + - Added support for Humidity sensor module - Updated Google Play Services to 7.8.0 - Added support for Android Studio 1.3.1 - Updated gradle to 1.3.0 diff --git a/README.md b/README.md index 2c71be0..7ae7d69 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The following sensor modules are currently supported in SensingKit-Android, (lis - Audio Level - Bluetooth - Humidity +- Air Pressure ## Configuring the Library diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java index d0f6803..6fa3582 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java @@ -33,7 +33,7 @@ public class SKSensorModuleManager { @SuppressWarnings("unused") private static final String TAG = "SKSensorModuleManager"; - private static final int TOTAL_SENSOR_MODULES = 18; + private static final int TOTAL_SENSOR_MODULES = 19; private static SKSensorModuleManager sSensorModuleManager; private final Context mApplicationContext; @@ -198,6 +198,10 @@ protected SKAbstractSensorModule createSensorModule(SKSensorModuleType moduleTyp sensorModule = new SKHumidity(mApplicationContext); break; + case AIR_PRESSURE: + sensorModule = new SKAirPressure(mApplicationContext); + break; + // Don't forget the break; here default: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java index 09d35bd..91b7b67 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java @@ -39,5 +39,6 @@ public enum SKSensorModuleType { AUDIO_RECORDER, AUDIO_LEVEL, BLUETOOTH, - HUMIDITY + HUMIDITY, + AIR_PRESSURE } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java new file mode 100644 index 0000000..41306d6 --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + +package org.sensingkit.sensingkitlib.data; + +import org.sensingkit.sensingkitlib.SKSensorModuleType; + +import java.util.Locale; + +public class SKAirPressureData extends SKAbstractData { + + @SuppressWarnings("unused") + private static final String TAG = "SKAirPressureData"; + + protected final float pressure; + + public SKAirPressureData(long timestamp, float pressure) { + + super(SKSensorModuleType.AIR_PRESSURE, timestamp); + + this.pressure = pressure; + } + + @Override + public String getDataInCSV() { + return String.format(Locale.US, "%d,%f", this.timestamp, this.pressure); + } + + @SuppressWarnings("unused") + public float getLight() { + return this.pressure; + } + +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java index 43b6333..55ce541 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java @@ -142,6 +142,9 @@ private static int getSensorType(SKSensorModuleType sensorType) throws SKExcepti case HUMIDITY: return Sensor.TYPE_RELATIVE_HUMIDITY; + case AIR_PRESSURE: + return Sensor.TYPE_PRESSURE; + case LOCATION: case ACTIVITY: case BATTERY: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java new file mode 100644 index 0000000..66cce7c --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + +package org.sensingkit.sensingkitlib.modules; + +import android.content.Context; +import android.hardware.SensorEvent; + +import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.data.SKAbstractData; +import org.sensingkit.sensingkitlib.data.SKAirPressureData; + +public class SKAirPressure extends SKAbstractNativeSensorModule { + + @SuppressWarnings("unused") + private static final String TAG = "SKAirPressure"; + + public SKAirPressure(final Context context) throws SKException { + super(context, SKSensorModuleType.AIR_PRESSURE); + } + + @Override + protected SKAbstractData buildData(SensorEvent event) + { + return new SKAirPressureData(System.currentTimeMillis(), event.values[0]); + } + + @Override + protected boolean shouldPostSensorData(SKAbstractData data) { + + // Always post sensor data + return true; + } +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java index aefea01..cfd793f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java @@ -88,6 +88,9 @@ public static String getSensorModuleInString(SKSensorModuleType moduleType) thro case HUMIDITY: return "Humidity"; + case AIR_PRESSURE: + return "Air Pressure"; + default: throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); } From 7afdae2dd84f3a195604df862161d5d21292b317 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Fri, 14 Aug 2015 12:06:44 +0100 Subject: [PATCH 008/295] Update for Google Play Services to 7.8.0 --- SensingKitLib/SensingKitLib.iml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 5700503..1343bad 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -72,10 +72,10 @@ - - - - + + + + @@ -95,10 +95,10 @@ - - - - - + + + + + \ No newline at end of file From 91e07337a95b2f1fca848726e02a76d0eb28f09f Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Wed, 19 Aug 2015 19:31:41 +0100 Subject: [PATCH 009/295] Update SDK version to 23 --- CHANGELOG.md | 1 + README.md | 4 ++-- SensingKitLib/SensingKitLib.iml | 2 +- SensingKitLib/build.gradle | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e790924..ea97843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Added support for Humidity sensor module - Updated Google Play Services to 7.8.0 - Added support for Android Studio 1.3.1 + - Added support for Android 6.0 SDK (Marshmallow) - Updated gradle to 1.3.0 ### 0.2.0 diff --git a/README.md b/README.md index 7ae7d69..d988094 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,8 @@ repositories { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'org.sensingkit:SensingKitLib-release@aar' - compile 'com.android.support:appcompat-v7:22.2.1’ - compile 'com.google.android.gms:play-services-location:7.5.0' + compile 'com.android.support:appcompat-v7:23.0.0’ + compile 'com.google.android.gms:play-services-location:7.8.0' } ``` diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 1343bad..915824c 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -93,7 +93,7 @@ - + diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 0c2aa58..2e2a16e 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 + compileSdkVersion 23 buildToolsVersion "22.0.1" defaultConfig { minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "0.2.0" + targetSdkVersion 23 + versionCode 2 + versionName "0.3.0" } buildTypes { release { From 6c76af6e954a35b021f3d28f8894a15e222e936a Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 24 Aug 2015 12:14:20 +0100 Subject: [PATCH 010/295] Fix CHANGELOG format --- CHANGELOG.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea97843..1b2b44a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,21 @@ # Changelog ### Next - - Added support for Air Pressure sensor module - - Added support for Humidity sensor module - - Updated Google Play Services to 7.8.0 - - Added support for Android Studio 1.3.1 - - Added support for Android 6.0 SDK (Marshmallow) - - Updated gradle to 1.3.0 +- Added support for Air Pressure sensor module +- Added support for Humidity sensor module +- Updated Google Play Services to 7.8.0 +- Added support for Android Studio 1.3.1 +- Added support for Android 6.0 SDK (Marshmallow) +- Updated gradle to 1.3.0 ### 0.2.0 - - Added support for Bluetooth sensor module - - DataInterface method getDataInString() has been renamed to getDataInCSV() - - SKDataInterface has been renamed to SKSensorData - - Added getSensorModuleType() to SKSensorData - - Added SK prefix to all source files - - Added support for Android Studio 1.3 - - Updated Build Tools version to 22.0.1 +- Added support for Bluetooth sensor module +- DataInterface method getDataInString() has been renamed to getDataInCSV() +- SKDataInterface has been renamed to SKSensorData +- Added getSensorModuleType() to SKSensorData +- Added SK prefix to all source files +- Added support for Android Studio 1.3 +- Updated Build Tools version to 22.0.1 ### 0.1.0 - - Initial Release +- Initial Release \ No newline at end of file From 7c3eb3949920d624b1f20460e1b4df11c3228512 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 24 Aug 2015 12:14:56 +0100 Subject: [PATCH 011/295] Automatic change from latest Android Studio --- SensingKitLib/SensingKitLib.iml | 2 -- 1 file changed, 2 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 915824c..f3455b2 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -89,8 +89,6 @@ - - From 0636235e400e851760fec7822024010164ebc826 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 25 Aug 2015 19:25:24 +0100 Subject: [PATCH 012/295] Add release dates in CHANGELOG --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b2b44a..26d0f57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Added support for Android 6.0 SDK (Marshmallow) - Updated gradle to 1.3.0 -### 0.2.0 +### 0.2.0 (July 30, 2015) - Added support for Bluetooth sensor module - DataInterface method getDataInString() has been renamed to getDataInCSV() - SKDataInterface has been renamed to SKSensorData @@ -17,5 +17,5 @@ - Added support for Android Studio 1.3 - Updated Build Tools version to 22.0.1 -### 0.1.0 +### 0.1.0 (July 13, 2015) - Initial Release \ No newline at end of file From 094bac59f667d182650c8b7185456bf66358f3db Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 12 Oct 2015 14:02:54 +0100 Subject: [PATCH 013/295] Update Play Services and Android Studio --- CHANGELOG.md | 4 ++-- SensingKitLib/SensingKitLib.iml | 14 ++++++++------ SensingKitLib/build.gradle | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d0f57..6f827ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ ### Next - Added support for Air Pressure sensor module - Added support for Humidity sensor module -- Updated Google Play Services to 7.8.0 -- Added support for Android Studio 1.3.1 +- Updated Google Play Services to 8.1.0 +- Added support for Android Studio 1.4.0 - Added support for Android 6.0 SDK (Marshmallow) - Updated gradle to 1.3.0 diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index f3455b2..c8d3148 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -73,9 +73,10 @@ - - - + + + + @@ -93,10 +94,11 @@ + + + - - - + \ No newline at end of file diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 2e2a16e..fa70aad 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,5 +20,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.android.gms:play-services-location:7.8.0' + compile 'com.google.android.gms:play-services-location:8.1.0' } From 21287a911a91ad7e21dbf2d9e67258e79ce24c15 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Wed, 4 Nov 2015 11:38:23 +0000 Subject: [PATCH 014/295] Rename SKSensorModuleType into SKSensorType --- .../sensingkitlib/SKSensorDataListener.java | 2 +- .../sensingkitlib/SKSensorModuleManager.java | 78 +++++++++---------- ...ensorModuleType.java => SKSensorType.java} | 2 +- .../sensingkitlib/SensingKitLib.java | 40 +++++----- .../sensingkitlib/SensingKitLibInterface.java | 20 ++--- .../sensingkitlib/data/SKAbstractData.java | 12 +-- .../data/SKAccelerometerData.java | 4 +- .../sensingkitlib/data/SKActivityData.java | 4 +- .../sensingkitlib/data/SKAirPressureData.java | 4 +- .../data/SKAmbientTemperatureData.java | 4 +- .../sensingkitlib/data/SKAudioLevelData.java | 4 +- .../sensingkitlib/data/SKBatteryData.java | 4 +- .../sensingkitlib/data/SKBluetoothData.java | 4 +- .../data/SKBluetoothDeviceData.java | 4 +- .../sensingkitlib/data/SKGravityData.java | 4 +- .../sensingkitlib/data/SKGyroscopeData.java | 4 +- .../sensingkitlib/data/SKHumidityData.java | 4 +- .../sensingkitlib/data/SKLightData.java | 4 +- .../data/SKLinearAccelerationData.java | 4 +- .../sensingkitlib/data/SKLocationData.java | 4 +- .../data/SKMagnetometerData.java | 4 +- .../sensingkitlib/data/SKRotationData.java | 4 +- .../data/SKScreenStatusData.java | 4 +- .../sensingkitlib/data/SKSensorData.java | 4 +- .../sensingkitlib/data/SKStepCounterData.java | 4 +- .../data/SKStepDetectorData.java | 4 +- .../SKAbstractGoogleServicesSensorModule.java | 6 +- .../modules/SKAbstractNativeSensorModule.java | 10 +-- .../modules/SKAbstractSensorModule.java | 16 ++-- .../modules/SKAccelerometer.java | 4 +- .../sensingkitlib/modules/SKActivity.java | 4 +- .../sensingkitlib/modules/SKAirPressure.java | 4 +- .../modules/SKAmbientTemperature.java | 4 +- .../sensingkitlib/modules/SKAudioLevel.java | 4 +- .../modules/SKAudioRecorder.java | 4 +- .../sensingkitlib/modules/SKBattery.java | 4 +- .../sensingkitlib/modules/SKBluetooth.java | 4 +- .../sensingkitlib/modules/SKGravity.java | 4 +- .../sensingkitlib/modules/SKGyroscope.java | 4 +- .../sensingkitlib/modules/SKHumidity.java | 4 +- .../sensingkitlib/modules/SKLight.java | 4 +- .../modules/SKLinearAcceleration.java | 4 +- .../sensingkitlib/modules/SKLocation.java | 4 +- .../sensingkitlib/modules/SKMagnetometer.java | 4 +- .../sensingkitlib/modules/SKRotation.java | 4 +- .../sensingkitlib/modules/SKScreenStatus.java | 4 +- .../modules/SKSensorModuleInterface.java | 4 +- .../modules/SKSensorModuleUtilities.java | 6 +- .../sensingkitlib/modules/SKStepCounter.java | 4 +- .../sensingkitlib/modules/SKStepDetector.java | 4 +- 50 files changed, 176 insertions(+), 176 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{SKSensorModuleType.java => SKSensorType.java} (97%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java index 5126a60..d12b283 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java @@ -25,6 +25,6 @@ public interface SKSensorDataListener { - void onDataReceived(final SKSensorModuleType moduleType, final SKSensorData sensorData); + void onDataReceived(final SKSensorType sensorType, final SKSensorData sensorData); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java index 6fa3582..c95ecae 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java @@ -61,70 +61,70 @@ private SKSensorModuleManager(final Context context) throws SKException { mSensors = new SparseArray<>(TOTAL_SENSOR_MODULES); } - public void registerSensorModule(SKSensorModuleType moduleType) throws SKException { + public void registerSensorModule(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Register sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Register sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (isSensorModuleRegistered(moduleType)) { + if (isSensorModuleRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is already registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Register the SensorModule - int sensorIndex = moduleType.ordinal(); - SKAbstractSensorModule sensorModule = createSensorModule(moduleType); + int sensorIndex = sensorType.ordinal(); + SKAbstractSensorModule sensorModule = createSensorModule(sensorType); mSensors.put(sensorIndex, sensorModule); } - public void deregisterSensorModule(SKSensorModuleType moduleType) throws SKException { + public void deregisterSensorModule(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Deregister sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Deregister sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (!isSensorModuleRegistered(moduleType)) { + if (!isSensorModuleRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - if (isSensorModuleSensing(moduleType)) { + if (isSensorModuleSensing(sensorType)) { throw new SKException(TAG, "SensorModule is currently sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Clear all Callbacks from that sensor - getSensorModule(moduleType).unsubscribeAllSensorDataListeners(); + getSensorModule(sensorType).unsubscribeAllSensorDataListeners(); // Deregister the SensorModule - int sensorIndex = moduleType.ordinal(); + int sensorIndex = sensorType.ordinal(); mSensors.delete(sensorIndex); } - public boolean isSensorModuleRegistered(SKSensorModuleType moduleType) throws SKException { + public boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException { - int sensorIndex = moduleType.ordinal(); + int sensorIndex = sensorType.ordinal(); return (mSensors.get(sensorIndex) != null); } - public boolean isSensorModuleSensing(SKSensorModuleType moduleType) throws SKException { + public boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException { - if (!isSensorModuleRegistered(moduleType)) { + if (!isSensorModuleRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - return getSensorModule(moduleType).isSensing(); + return getSensorModule(sensorType).isSensing(); } - protected SKAbstractSensorModule getSensorModule(SKSensorModuleType moduleType) throws SKException { + protected SKAbstractSensorModule getSensorModule(SKSensorType sensorType) throws SKException { - if (!isSensorModuleRegistered(moduleType)) { + if (!isSensorModuleRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - int sensorIndex = moduleType.ordinal(); + int sensorIndex = sensorType.ordinal(); return mSensors.get(sensorIndex); } - protected SKAbstractSensorModule createSensorModule(SKSensorModuleType moduleType) throws SKException { + protected SKAbstractSensorModule createSensorModule(SKSensorType sensorType) throws SKException { SKAbstractSensorModule sensorModule; - switch (moduleType) { + switch (sensorType) { case ACCELEROMETER: sensorModule = new SKAccelerometer(mApplicationContext); @@ -211,55 +211,55 @@ protected SKAbstractSensorModule createSensorModule(SKSensorModuleType moduleTyp return sensorModule; } - public SKSensorData getDataFromSensor(SKSensorModuleType moduleType) throws SKException { + public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Get data from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Get data from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); throw new SKException(TAG, "This feature is not supported just yet!", SKExceptionErrorCode.UNKNOWN_ERROR); } - public void subscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException { + public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - Log.i(TAG, "Subscribe to sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Subscribe to sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - getSensorModule(moduleType).subscribeSensorDataListener(dataListener); + getSensorModule(sensorType).subscribeSensorDataListener(dataListener); } - public void unsubscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException { + public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - Log.i(TAG, "Unsubscribe from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Unsubscribe from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - getSensorModule(moduleType).unsubscribeSensorDataListener(dataListener); + getSensorModule(sensorType).unsubscribeSensorDataListener(dataListener); } - public void unsubscribeAllSensorDataListeners(SKSensorModuleType moduleType) throws SKException { + public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { Log.i(TAG, "Unsubscribe from all sensors."); - getSensorModule(moduleType).unsubscribeAllSensorDataListeners(); + getSensorModule(sensorType).unsubscribeAllSensorDataListeners(); } - public void startContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException { + public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Start sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Start sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (isSensorModuleSensing(moduleType)) { + if (isSensorModuleSensing(sensorType)) { throw new SKException(TAG, "SensorModule is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Start Sensing - getSensorModule(moduleType).startSensing(); + getSensorModule(sensorType).startSensing(); } - public void stopContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException { + public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Stop sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(moduleType) + "."); + Log.i(TAG, "Stop sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (!isSensorModuleSensing(moduleType)) { + if (!isSensorModuleSensing(sensorType)) { throw new SKException(TAG, "SensorModule is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } - SKSensorModuleInterface sensorModule = getSensorModule(moduleType); + SKSensorModuleInterface sensorModule = getSensorModule(sensorType); // Stop Sensing sensorModule.stopSensing(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 91b7b67..4b9a9ad 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib; -public enum SKSensorModuleType { +public enum SKSensorType { ACCELEROMETER, GRAVITY, LINEAR_ACCELERATION, diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 82d4d2e..c42b7aa 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -59,53 +59,53 @@ private SensingKitLib(final Context context) throws SKException { } @Override - public void registerSensorModule(SKSensorModuleType moduleType) throws SKException { - mSensorModuleManager.registerSensorModule(moduleType); + public void registerSensorModule(SKSensorType sensorType) throws SKException { + mSensorModuleManager.registerSensorModule(sensorType); } @Override - public void deregisterSensorModule(SKSensorModuleType moduleType) throws SKException { - mSensorModuleManager.deregisterSensorModule(moduleType); + public void deregisterSensorModule(SKSensorType sensorType) throws SKException { + mSensorModuleManager.deregisterSensorModule(sensorType); } @Override - public boolean isSensorModuleRegistered(SKSensorModuleType moduleType) throws SKException { - return mSensorModuleManager.isSensorModuleRegistered(moduleType); + public boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException { + return mSensorModuleManager.isSensorModuleRegistered(sensorType); } @Override - public SKSensorData getDataFromSensor(SKSensorModuleType moduleType) throws SKException { - return mSensorModuleManager.getDataFromSensor(moduleType); + public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { + return mSensorModuleManager.getDataFromSensor(sensorType); } @Override - public void subscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException { - mSensorModuleManager.subscribeSensorDataListener(moduleType, dataListener); + public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { + mSensorModuleManager.subscribeSensorDataListener(sensorType, dataListener); } @Override - public void unsubscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException { - mSensorModuleManager.unsubscribeSensorDataListener(moduleType, dataListener); + public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { + mSensorModuleManager.unsubscribeSensorDataListener(sensorType, dataListener); } @Override - public void unsubscribeAllSensorDataListeners(SKSensorModuleType moduleType) throws SKException { - mSensorModuleManager.unsubscribeAllSensorDataListeners(moduleType); + public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { + mSensorModuleManager.unsubscribeAllSensorDataListeners(sensorType); } @Override - public void startContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException { - mSensorModuleManager.startContinuousSensingWithSensor(moduleType); + public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { + mSensorModuleManager.startContinuousSensingWithSensor(sensorType); } @Override - public void stopContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException { - mSensorModuleManager.stopContinuousSensingWithSensor(moduleType); + public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { + mSensorModuleManager.stopContinuousSensingWithSensor(sensorType); } @Override - public boolean isSensorModuleSensing(SKSensorModuleType moduleType) throws SKException { - return mSensorModuleManager.isSensorModuleSensing(moduleType); + public boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException { + return mSensorModuleManager.isSensorModuleSensing(sensorType); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java index 3e1e2f3..1663163 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java @@ -28,11 +28,11 @@ public interface SensingKitLibInterface { /** Sensor Registration */ - void registerSensorModule(SKSensorModuleType moduleType) throws SKException; + void registerSensorModule(SKSensorType sensorType) throws SKException; - void deregisterSensorModule(SKSensorModuleType moduleType) throws SKException; + void deregisterSensorModule(SKSensorType sensorType) throws SKException; - boolean isSensorModuleRegistered(SKSensorModuleType moduleType) throws SKException; + boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException; /** Configuration */ // TODO: Add Configuration @@ -40,22 +40,22 @@ public interface SensingKitLibInterface { /** One Shot Sensing */ - SKSensorData getDataFromSensor(SKSensorModuleType moduleType) throws SKException; + SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException; /** Continuous Sensing */ - void subscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException; + void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; - void unsubscribeSensorDataListener(SKSensorModuleType moduleType, SKSensorDataListener dataListener) throws SKException; + void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; - void unsubscribeAllSensorDataListeners(SKSensorModuleType moduleType) throws SKException; + void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException; - void startContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException; + void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; - void stopContinuousSensingWithSensor(SKSensorModuleType moduleType) throws SKException; + void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; - boolean isSensorModuleSensing(SKSensorModuleType moduleType) throws SKException; + boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException; /** Time */ diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java index d843a44..cd24162 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java @@ -21,18 +21,18 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; public abstract class SKAbstractData implements SKSensorData { @SuppressWarnings("unused") private static final String TAG = "SKAbstractData"; - protected final SKSensorModuleType moduleType; + protected final SKSensorType sensorType; protected final long timestamp; - public SKAbstractData(SKSensorModuleType moduleType, long timestamp) { - this.moduleType = moduleType; + public SKAbstractData(SKSensorType sensorType, long timestamp) { + this.sensorType = sensorType; this.timestamp = timestamp; } @@ -41,8 +41,8 @@ public String toString() { } @SuppressWarnings("unused") - public SKSensorModuleType getSensorModuleType() { - return moduleType; + public SKSensorType getSensorType() { + return sensorType; } @SuppressWarnings("unused") diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java index 49b259b..d2937e9 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKAccelerometerData extends SKAbstractData { public SKAccelerometerData(long timestamp, float x, float y, float z) { - super(SKSensorModuleType.ACCELEROMETER, timestamp); + super(SKSensorType.ACCELEROMETER, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java index e5c451e..80fdc14 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java @@ -23,7 +23,7 @@ import com.google.android.gms.location.DetectedActivity; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -37,7 +37,7 @@ public class SKActivityData extends SKAbstractData { public SKActivityData(long timestamp, int activityType, int confidence) { - super(SKSensorModuleType.ACTIVITY, timestamp); + super(SKSensorType.ACTIVITY, timestamp); this.activityType = activityType; this.confidence = confidence; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java index 41306d6..c2cc38a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKAirPressureData extends SKAbstractData { public SKAirPressureData(long timestamp, float pressure) { - super(SKSensorModuleType.AIR_PRESSURE, timestamp); + super(SKSensorType.AIR_PRESSURE, timestamp); this.pressure = pressure; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java index 24149dd..229a05b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKAmbientTemperatureData extends SKAbstractData { public SKAmbientTemperatureData(long timestamp, float temperature) { - super(SKSensorModuleType.AMBIENT_TEMPERATURE, timestamp); + super(SKSensorType.AMBIENT_TEMPERATURE, timestamp); this.temperature = temperature; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java index ed37722..df078f2 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKAudioLevelData extends SKAbstractData { public SKAudioLevelData(long timestamp, int level) { - super(SKSensorModuleType.AUDIO_LEVEL, timestamp); + super(SKSensorType.AUDIO_LEVEL, timestamp); this.level = level; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java index 152f11f..ce5118d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java @@ -23,7 +23,7 @@ import android.os.BatteryManager; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -44,7 +44,7 @@ public class SKBatteryData extends SKAbstractData { public SKBatteryData(long timestamp, int level, int scale, int temperature, int voltage, int plugged, int status, int health) { - super(SKSensorModuleType.BATTERY, timestamp); + super(SKSensorType.BATTERY, timestamp); this.level = level; this.scale = scale; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java index be3938f..a7c8410 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.ArrayList; import java.util.Locale; @@ -35,7 +35,7 @@ public class SKBluetoothData extends SKAbstractData { public SKBluetoothData(long timestamp, ArrayList bluetoothDevices) { - super(SKSensorModuleType.BLUETOOTH, timestamp); + super(SKSensorType.BLUETOOTH, timestamp); this.mBluetoothDevices = bluetoothDevices; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java index b9c7e64..d4f2c44 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKBluetoothDeviceData extends SKAbstractData { public SKBluetoothDeviceData(long timestamp, String name, String address, int rssi) { - super(SKSensorModuleType.BLUETOOTH, timestamp); + super(SKSensorType.BLUETOOTH, timestamp); this.name = name; this.address = address; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java index a589256..f51e47d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKGravityData extends SKAbstractData { public SKGravityData(long timestamp, float x, float y, float z) { - super(SKSensorModuleType.GRAVITY, timestamp); + super(SKSensorType.GRAVITY, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java index b798680..da3a904 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKGyroscopeData extends SKAbstractData { public SKGyroscopeData(long timestamp, float x, float y, float z) { - super(SKSensorModuleType.GYROSCOPE, timestamp); + super(SKSensorType.GYROSCOPE, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java index 600680f..8c910a6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKHumidityData extends SKAbstractData { public SKHumidityData(long timestamp, float humidity) { - super(SKSensorModuleType.HUMIDITY, timestamp); + super(SKSensorType.HUMIDITY, timestamp); this.humidity = humidity; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java index 5a69bed..1badf50 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKLightData extends SKAbstractData { public SKLightData(long timestamp, float light) { - super(SKSensorModuleType.LIGHT, timestamp); + super(SKSensorType.LIGHT, timestamp); this.light = light; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java index c6280c4..74cf396 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKLinearAccelerationData extends SKAbstractData { public SKLinearAccelerationData(long timestamp, float x, float y, float z) { - super(SKSensorModuleType.LINEAR_ACCELERATION, timestamp); + super(SKSensorType.LINEAR_ACCELERATION, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java index 9772596..298a078 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java @@ -23,7 +23,7 @@ import android.location.Location; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -37,7 +37,7 @@ public class SKLocationData extends SKAbstractData { public SKLocationData(long timestamp, Location location) { - super(SKSensorModuleType.LOCATION, timestamp); + super(SKSensorType.LOCATION, timestamp); this.location = location; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java index 0b109bc..f444adb 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -36,7 +36,7 @@ public class SKMagnetometerData extends SKAbstractData { public SKMagnetometerData(long timestamp, float x, float y, float z) { - super(SKSensorModuleType.MAGNETOMETER, timestamp); + super(SKSensorType.MAGNETOMETER, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java index 51a7fc4..87e1ac2 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -38,7 +38,7 @@ public class SKRotationData extends SKAbstractData { public SKRotationData(long timestamp, float x, float y, float z, float cos, float headingAccuracy) { - super(SKSensorModuleType.ROTATION, timestamp); + super(SKSensorType.ROTATION, timestamp); this.x = x; this.y = y; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java index 3f28892..449f5b1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -38,7 +38,7 @@ public class SKScreenStatusData extends SKAbstractData { public SKScreenStatusData(long timestamp, int status) { - super(SKSensorModuleType.SCREEN_STATUS, timestamp); + super(SKSensorType.SCREEN_STATUS, timestamp); this.status = status; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKSensorData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKSensorData.java index b124970..c0490cc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKSensorData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKSensorData.java @@ -21,12 +21,12 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; @SuppressWarnings("unused") public interface SKSensorData { - SKSensorModuleType getSensorModuleType(); + SKSensorType getSensorType(); String getDataInCSV(); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java index f1d95ca..a88a603 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -34,7 +34,7 @@ public class SKStepCounterData extends SKAbstractData { public SKStepCounterData(long timestamp, float steps) { - super(SKSensorModuleType.STEP_COUNTER, timestamp); + super(SKSensorType.STEP_COUNTER, timestamp); this.steps = steps; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java index 6f584fb..089902e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java @@ -21,7 +21,7 @@ package org.sensingkit.sensingkitlib.data; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; @@ -32,7 +32,7 @@ public class SKStepDetectorData extends SKAbstractData { public SKStepDetectorData(long timestamp) { - super(SKSensorModuleType.STEP_DETECTOR, timestamp); + super(SKSensorType.STEP_DETECTOR, timestamp); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java index 98c1567..259eb37 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java @@ -28,7 +28,7 @@ import com.google.android.gms.common.api.GoogleApiClient; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; public abstract class SKAbstractGoogleServicesSensorModule extends SKAbstractSensorModule implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { @@ -38,8 +38,8 @@ public abstract class SKAbstractGoogleServicesSensorModule extends SKAbstractSen protected GoogleApiClient mClient; - protected SKAbstractGoogleServicesSensorModule(final Context context, final SKSensorModuleType sensorModuleType) throws SKException { - super(context, sensorModuleType); + protected SKAbstractGoogleServicesSensorModule(final Context context, final SKSensorType sensorType) throws SKException { + super(context, sensorType); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java index 55ce541..a1f1dbb 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java @@ -31,7 +31,7 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; public abstract class SKAbstractNativeSensorModule extends SKAbstractSensorModule { @@ -43,11 +43,11 @@ public abstract class SKAbstractNativeSensorModule extends SKAbstractSensorModul private final Sensor mSensor; private final SensorEventListener mSensorEventListener; - protected SKAbstractNativeSensorModule(final Context context, final SKSensorModuleType sensorModuleType) throws SKException { - super(context, sensorModuleType); + protected SKAbstractNativeSensorModule(final Context context, final SKSensorType sensorType) throws SKException { + super(context, sensorType); mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); - mSensor = mSensorManager.getDefaultSensor(getSensorType(sensorModuleType)); + mSensor = mSensorManager.getDefaultSensor(getSensorType(sensorType)); mSensorEventListener = new SensorEventListener() { @@ -91,7 +91,7 @@ public void stopSensing() { protected abstract SKAbstractData buildData(SensorEvent event); @SuppressLint("InlinedApi") // There is a check in STEP_DETECTOR and STEP_COUNTER - private static int getSensorType(SKSensorModuleType sensorType) throws SKException{ + private static int getSensorType(SKSensorType sensorType) throws SKException{ switch (sensorType) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java index 8cf134f..58f5223 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java @@ -26,7 +26,7 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; import org.sensingkit.sensingkitlib.SKSensorDataListener; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import java.util.ArrayList; @@ -37,26 +37,26 @@ public abstract class SKAbstractSensorModule implements SKSensorModuleInterface private static final String TAG = "SKAbstractSensorModule"; protected final Context mApplicationContext; - protected final SKSensorModuleType mSensorModuleType; + protected final SKSensorType mSensorType; protected boolean isSensing = false; protected ArrayList mSensorDataListeners; - protected SKAbstractSensorModule(final Context context, final SKSensorModuleType sensorModuleType) { + protected SKAbstractSensorModule(final Context context, final SKSensorType sensorType) { this.mApplicationContext = context; - this.mSensorModuleType = sensorModuleType; + this.mSensorType = sensorType; } public boolean isSensing() { return isSensing; } - public SKSensorModuleType getSensorType() { - return this.mSensorModuleType; + public SKSensorType getSensorType() { + return this.mSensorType; } public String getSensorName() throws SKException { - return SKSensorModuleUtilities.getSensorModuleInString(mSensorModuleType); + return SKSensorModuleUtilities.getSensorModuleInString(mSensorType); } public void subscribeSensorDataListener(SKSensorDataListener callback) throws SKException { @@ -107,7 +107,7 @@ protected void submitSensorData(SKAbstractData data) { // CallBack with data as parameter for (SKSensorDataListener callback : mSensorDataListeners) { - callback.onDataReceived(mSensorModuleType, data); + callback.onDataReceived(mSensorType, data); } } } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java index 53256c2..609526d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAccelerometerData; @@ -35,7 +35,7 @@ public class SKAccelerometer extends SKAbstractNativeSensorModule { private static final String TAG = "SKAccelerometer"; public SKAccelerometer(final Context context) throws SKException { - super(context, SKSensorModuleType.ACCELEROMETER); + super(context, SKSensorType.ACCELEROMETER); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java index 401d75e..584643a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java @@ -36,7 +36,7 @@ import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKActivityData; @@ -54,7 +54,7 @@ public class SKActivity extends SKAbstractGoogleServicesSensorModule { private int mLastConfidenceSensed = Integer.MAX_VALUE; public SKActivity(final Context context) throws SKException { - super(context, SKSensorModuleType.ACTIVITY); + super(context, SKSensorType.ACTIVITY); mClient = new GoogleApiClient.Builder(context) .addApi(ActivityRecognition.API) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java index 66cce7c..816a99d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAirPressureData; @@ -35,7 +35,7 @@ public class SKAirPressure extends SKAbstractNativeSensorModule { private static final String TAG = "SKAirPressure"; public SKAirPressure(final Context context) throws SKException { - super(context, SKSensorModuleType.AIR_PRESSURE); + super(context, SKSensorType.AIR_PRESSURE); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java index a2e5ea8..6e09653 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAmbientTemperatureData; @@ -35,7 +35,7 @@ public class SKAmbientTemperature extends SKAbstractNativeSensorModule { private static final String TAG = "SKAmbientTemperature"; public SKAmbientTemperature(final Context context) throws SKException { - super(context, SKSensorModuleType.AMBIENT_TEMPERATURE); + super(context, SKSensorType.AMBIENT_TEMPERATURE); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java index 7a62f21..04df325 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java @@ -27,7 +27,7 @@ import android.media.MediaRecorder; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAudioLevelData; @@ -44,7 +44,7 @@ public class SKAudioLevel extends SKAbstractSensorModule { private final AudioRecord audioRecord; public SKAudioLevel(final Context context) throws SKException { - super(context, SKSensorModuleType.AUDIO_LEVEL); + super(context, SKSensorType.AUDIO_LEVEL); // Configure the AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java index 9f447be..f5c3a32 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java @@ -27,7 +27,7 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import java.io.IOException; @@ -42,7 +42,7 @@ public class SKAudioRecorder extends SKAbstractSensorModule { private final MediaRecorder recorder; public SKAudioRecorder(final Context context) throws SKException { - super(context, SKSensorModuleType.AUDIO_RECORDER); + super(context, SKSensorType.AUDIO_RECORDER); recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java index c2efefd..295976f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java @@ -27,7 +27,7 @@ import android.content.IntentFilter; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKBatteryData; @@ -48,7 +48,7 @@ public class SKBattery extends SKAbstractSensorModule { private final BroadcastReceiver mBroadcastReceiver; public SKBattery(final Context context) throws SKException { - super(context, SKSensorModuleType.BATTERY); + super(context, SKSensorType.BATTERY); mBroadcastReceiver = new BroadcastReceiver() { @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java index 513344d..fb9bb6e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java @@ -30,7 +30,7 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKBluetoothData; import org.sensingkit.sensingkitlib.data.SKBluetoothDeviceData; @@ -47,7 +47,7 @@ public class SKBluetooth extends SKAbstractSensorModule { private ArrayList mBluetoothDevices; public SKBluetooth(Context context) throws SKException { - super(context, SKSensorModuleType.BLUETOOTH); + super(context, SKSensorType.BLUETOOTH); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); mBluetoothDevices = new ArrayList<>(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java index ef89cf9..7e76a6b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKGravityData; @@ -35,7 +35,7 @@ public class SKGravity extends SKAbstractNativeSensorModule { private static final String TAG = "SKGravity"; public SKGravity(final Context context) throws SKException { - super(context, SKSensorModuleType.GRAVITY); + super(context, SKSensorType.GRAVITY); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java index 370e841..3612506 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKGyroscopeData; @@ -35,7 +35,7 @@ public class SKGyroscope extends SKAbstractNativeSensorModule { private static final String TAG = "SKGyroscope"; public SKGyroscope(final Context context) throws SKException { - super(context, SKSensorModuleType.GYROSCOPE); + super(context, SKSensorType.GYROSCOPE); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java index 6e7fb7a..352564e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKHumidityData; @@ -35,7 +35,7 @@ public class SKHumidity extends SKAbstractNativeSensorModule { private static final String TAG = "SKHumidity"; public SKHumidity(final Context context) throws SKException { - super(context, SKSensorModuleType.HUMIDITY); + super(context, SKSensorType.HUMIDITY); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java index df76ac0..8953e6e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLightData; @@ -37,7 +37,7 @@ public class SKLight extends SKAbstractNativeSensorModule { private float lastLightSensed = Float.MAX_VALUE; public SKLight(final Context context) throws SKException { - super(context, SKSensorModuleType.LIGHT); + super(context, SKSensorType.LIGHT); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java index c2dfd01..4fab3f5 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLinearAccelerationData; @@ -35,7 +35,7 @@ public class SKLinearAcceleration extends SKAbstractNativeSensorModule { private static final String TAG = "SKLinearAcceleration"; public SKLinearAcceleration(final Context context) throws SKException { - super(context, SKSensorModuleType.LINEAR_ACCELERATION); + super(context, SKSensorType.LINEAR_ACCELERATION); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java index 1d267fd..0871d89 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java @@ -30,7 +30,7 @@ import com.google.android.gms.location.LocationServices; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLocationData; @@ -40,7 +40,7 @@ public class SKLocation extends SKAbstractGoogleServicesSensorModule implements private static final String TAG = "SKLocation"; public SKLocation(final Context context) throws SKException { - super(context, SKSensorModuleType.LOCATION); + super(context, SKSensorType.LOCATION); mClient = new GoogleApiClient.Builder(context) .addApi(LocationServices.API) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java index 4320821..cb3e6f2 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKMagnetometerData; @@ -35,7 +35,7 @@ public class SKMagnetometer extends SKAbstractNativeSensorModule { private static final String TAG = "SKMagnetometer"; public SKMagnetometer(final Context context) throws SKException { - super(context, SKSensorModuleType.MAGNETOMETER); + super(context, SKSensorType.MAGNETOMETER); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java index 82b359f..3cb454e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKRotationData; @@ -35,7 +35,7 @@ public class SKRotation extends SKAbstractNativeSensorModule { private static final String TAG = "SKRotation"; public SKRotation(final Context context) throws SKException { - super(context, SKSensorModuleType.ROTATION); + super(context, SKSensorType.ROTATION); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java index 73e4166..871edde 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java @@ -27,7 +27,7 @@ import android.content.IntentFilter; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKScreenStatusData; @@ -39,7 +39,7 @@ public class SKScreenStatus extends SKAbstractSensorModule { private static final String TAG = "SKScreenStatus"; public SKScreenStatus(final Context context) throws SKException { - super(context, SKSensorModuleType.SCREEN_STATUS); + super(context, SKSensorType.SCREEN_STATUS); mBroadcastReceiver = new BroadcastReceiver() { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java index 94bbc18..343ce27 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java @@ -23,12 +23,12 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKSensorDataListener; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; @SuppressWarnings("unused") public interface SKSensorModuleInterface { - SKSensorModuleType getSensorType(); + SKSensorType getSensorType(); void startSensing() throws SKException; void stopSensing(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java index cfd793f..cfcae3b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java @@ -23,16 +23,16 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; public final class SKSensorModuleUtilities { @SuppressWarnings("unused") private static final String TAG = "SKSensorModuleUtilities"; - public static String getSensorModuleInString(SKSensorModuleType moduleType) throws SKException { + public static String getSensorModuleInString(SKSensorType sensorType) throws SKException { - switch (moduleType) { + switch (sensorType) { case ACCELEROMETER: return "Accelerometer"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java index 8513a5c..2f793a9 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKStepCounterData; @@ -35,7 +35,7 @@ public class SKStepCounter extends SKAbstractNativeSensorModule { private static final String TAG = "SKStepCounter"; public SKStepCounter(final Context context) throws SKException { - super(context, SKSensorModuleType.STEP_COUNTER); + super(context, SKSensorType.STEP_COUNTER); } @Override diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java index f6c7d1f..c1b191b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java @@ -25,7 +25,7 @@ import android.hardware.SensorEvent; import org.sensingkit.sensingkitlib.SKException; -import org.sensingkit.sensingkitlib.SKSensorModuleType; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKStepDetectorData; @@ -35,7 +35,7 @@ public class SKStepDetector extends SKAbstractNativeSensorModule { private static final String TAG = "SKStepDetector"; public SKStepDetector(final Context context) throws SKException { - super(context, SKSensorModuleType.STEP_DETECTOR); + super(context, SKSensorType.STEP_DETECTOR); } @Override From fac15884634557f5b83836679fba93c17a9bbb7f Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 15:37:24 +0000 Subject: [PATCH 015/295] Rename some functions in SensingKitLinbInterface Also change names in SensingKitLib that implements SensingKitLibInterface. --- .../java/org/sensingkit/sensingkitlib/SensingKitLib.java | 8 ++++---- .../sensingkit/sensingkitlib/SensingKitLibInterface.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index c42b7aa..451ba07 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -59,17 +59,17 @@ private SensingKitLib(final Context context) throws SKException { } @Override - public void registerSensorModule(SKSensorType sensorType) throws SKException { + public void registerSensor(SKSensorType sensorType) throws SKException { mSensorModuleManager.registerSensorModule(sensorType); } @Override - public void deregisterSensorModule(SKSensorType sensorType) throws SKException { + public void deregisterSensor(SKSensorType sensorType) throws SKException { mSensorModuleManager.deregisterSensorModule(sensorType); } @Override - public boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException { + public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { return mSensorModuleManager.isSensorModuleRegistered(sensorType); } @@ -104,7 +104,7 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx } @Override - public boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException { + public boolean isSensorSensing(SKSensorType sensorType) throws SKException { return mSensorModuleManager.isSensorModuleSensing(sensorType); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java index 1663163..8b0a2d8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java @@ -28,11 +28,11 @@ public interface SensingKitLibInterface { /** Sensor Registration */ - void registerSensorModule(SKSensorType sensorType) throws SKException; + void registerSensor(SKSensorType sensorType) throws SKException; - void deregisterSensorModule(SKSensorType sensorType) throws SKException; + void deregisterSensor(SKSensorType sensorType) throws SKException; - boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException; + boolean isSensorRegistered(SKSensorType sensorType) throws SKException; /** Configuration */ // TODO: Add Configuration @@ -55,7 +55,7 @@ public interface SensingKitLibInterface { void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; - boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException; + boolean isSensorSensing(SKSensorType sensorType) throws SKException; /** Time */ From 0b795cb358a75b5ae1d02ed57cf3bbb70990ad8b Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 16:19:12 +0000 Subject: [PATCH 016/295] Rename SKSensorModule file into SKSensorManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also change some functions’ names --- ...oduleManager.java => SKSensorManager.java} | 54 +++++++++---------- .../sensingkitlib/SensingKitLib.java | 12 ++--- 2 files changed, 33 insertions(+), 33 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{SKSensorModuleManager.java => SKSensorManager.java} (81%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java similarity index 81% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index c95ecae..7ea9f6d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorModuleManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -28,32 +28,32 @@ import org.sensingkit.sensingkitlib.data.SKSensorData; import org.sensingkit.sensingkitlib.modules.*; -public class SKSensorModuleManager { +public class SKSensorManager { @SuppressWarnings("unused") - private static final String TAG = "SKSensorModuleManager"; + private static final String TAG = "SKSensorManager"; private static final int TOTAL_SENSOR_MODULES = 19; - private static SKSensorModuleManager sSensorModuleManager; + private static SKSensorManager sSensorManager; private final Context mApplicationContext; private final SparseArray mSensors; - public static SKSensorModuleManager getSensorManager(final Context context) throws SKException { + public static SKSensorManager getSensorManager(final Context context) throws SKException { if (context == null) { throw new SKException(TAG, "Context cannot be null.", SKExceptionErrorCode.UNKNOWN_ERROR); } - if (sSensorModuleManager == null) { - sSensorModuleManager = new SKSensorModuleManager(context); + if (sSensorManager == null) { + sSensorManager = new SKSensorManager(context); } - return sSensorModuleManager; + return sSensorManager; } - private SKSensorModuleManager(final Context context) throws SKException { + private SKSensorManager(final Context context) throws SKException { mApplicationContext = context; @@ -61,11 +61,11 @@ private SKSensorModuleManager(final Context context) throws SKException { mSensors = new SparseArray<>(TOTAL_SENSOR_MODULES); } - public void registerSensorModule(SKSensorType sensorType) throws SKException { + public void registerSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Register sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (isSensorModuleRegistered(sensorType)) { + if (isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is already registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } @@ -75,44 +75,44 @@ public void registerSensorModule(SKSensorType sensorType) throws SKException { mSensors.put(sensorIndex, sensorModule); } - public void deregisterSensorModule(SKSensorType sensorType) throws SKException { + public void deregisterSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Deregister sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (!isSensorModuleRegistered(sensorType)) { + if (!isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - if (isSensorModuleSensing(sensorType)) { + if (isSensorSensing(sensorType)) { throw new SKException(TAG, "SensorModule is currently sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Clear all Callbacks from that sensor - getSensorModule(sensorType).unsubscribeAllSensorDataListeners(); + getSensor(sensorType).unsubscribeAllSensorDataListeners(); // Deregister the SensorModule int sensorIndex = sensorType.ordinal(); mSensors.delete(sensorIndex); } - public boolean isSensorModuleRegistered(SKSensorType sensorType) throws SKException { + public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { int sensorIndex = sensorType.ordinal(); return (mSensors.get(sensorIndex) != null); } - public boolean isSensorModuleSensing(SKSensorType sensorType) throws SKException { + public boolean isSensorSensing(SKSensorType sensorType) throws SKException { - if (!isSensorModuleRegistered(sensorType)) { + if (!isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - return getSensorModule(sensorType).isSensing(); + return getSensor(sensorType).isSensing(); } - protected SKAbstractSensorModule getSensorModule(SKSensorType sensorType) throws SKException { + protected SKAbstractSensorModule getSensor(SKSensorType sensorType) throws SKException { - if (!isSensorModuleRegistered(sensorType)) { + if (!isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } @@ -222,44 +222,44 @@ public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataLis Log.i(TAG, "Subscribe to sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - getSensorModule(sensorType).subscribeSensorDataListener(dataListener); + getSensor(sensorType).subscribeSensorDataListener(dataListener); } public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { Log.i(TAG, "Unsubscribe from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - getSensorModule(sensorType).unsubscribeSensorDataListener(dataListener); + getSensor(sensorType).unsubscribeSensorDataListener(dataListener); } public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { Log.i(TAG, "Unsubscribe from all sensors."); - getSensorModule(sensorType).unsubscribeAllSensorDataListeners(); + getSensor(sensorType).unsubscribeAllSensorDataListeners(); } public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Start sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (isSensorModuleSensing(sensorType)) { + if (isSensorSensing(sensorType)) { throw new SKException(TAG, "SensorModule is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Start Sensing - getSensorModule(sensorType).startSensing(); + getSensor(sensorType).startSensing(); } public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Stop sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); - if (!isSensorModuleSensing(sensorType)) { + if (!isSensorSensing(sensorType)) { throw new SKException(TAG, "SensorModule is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } - SKSensorModuleInterface sensorModule = getSensorModule(sensorType); + SKSensorModuleInterface sensorModule = getSensor(sensorType); // Stop Sensing sensorModule.stopSensing(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 451ba07..025a4d4 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -37,7 +37,7 @@ public class SensingKitLib implements SensingKitLibInterface { private final Context mApplicationContext; private PowerManager.WakeLock mWakeLock; - private SKSensorModuleManager mSensorModuleManager; + private SKSensorManager mSensorModuleManager; @SuppressWarnings("unused") public static SensingKitLibInterface getSensingKitLib(final Context context) throws SKException { @@ -55,22 +55,22 @@ public static SensingKitLibInterface getSensingKitLib(final Context context) thr private SensingKitLib(final Context context) throws SKException { mApplicationContext = context; - mSensorModuleManager = SKSensorModuleManager.getSensorManager(context); + mSensorModuleManager = SKSensorManager.getSensorManager(context); } @Override public void registerSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.registerSensorModule(sensorType); + mSensorModuleManager.registerSensor(sensorType); } @Override public void deregisterSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.deregisterSensorModule(sensorType); + mSensorModuleManager.deregisterSensor(sensorType); } @Override public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { - return mSensorModuleManager.isSensorModuleRegistered(sensorType); + return mSensorModuleManager.isSensorRegistered(sensorType); } @Override @@ -105,7 +105,7 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx @Override public boolean isSensorSensing(SKSensorType sensorType) throws SKException { - return mSensorModuleManager.isSensorModuleSensing(sensorType); + return mSensorModuleManager.isSensorSensing(sensorType); } @Override From a9ba85b89a6d8599533b149b98be67d00dc31e74 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 16:42:55 +0000 Subject: [PATCH 017/295] Rename SKSensorModuleInterface into SKSensorInterface --- .../main/java/org/sensingkit/sensingkitlib/SKSensorManager.java | 2 +- .../sensingkitlib/modules/SKAbstractSensorModule.java | 2 +- .../{SKSensorModuleInterface.java => SKSensorInterface.java} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/{SKSensorModuleInterface.java => SKSensorInterface.java} (97%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 7ea9f6d..58174f6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -259,7 +259,7 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx throw new SKException(TAG, "SensorModule is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } - SKSensorModuleInterface sensorModule = getSensor(sensorType); + SKSensorInterface sensorModule = getSensor(sensorType); // Stop Sensing sensorModule.stopSensing(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java index 58f5223..4e0429d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java @@ -31,7 +31,7 @@ import java.util.ArrayList; -public abstract class SKAbstractSensorModule implements SKSensorModuleInterface { +public abstract class SKAbstractSensorModule implements SKSensorInterface { @SuppressWarnings("unused") private static final String TAG = "SKAbstractSensorModule"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java index 343ce27..d6650c9 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java @@ -26,7 +26,7 @@ import org.sensingkit.sensingkitlib.SKSensorType; @SuppressWarnings("unused") -public interface SKSensorModuleInterface { +public interface SKSensorInterface { SKSensorType getSensorType(); From 8918235dfd2d0702620757bd57f58ef945ffdbaf Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 16:53:17 +0000 Subject: [PATCH 018/295] Rename SKAbstractSensorModule into SKAbstractSensor Also fix all files using it --- .../org/sensingkit/sensingkitlib/SKSensorManager.java | 10 +++++----- .../modules/SKAbstractGoogleServicesSensorModule.java | 2 +- .../modules/SKAbstractNativeSensorModule.java | 2 +- ...AbstractSensorModule.java => SKAbstractSensor.java} | 6 +++--- .../sensingkit/sensingkitlib/modules/SKAudioLevel.java | 2 +- .../sensingkitlib/modules/SKAudioRecorder.java | 2 +- .../sensingkit/sensingkitlib/modules/SKBattery.java | 2 +- .../sensingkit/sensingkitlib/modules/SKBluetooth.java | 2 +- .../sensingkitlib/modules/SKScreenStatus.java | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/{SKAbstractSensorModule.java => SKAbstractSensor.java} (94%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 58174f6..6513059 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -38,7 +38,7 @@ public class SKSensorManager { private static SKSensorManager sSensorManager; private final Context mApplicationContext; - private final SparseArray mSensors; + private final SparseArray mSensors; public static SKSensorManager getSensorManager(final Context context) throws SKException { @@ -71,7 +71,7 @@ public void registerSensor(SKSensorType sensorType) throws SKException { // Register the SensorModule int sensorIndex = sensorType.ordinal(); - SKAbstractSensorModule sensorModule = createSensorModule(sensorType); + SKAbstractSensor sensorModule = createSensorModule(sensorType); mSensors.put(sensorIndex, sensorModule); } @@ -110,7 +110,7 @@ public boolean isSensorSensing(SKSensorType sensorType) throws SKException { return getSensor(sensorType).isSensing(); } - protected SKAbstractSensorModule getSensor(SKSensorType sensorType) throws SKException { + protected SKAbstractSensor getSensor(SKSensorType sensorType) throws SKException { if (!isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); @@ -120,9 +120,9 @@ protected SKAbstractSensorModule getSensor(SKSensorType sensorType) throws SKExc return mSensors.get(sensorIndex); } - protected SKAbstractSensorModule createSensorModule(SKSensorType sensorType) throws SKException { + protected SKAbstractSensor createSensorModule(SKSensorType sensorType) throws SKException { - SKAbstractSensorModule sensorModule; + SKAbstractSensor sensorModule; switch (sensorType) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java index 259eb37..9959d1e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java @@ -31,7 +31,7 @@ import org.sensingkit.sensingkitlib.SKSensorType; -public abstract class SKAbstractGoogleServicesSensorModule extends SKAbstractSensorModule implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { +public abstract class SKAbstractGoogleServicesSensorModule extends SKAbstractSensor implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { @SuppressWarnings("unused") private static final String TAG = "SKAbstractGoogleServicesSensorModule"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java index a1f1dbb..eac24ed 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java @@ -34,7 +34,7 @@ import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; -public abstract class SKAbstractNativeSensorModule extends SKAbstractSensorModule { +public abstract class SKAbstractNativeSensorModule extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKAbstractNativeSensorModule"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java similarity index 94% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java index 4e0429d..15a16e1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java @@ -31,17 +31,17 @@ import java.util.ArrayList; -public abstract class SKAbstractSensorModule implements SKSensorInterface { +public abstract class SKAbstractSensor implements SKSensorInterface { @SuppressWarnings("unused") - private static final String TAG = "SKAbstractSensorModule"; + private static final String TAG = "SKAbstractSensor"; protected final Context mApplicationContext; protected final SKSensorType mSensorType; protected boolean isSensing = false; protected ArrayList mSensorDataListeners; - protected SKAbstractSensorModule(final Context context, final SKSensorType sensorType) { + protected SKAbstractSensor(final Context context, final SKSensorType sensorType) { this.mApplicationContext = context; this.mSensorType = sensorType; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java index 04df325..4bf3917 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java @@ -31,7 +31,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAudioLevelData; -public class SKAudioLevel extends SKAbstractSensorModule { +public class SKAudioLevel extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKAudioLevel"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java index f5c3a32..0d1ea7f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java @@ -32,7 +32,7 @@ import java.io.IOException; -public class SKAudioRecorder extends SKAbstractSensorModule { +public class SKAudioRecorder extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKAudioRecorder"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java index 295976f..7de93e8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java @@ -31,7 +31,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKBatteryData; -public class SKBattery extends SKAbstractSensorModule { +public class SKBattery extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKBattery"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java index fb9bb6e..d7c8866 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java @@ -38,7 +38,7 @@ import java.util.ArrayList; @SuppressWarnings("ResourceType") -public class SKBluetooth extends SKAbstractSensorModule { +public class SKBluetooth extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKBluetooth"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java index 871edde..658e808 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java @@ -31,7 +31,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKScreenStatusData; -public class SKScreenStatus extends SKAbstractSensorModule { +public class SKScreenStatus extends SKAbstractSensor { private final BroadcastReceiver mBroadcastReceiver; From aeec32b7e18b6b3790c02b94815d0b85a550e2c8 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 16:56:04 +0000 Subject: [PATCH 019/295] Rename SKAbstractGoogleServicesSensorModule into SKAbstractGoogleServicesSensor Also fix all files using it --- ...ensorModule.java => SKAbstractGoogleServicesSensor.java} | 6 +++--- .../org/sensingkit/sensingkitlib/modules/SKActivity.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKLocation.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/{SKAbstractGoogleServicesSensorModule.java => SKAbstractGoogleServicesSensor.java} (85%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java similarity index 85% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java index 9959d1e..ee59c54 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java @@ -31,14 +31,14 @@ import org.sensingkit.sensingkitlib.SKSensorType; -public abstract class SKAbstractGoogleServicesSensorModule extends SKAbstractSensor implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { +public abstract class SKAbstractGoogleServicesSensor extends SKAbstractSensor implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { @SuppressWarnings("unused") - private static final String TAG = "SKAbstractGoogleServicesSensorModule"; + private static final String TAG = "SKAbstractGoogleServicesSensor"; protected GoogleApiClient mClient; - protected SKAbstractGoogleServicesSensorModule(final Context context, final SKSensorType sensorType) throws SKException { + protected SKAbstractGoogleServicesSensor(final Context context, final SKSensorType sensorType) throws SKException { super(context, sensorType); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java index 584643a..0b543bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java @@ -40,7 +40,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKActivityData; -public class SKActivity extends SKAbstractGoogleServicesSensorModule { +public class SKActivity extends SKAbstractGoogleServicesSensor { @SuppressWarnings("unused") private static final String TAG = "SKActivity"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java index 0871d89..7cb19b8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java @@ -34,7 +34,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLocationData; -public class SKLocation extends SKAbstractGoogleServicesSensorModule implements LocationListener { +public class SKLocation extends SKAbstractGoogleServicesSensor implements LocationListener { @SuppressWarnings("unused") private static final String TAG = "SKLocation"; From 141485f0d925239eb981bffa5ab2e16a337730f9 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 17:01:43 +0000 Subject: [PATCH 020/295] Rename SKAbstractNativeSensorModule into SKAbstractNativeSensor Also fix all files using it --- ...actNativeSensorModule.java => SKAbstractNativeSensor.java} | 4 ++-- .../org/sensingkit/sensingkitlib/modules/SKAccelerometer.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKAirPressure.java | 2 +- .../sensingkitlib/modules/SKAmbientTemperature.java | 2 +- .../java/org/sensingkit/sensingkitlib/modules/SKGravity.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKGyroscope.java | 2 +- .../java/org/sensingkit/sensingkitlib/modules/SKHumidity.java | 2 +- .../java/org/sensingkit/sensingkitlib/modules/SKLight.java | 2 +- .../sensingkitlib/modules/SKLinearAcceleration.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKMagnetometer.java | 2 +- .../java/org/sensingkit/sensingkitlib/modules/SKRotation.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKStepCounter.java | 2 +- .../org/sensingkit/sensingkitlib/modules/SKStepDetector.java | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/{SKAbstractNativeSensorModule.java => SKAbstractNativeSensor.java} (96%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java similarity index 96% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java index eac24ed..051d9fe 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensorModule.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java @@ -34,7 +34,7 @@ import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; -public abstract class SKAbstractNativeSensorModule extends SKAbstractSensor { +public abstract class SKAbstractNativeSensor extends SKAbstractSensor { @SuppressWarnings("unused") private static final String TAG = "SKAbstractNativeSensorModule"; @@ -43,7 +43,7 @@ public abstract class SKAbstractNativeSensorModule extends SKAbstractSensor { private final Sensor mSensor; private final SensorEventListener mSensorEventListener; - protected SKAbstractNativeSensorModule(final Context context, final SKSensorType sensorType) throws SKException { + protected SKAbstractNativeSensor(final Context context, final SKSensorType sensorType) throws SKException { super(context, sensorType); mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java index 609526d..daa97dc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAccelerometerData; -public class SKAccelerometer extends SKAbstractNativeSensorModule { +public class SKAccelerometer extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKAccelerometer"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java index 816a99d..6338096 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAirPressureData; -public class SKAirPressure extends SKAbstractNativeSensorModule { +public class SKAirPressure extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKAirPressure"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java index 6e09653..539761d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKAmbientTemperatureData; -public class SKAmbientTemperature extends SKAbstractNativeSensorModule { +public class SKAmbientTemperature extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKAmbientTemperature"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java index 7e76a6b..855bad0 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKGravityData; -public class SKGravity extends SKAbstractNativeSensorModule { +public class SKGravity extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKGravity"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java index 3612506..a4a643f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKGyroscopeData; -public class SKGyroscope extends SKAbstractNativeSensorModule { +public class SKGyroscope extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKGyroscope"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java index 352564e..a47b6a0 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKHumidityData; -public class SKHumidity extends SKAbstractNativeSensorModule { +public class SKHumidity extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKHumidity"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java index 8953e6e..093dd07 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLightData; -public class SKLight extends SKAbstractNativeSensorModule { +public class SKLight extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKLight"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java index 4fab3f5..dc06e5a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKLinearAccelerationData; -public class SKLinearAcceleration extends SKAbstractNativeSensorModule { +public class SKLinearAcceleration extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKLinearAcceleration"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java index cb3e6f2..1529983 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKMagnetometerData; -public class SKMagnetometer extends SKAbstractNativeSensorModule { +public class SKMagnetometer extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKMagnetometer"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java index 3cb454e..78bf716 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKRotationData; -public class SKRotation extends SKAbstractNativeSensorModule { +public class SKRotation extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKRotation"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java index 2f793a9..e5282c1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKStepCounterData; -public class SKStepCounter extends SKAbstractNativeSensorModule { +public class SKStepCounter extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKStepCounter"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java index c1b191b..c2f808f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java @@ -29,7 +29,7 @@ import org.sensingkit.sensingkitlib.data.SKAbstractData; import org.sensingkit.sensingkitlib.data.SKStepDetectorData; -public class SKStepDetector extends SKAbstractNativeSensorModule { +public class SKStepDetector extends SKAbstractNativeSensor { @SuppressWarnings("unused") private static final String TAG = "SKStepDetector"; From 19b74619c9e603ade411fbc29fa4cc7ab20101eb Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 17:07:38 +0000 Subject: [PATCH 021/295] Rename functions and variables in SKSensorManager --- .../sensingkitlib/SKSensorManager.java | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 6513059..c7a1884 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -69,10 +69,10 @@ public void registerSensor(SKSensorType sensorType) throws SKException { throw new SKException(TAG, "SensorModule is already registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } - // Register the SensorModule + // Register the Sensor int sensorIndex = sensorType.ordinal(); - SKAbstractSensor sensorModule = createSensorModule(sensorType); - mSensors.put(sensorIndex, sensorModule); + SKAbstractSensor sensor = createSensor(sensorType); + mSensors.put(sensorIndex, sensor); } public void deregisterSensor(SKSensorType sensorType) throws SKException { @@ -80,17 +80,17 @@ public void deregisterSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Deregister sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); if (!isSensorRegistered(sensorType)) { - throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } if (isSensorSensing(sensorType)) { - throw new SKException(TAG, "SensorModule is currently sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is currently sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Clear all Callbacks from that sensor getSensor(sensorType).unsubscribeAllSensorDataListeners(); - // Deregister the SensorModule + // Deregister the Sensor int sensorIndex = sensorType.ordinal(); mSensors.delete(sensorIndex); } @@ -104,7 +104,7 @@ public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { public boolean isSensorSensing(SKSensorType sensorType) throws SKException { if (!isSensorRegistered(sensorType)) { - throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } return getSensor(sensorType).isSensing(); @@ -113,102 +113,102 @@ public boolean isSensorSensing(SKSensorType sensorType) throws SKException { protected SKAbstractSensor getSensor(SKSensorType sensorType) throws SKException { if (!isSensorRegistered(sensorType)) { - throw new SKException(TAG, "SensorModule is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); } int sensorIndex = sensorType.ordinal(); return mSensors.get(sensorIndex); } - protected SKAbstractSensor createSensorModule(SKSensorType sensorType) throws SKException { + protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKException { - SKAbstractSensor sensorModule; + SKAbstractSensor sensor; switch (sensorType) { case ACCELEROMETER: - sensorModule = new SKAccelerometer(mApplicationContext); + sensor = new SKAccelerometer(mApplicationContext); break; case GRAVITY: - sensorModule = new SKGravity(mApplicationContext); + sensor = new SKGravity(mApplicationContext); break; case LINEAR_ACCELERATION: - sensorModule = new SKLinearAcceleration(mApplicationContext); + sensor = new SKLinearAcceleration(mApplicationContext); break; case GYROSCOPE: - sensorModule = new SKGyroscope(mApplicationContext); + sensor = new SKGyroscope(mApplicationContext); break; case ROTATION: - sensorModule = new SKRotation(mApplicationContext); + sensor = new SKRotation(mApplicationContext); break; case MAGNETOMETER: - sensorModule = new SKMagnetometer(mApplicationContext); + sensor = new SKMagnetometer(mApplicationContext); break; case AMBIENT_TEMPERATURE: - sensorModule = new SKAmbientTemperature(mApplicationContext); + sensor = new SKAmbientTemperature(mApplicationContext); break; case STEP_DETECTOR: - sensorModule = new SKStepDetector(mApplicationContext); + sensor = new SKStepDetector(mApplicationContext); break; case STEP_COUNTER: - sensorModule = new SKStepCounter(mApplicationContext); + sensor = new SKStepCounter(mApplicationContext); break; case LIGHT: - sensorModule = new SKLight(mApplicationContext); + sensor = new SKLight(mApplicationContext); break; case LOCATION: - sensorModule = new SKLocation(mApplicationContext); + sensor = new SKLocation(mApplicationContext); break; case ACTIVITY: - sensorModule = new SKActivity(mApplicationContext); + sensor = new SKActivity(mApplicationContext); break; case BATTERY: - sensorModule = new SKBattery(mApplicationContext); + sensor = new SKBattery(mApplicationContext); break; case SCREEN_STATUS: - sensorModule = new SKScreenStatus(mApplicationContext); + sensor = new SKScreenStatus(mApplicationContext); break; case AUDIO_RECORDER: - sensorModule = new SKAudioRecorder(mApplicationContext); + sensor = new SKAudioRecorder(mApplicationContext); break; case AUDIO_LEVEL: - sensorModule = new SKAudioLevel(mApplicationContext); + sensor = new SKAudioLevel(mApplicationContext); break; case BLUETOOTH: - sensorModule = new SKBluetooth(mApplicationContext); + sensor = new SKBluetooth(mApplicationContext); break; case HUMIDITY: - sensorModule = new SKHumidity(mApplicationContext); + sensor = new SKHumidity(mApplicationContext); break; case AIR_PRESSURE: - sensorModule = new SKAirPressure(mApplicationContext); + sensor = new SKAirPressure(mApplicationContext); break; // Don't forget the break; here default: - throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Unknown Sensor", SKExceptionErrorCode.UNKNOWN_ERROR); } - return sensorModule; + return sensor; } public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { @@ -244,7 +244,7 @@ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKE Log.i(TAG, "Start sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); if (isSensorSensing(sensorType)) { - throw new SKException(TAG, "SensorModule is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Start Sensing @@ -256,13 +256,13 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx Log.i(TAG, "Stop sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); if (!isSensorSensing(sensorType)) { - throw new SKException(TAG, "SensorModule is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } - SKSensorInterface sensorModule = getSensor(sensorType); + SKSensorInterface sensor = getSensor(sensorType); // Stop Sensing - sensorModule.stopSensing(); + sensor.stopSensing(); } } From a1e0360693c1c50b635018d486be6e9a5478e547 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 17:12:30 +0000 Subject: [PATCH 022/295] Rename SKSensorModuleUtilities into SKSensorUtilities Also fix all files using it --- .../sensingkit/sensingkitlib/SKSensorManager.java | 14 +++++++------- .../sensingkitlib/modules/SKAbstractSensor.java | 2 +- ...ModuleUtilities.java => SKSensorUtilities.java} | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/{SKSensorModuleUtilities.java => SKSensorUtilities.java} (92%) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index c7a1884..bd10168 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -63,7 +63,7 @@ private SKSensorManager(final Context context) throws SKException { public void registerSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Register sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Register sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (isSensorRegistered(sensorType)) { throw new SKException(TAG, "SensorModule is already registered.", SKExceptionErrorCode.UNKNOWN_ERROR); @@ -77,7 +77,7 @@ public void registerSensor(SKSensorType sensorType) throws SKException { public void deregisterSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Deregister sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Deregister sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (!isSensorRegistered(sensorType)) { throw new SKException(TAG, "Sensor is not registered.", SKExceptionErrorCode.UNKNOWN_ERROR); @@ -213,21 +213,21 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Get data from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Get data from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); throw new SKException(TAG, "This feature is not supported just yet!", SKExceptionErrorCode.UNKNOWN_ERROR); } public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - Log.i(TAG, "Subscribe to sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Subscribe to sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); getSensor(sensorType).subscribeSensorDataListener(dataListener); } public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - Log.i(TAG, "Unsubscribe from sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Unsubscribe from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); getSensor(sensorType).unsubscribeSensorDataListener(dataListener); } @@ -241,7 +241,7 @@ public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SK public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Start sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Start sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (isSensorSensing(sensorType)) { throw new SKException(TAG, "Sensor is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); @@ -253,7 +253,7 @@ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKE public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - Log.i(TAG, "Stop sensing with sensor: " + SKSensorModuleUtilities.getSensorModuleInString(sensorType) + "."); + Log.i(TAG, "Stop sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (!isSensorSensing(sensorType)) { throw new SKException(TAG, "Sensor is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java index 15a16e1..fb86061 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java @@ -56,7 +56,7 @@ public SKSensorType getSensorType() { } public String getSensorName() throws SKException { - return SKSensorModuleUtilities.getSensorModuleInString(mSensorType); + return SKSensorUtilities.getSensorInString(mSensorType); } public void subscribeSensorDataListener(SKSensorDataListener callback) throws SKException { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java similarity index 92% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java index cfcae3b..0b2bb8b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorModuleUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java @@ -25,12 +25,12 @@ import org.sensingkit.sensingkitlib.SKExceptionErrorCode; import org.sensingkit.sensingkitlib.SKSensorType; -public final class SKSensorModuleUtilities { +public final class SKSensorUtilities { @SuppressWarnings("unused") - private static final String TAG = "SKSensorModuleUtilities"; + private static final String TAG = "SKSensorUtilities"; - public static String getSensorModuleInString(SKSensorType sensorType) throws SKException { + public static String getSensorInString(SKSensorType sensorType) throws SKException { switch (sensorType) { From c87914ea1c23fba65ba654c8a8b6f85503aeadc9 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Fri, 6 Nov 2015 17:16:46 +0000 Subject: [PATCH 023/295] Rename variables in SensingKitLib --- .../sensingkitlib/SensingKitLib.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 025a4d4..8d57614 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -37,7 +37,7 @@ public class SensingKitLib implements SensingKitLibInterface { private final Context mApplicationContext; private PowerManager.WakeLock mWakeLock; - private SKSensorManager mSensorModuleManager; + private SKSensorManager mSensorManager; @SuppressWarnings("unused") public static SensingKitLibInterface getSensingKitLib(final Context context) throws SKException { @@ -55,57 +55,57 @@ public static SensingKitLibInterface getSensingKitLib(final Context context) thr private SensingKitLib(final Context context) throws SKException { mApplicationContext = context; - mSensorModuleManager = SKSensorManager.getSensorManager(context); + mSensorManager = SKSensorManager.getSensorManager(context); } @Override public void registerSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.registerSensor(sensorType); + mSensorManager.registerSensor(sensorType); } @Override public void deregisterSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.deregisterSensor(sensorType); + mSensorManager.deregisterSensor(sensorType); } @Override public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { - return mSensorModuleManager.isSensorRegistered(sensorType); + return mSensorManager.isSensorRegistered(sensorType); } @Override public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { - return mSensorModuleManager.getDataFromSensor(sensorType); + return mSensorManager.getDataFromSensor(sensorType); } @Override public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - mSensorModuleManager.subscribeSensorDataListener(sensorType, dataListener); + mSensorManager.subscribeSensorDataListener(sensorType, dataListener); } @Override public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { - mSensorModuleManager.unsubscribeSensorDataListener(sensorType, dataListener); + mSensorManager.unsubscribeSensorDataListener(sensorType, dataListener); } @Override public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { - mSensorModuleManager.unsubscribeAllSensorDataListeners(sensorType); + mSensorManager.unsubscribeAllSensorDataListeners(sensorType); } @Override public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.startContinuousSensingWithSensor(sensorType); + mSensorManager.startContinuousSensingWithSensor(sensorType); } @Override public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { - mSensorModuleManager.stopContinuousSensingWithSensor(sensorType); + mSensorManager.stopContinuousSensingWithSensor(sensorType); } @Override public boolean isSensorSensing(SKSensorType sensorType) throws SKException { - return mSensorModuleManager.isSensorSensing(sensorType); + return mSensorManager.isSensorSensing(sensorType); } @Override From 308a6d063e617008a91963b225cca8705888a96f Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Sat, 7 Nov 2015 15:37:18 +0000 Subject: [PATCH 024/295] Update Google Play Services to 8.3.0 --- SensingKitLib/SensingKitLib.iml | 16 ++++++++-------- SensingKitLib/build.gradle | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index c8d3148..6af5ca5 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -73,10 +73,10 @@ - - - - + + + + @@ -94,11 +94,11 @@ - - - + + - + + \ No newline at end of file diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index fa70aad..7bf7c72 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,5 +20,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.android.gms:play-services-location:8.1.0' + compile 'com.google.android.gms:play-services-location:8.3.0' } From c3485b9474fcbe532b2ae497aac43234cc83e353 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Sat, 7 Nov 2015 10:39:26 +0000 Subject: [PATCH 025/295] Add start/stopContinuosSensingWithAllRegisteredSensors functions --- SensingKitLib/SensingKitLib.iml | 2 ++ .../sensingkitlib/SKSensorManager.java | 35 +++++++++++++++++-- .../sensingkitlib/SensingKitLib.java | 10 ++++++ .../sensingkitlib/SensingKitLibInterface.java | 4 +++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 6af5ca5..2473ef5 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -90,6 +90,8 @@ + + diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index bd10168..3654d30 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -244,7 +244,7 @@ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKE Log.i(TAG, "Start sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (isSensorSensing(sensorType)) { - throw new SKException(TAG, "Sensor is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor [" + SKSensorUtilities.getSensorInString(sensorType) + "] is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } // Start Sensing @@ -256,7 +256,7 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx Log.i(TAG, "Stop sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); if (!isSensorSensing(sensorType)) { - throw new SKException(TAG, "Sensor is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Sensor [" + SKSensorUtilities.getSensorInString(sensorType) + "] is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); } SKSensorInterface sensor = getSensor(sensorType); @@ -265,4 +265,35 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx sensor.stopSensing(); } + public void startContinuousSensingWithAllRegisteredSensors() throws SKException { + + for (int i = 0; i < TOTAL_SENSOR_MODULES; i++){ + if(mSensors.get(i) != null){ + Log.i(TAG, "Start sensing with sensor: " + mSensors.get(i).getSensorName() + "."); + + if (isSensorSensing(mSensors.get(i).getSensorType())) { + throw new SKException(TAG, "Sensor [" + mSensors.get(i).getSensorName() + "] is already sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + + // Start Sensing + mSensors.get(i).startSensing(); + } + } + } + + public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { + for (int i = 0; i < TOTAL_SENSOR_MODULES; i++) { + if (mSensors.get(i) != null) { + Log.i(TAG, "Stop sensing with sensor: " + mSensors.get(i).getSensorName() + "."); + + if (!isSensorSensing(mSensors.get(i).getSensorType())) { + throw new SKException(TAG, "Sensor [" + mSensors.get(i).getSensorName() + "] is already not sensing.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + + // Stop Sensing + mSensors.get(i).stopSensing(); + } + } + } + } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 8d57614..6c72829 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -103,6 +103,16 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx mSensorManager.stopContinuousSensingWithSensor(sensorType); } + @Override + public void startContinuousSensingWithAllRegisteredSensors() throws SKException { + mSensorManager.startContinuousSensingWithAllRegisteredSensors(); + } + + @Override + public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { + mSensorManager.stopContinuousSensingWithAllRegisteredSensors(); + } + @Override public boolean isSensorSensing(SKSensorType sensorType) throws SKException { return mSensorManager.isSensorSensing(sensorType); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java index 8b0a2d8..ba8796a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java @@ -55,6 +55,10 @@ public interface SensingKitLibInterface { void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; + void startContinuousSensingWithAllRegisteredSensors() throws SKException; + + void stopContinuousSensingWithAllRegisteredSensors() throws SKException; + boolean isSensorSensing(SKSensorType sensorType) throws SKException; /** Time */ From af8198422bc4e5011d0b79fd1d09ecb9c923f365 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Sun, 8 Nov 2015 16:11:14 +0000 Subject: [PATCH 026/295] Rename TOTAL_SENSOR_MODULES into TOTAL_SENSORS --- .../org/sensingkit/sensingkitlib/SKSensorManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 3654d30..a7ec061 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -33,7 +33,7 @@ public class SKSensorManager { @SuppressWarnings("unused") private static final String TAG = "SKSensorManager"; - private static final int TOTAL_SENSOR_MODULES = 19; + private static final int TOTAL_SENSORS = 19; private static SKSensorManager sSensorManager; private final Context mApplicationContext; @@ -58,7 +58,7 @@ private SKSensorManager(final Context context) throws SKException { mApplicationContext = context; // Init Sensor Array - mSensors = new SparseArray<>(TOTAL_SENSOR_MODULES); + mSensors = new SparseArray<>(TOTAL_SENSORS); } public void registerSensor(SKSensorType sensorType) throws SKException { @@ -267,7 +267,7 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx public void startContinuousSensingWithAllRegisteredSensors() throws SKException { - for (int i = 0; i < TOTAL_SENSOR_MODULES; i++){ + for (int i = 0; i < TOTAL_SENSORS; i++){ if(mSensors.get(i) != null){ Log.i(TAG, "Start sensing with sensor: " + mSensors.get(i).getSensorName() + "."); @@ -282,7 +282,7 @@ public void startContinuousSensingWithAllRegisteredSensors() throws SKException } public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { - for (int i = 0; i < TOTAL_SENSOR_MODULES; i++) { + for (int i = 0; i < TOTAL_SENSORS; i++) { if (mSensors.get(i) != null) { Log.i(TAG, "Stop sensing with sensor: " + mSensors.get(i).getSensorName() + "."); From c4dae8d5bb387e2708f2d4576fcc0d68a6b700fe Mon Sep 17 00:00:00 2001 From: U3D3 Date: Sun, 8 Nov 2015 16:16:58 +0000 Subject: [PATCH 027/295] Rename modules folder into sensors --- SensingKitLib/src/main/AndroidManifest.xml | 2 +- .../main/java/org/sensingkit/sensingkitlib/SKSensorManager.java | 2 +- .../{modules => sensors}/SKAbstractGoogleServicesSensor.java | 2 +- .../{modules => sensors}/SKAbstractNativeSensor.java | 2 +- .../sensingkitlib/{modules => sensors}/SKAbstractSensor.java | 2 +- .../sensingkitlib/{modules => sensors}/SKAccelerometer.java | 2 +- .../sensingkitlib/{modules => sensors}/SKActivity.java | 2 +- .../SKActivityRecognitionIntentService.java | 2 +- .../sensingkitlib/{modules => sensors}/SKAirPressure.java | 2 +- .../{modules => sensors}/SKAmbientTemperature.java | 2 +- .../sensingkitlib/{modules => sensors}/SKAudioLevel.java | 2 +- .../sensingkitlib/{modules => sensors}/SKAudioRecorder.java | 2 +- .../sensingkitlib/{modules => sensors}/SKBattery.java | 2 +- .../sensingkitlib/{modules => sensors}/SKBluetooth.java | 2 +- .../sensingkitlib/{modules => sensors}/SKGravity.java | 2 +- .../sensingkitlib/{modules => sensors}/SKGyroscope.java | 2 +- .../sensingkitlib/{modules => sensors}/SKHumidity.java | 2 +- .../sensingkit/sensingkitlib/{modules => sensors}/SKLight.java | 2 +- .../{modules => sensors}/SKLinearAcceleration.java | 2 +- .../sensingkitlib/{modules => sensors}/SKLocation.java | 2 +- .../sensingkitlib/{modules => sensors}/SKMagnetometer.java | 2 +- .../sensingkitlib/{modules => sensors}/SKRotation.java | 2 +- .../sensingkitlib/{modules => sensors}/SKScreenStatus.java | 2 +- .../sensingkitlib/{modules => sensors}/SKSensorInterface.java | 2 +- .../sensingkitlib/{modules => sensors}/SKSensorUtilities.java | 2 +- .../sensingkitlib/{modules => sensors}/SKStepCounter.java | 2 +- .../sensingkitlib/{modules => sensors}/SKStepDetector.java | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAbstractGoogleServicesSensor.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAbstractNativeSensor.java (99%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAbstractSensor.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAccelerometer.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKActivity.java (99%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKActivityRecognitionIntentService.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAirPressure.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAmbientTemperature.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAudioLevel.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKAudioRecorder.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKBattery.java (99%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKBluetooth.java (99%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKGravity.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKGyroscope.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKHumidity.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKLight.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKLinearAcceleration.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKLocation.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKMagnetometer.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKRotation.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKScreenStatus.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKSensorInterface.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKSensorUtilities.java (98%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKStepCounter.java (97%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/{modules => sensors}/SKStepDetector.java (97%) diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index ae0251e..b60ae31 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ - + diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index a7ec061..b0a2a79 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -26,7 +26,7 @@ import android.util.SparseArray; import org.sensingkit.sensingkitlib.data.SKSensorData; -import org.sensingkit.sensingkitlib.modules.*; +import org.sensingkit.sensingkitlib.sensors.*; public class SKSensorManager { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java index ee59c54..a8070f2 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractGoogleServicesSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.os.Bundle; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java similarity index 99% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java index 051d9fe..bc1eaf7 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractNativeSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.annotation.SuppressLint; import android.content.Context; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractSensor.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractSensor.java index fb86061..809bd67 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAbstractSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractSensor.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAccelerometer.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAccelerometer.java index daa97dc..cecbe65 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAccelerometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAccelerometer.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java similarity index 99% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java index 0b543bc..7a35e9f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.app.PendingIntent; import android.content.BroadcastReceiver; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivityRecognitionIntentService.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivityRecognitionIntentService.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivityRecognitionIntentService.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivityRecognitionIntentService.java index 2738806..7d04cc6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKActivityRecognitionIntentService.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivityRecognitionIntentService.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.app.IntentService; import android.content.Intent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAirPressure.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAirPressure.java index 6338096..1dcff1f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAirPressure.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAirPressure.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAmbientTemperature.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAmbientTemperature.java index 539761d..762ad82 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAmbientTemperature.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAmbientTemperature.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioLevel.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioLevel.java index 4bf3917..9fa7367 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioLevel.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioLevel.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.media.AudioFormat; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java index 0d1ea7f..2fb5319 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKAudioRecorder.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.media.MediaRecorder; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBattery.java similarity index 99% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBattery.java index 7de93e8..b86fd7d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBattery.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBattery.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java similarity index 99% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java index d7c8866..6a5366c 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKBluetooth.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGravity.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGravity.java index 855bad0..005a542 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGravity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGravity.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGyroscope.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGyroscope.java index a4a643f..37d16bb 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKGyroscope.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKGyroscope.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKHumidity.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKHumidity.java index a47b6a0..86d9b98 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKHumidity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKHumidity.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLight.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLight.java index 093dd07..0c3f10a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLight.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLight.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLinearAcceleration.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLinearAcceleration.java index dc06e5a..0aa83c1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLinearAcceleration.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLinearAcceleration.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLocation.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLocation.java index 7cb19b8..8f4f168 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKLocation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKLocation.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.util.Log; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMagnetometer.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMagnetometer.java index 1529983..b30cd5b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKMagnetometer.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMagnetometer.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKRotation.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKRotation.java index 78bf716..7bc3d9b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKRotation.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKRotation.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKScreenStatus.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKScreenStatus.java index 658e808..658cb59 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKScreenStatus.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKScreenStatus.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorInterface.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorInterface.java index d6650c9..3bfab76 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorInterface.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKSensorDataListener; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java similarity index 98% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java index 0b2bb8b..ba8708f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKSensorUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepCounter.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepCounter.java index e5282c1..2e5431b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepCounter.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepCounter.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepDetector.java similarity index 97% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepDetector.java index c2f808f..9578ce3 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/modules/SKStepDetector.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKStepDetector.java @@ -19,7 +19,7 @@ * along with SensingKit-Android. If not, see . */ -package org.sensingkit.sensingkitlib.modules; +package org.sensingkit.sensingkitlib.sensors; import android.content.Context; import android.hardware.SensorEvent; From e25ef223e81091f516339f7b9a060bb3436c1cf6 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Sat, 14 Nov 2015 15:21:15 +0000 Subject: [PATCH 028/295] Add SKEddystoneProximityData Also add new SKSensorType --- .../sensingkitlib/SKSensorManager.java | 4 ++ .../sensingkitlib/SKSensorType.java | 3 +- .../data/SKEddystoneProximityData.java | 53 +++++++++++++++++++ .../sensors/SKEddystoneProximity.java | 34 ++++++++++++ .../sensors/SKSensorUtilities.java | 3 ++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index b0a2a79..1c59896 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -202,6 +202,10 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept sensor = new SKAirPressure(mApplicationContext); break; + case EDDYSTONE_PROXIMITY: + sensor = new SKEddystoneProximity(mApplicationContext); + break; + // Don't forget the break; here default: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 4b9a9ad..e14d8bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -40,5 +40,6 @@ public enum SKSensorType { AUDIO_LEVEL, BLUETOOTH, HUMIDITY, - AIR_PRESSURE + AIR_PRESSURE, + EDDYSTONE_PROXIMITY } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java new file mode 100644 index 0000000..d8f8e0c --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java @@ -0,0 +1,53 @@ +package org.sensingkit.sensingkitlib.data; + +import org.sensingkit.sensingkitlib.SKSensorType; + +import java.util.Locale; + +/** + * Created by U3D3 on 11/14/15. + */ +public class SKEddystoneProximityData extends SKAbstractData { + + @SuppressWarnings("unused") + private static final String TAG = "SKEddystoneProximityData"; + + protected final String namespaceId; + protected final int instanceId; + protected final int rssi; + protected final int txPower; + + public SKEddystoneProximityData(long timestamp, String namespaceId, int instanceId, int rssi, int txPower) { + super(SKSensorType.EDDYSTONE_PROXIMITY, timestamp); + this.namespaceId = namespaceId; + this.instanceId = instanceId; + this.rssi = rssi; + this.txPower = txPower; + } + + @Override + public String getDataInCSV() { + + return String.format(Locale.US, "%d,%s,%s,%d,%d", this.timestamp, this.namespaceId, this.instanceId, this.rssi, this.txPower ); + } + + @SuppressWarnings("unused") + public String getNamespaceId(){ + return this.namespaceId; + } + + @SuppressWarnings("unused") + public int getInstanceId(){ + return this.instanceId; + } + + @SuppressWarnings("unused") + public int getRssi(){ + return this.rssi; + } + + @SuppressWarnings("unused") + public int getTxPower(){ + return this.txPower; + } +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java new file mode 100644 index 0000000..70185ca --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java @@ -0,0 +1,34 @@ +package org.sensingkit.sensingkitlib.sensors; + +import android.content.Context; + +import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKSensorType; +import org.sensingkit.sensingkitlib.data.SKAbstractData; + +/** + * Created by U3D3 on 11/14/15. + */ +public class SKEddystoneProximity extends SKAbstractSensor { + + + + public SKEddystoneProximity(Context context) throws SKException{ + super(context, SKSensorType.EDDYSTONE_PROXIMITY); + } + + @Override + protected boolean shouldPostSensorData(SKAbstractData data) { + return false; + } + + @Override + public void startSensing() throws SKException { + + } + + @Override + public void stopSensing() { + + } +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java index ba8708f..7fc26e1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java @@ -91,6 +91,9 @@ public static String getSensorInString(SKSensorType sensorType) throws SKExcepti case AIR_PRESSURE: return "Air Pressure"; + case EDDYSTONE_PROXIMITY: + return "Eddystone Proximity"; + default: throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); } From d703b233136dcda57395895ac178001d5d63c3fc Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 19 Nov 2015 21:57:01 +0000 Subject: [PATCH 029/295] Update gradle to 1.5.0 --- SensingKitLib/SensingKitLib.iml | 16 ++++------------ build.gradle | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 2473ef5..c7e8c68 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -65,33 +65,25 @@ + + - - - - - - + - - - - + - - diff --git a/build.gradle b/build.gradle index 1b7886d..a6fcfe1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' + classpath 'com.android.tools.build:gradle:1.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From ee5a3f76b74e541a058509a51ab8f32b908af532 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Thu, 19 Nov 2015 21:58:57 +0000 Subject: [PATCH 030/295] Ignore GoogleAppIndexingWarning --- SensingKitLib/src/main/AndroidManifest.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index b60ae31..acc16a3 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -1,10 +1,12 @@ - + From 8ac40ff5d5177ae291ccb913614adaf6d80a7377 Mon Sep 17 00:00:00 2001 From: Susan Crayne Date: Thu, 17 Dec 2015 21:03:59 -0500 Subject: [PATCH 031/295] added permissions for BLUETOOTH and BLUETOOTH_ADMIN --- SensingKitLib/src/main/AndroidManifest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index acc16a3..3b77788 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -4,6 +4,9 @@ + + + From 1659e0cfba3a69d2a6502ef432c0db6f09efed43 Mon Sep 17 00:00:00 2001 From: Susan Crayne Date: Fri, 18 Dec 2015 10:39:33 -0500 Subject: [PATCH 032/295] undo additional permissions --- SensingKitLib/src/main/AndroidManifest.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index 3b77788..7674ee2 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -4,10 +4,7 @@ - - - - + From e1bbe1f257a035eb9ec12ca87d25a8daa5516d50 Mon Sep 17 00:00:00 2001 From: Susan Crayne Date: Tue, 22 Dec 2015 17:24:59 -0500 Subject: [PATCH 033/295] Changes after running SensingKitApp --- README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d988094..4ee7d36 100644 --- a/README.md +++ b/README.md @@ -63,28 +63,40 @@ dependencies { ## How to Use this Library -- Import and init SensingKit into your Activity class as shown bellow: +- The imports you will need are: ```java +import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.SensingKitLib; +import org.sensingkit.sensingkitlib.SensingKitLibInterface; //Document: needed to add this to init SensingKit +import org.sensingkit.sensingkitlib.data.SKSensorData; +import org.sensingkit.sensingkitlib.SKSensorDataListener; +``` + +- Init SensingKit in your Activity class as shown below: +```java +//You will need a try..catch block around this code SensingKitLibInterface mSensingKitLib = SensingKitLib.getSensingKitLib(this); ``` -- Register a sensor module (e.g. a Light sensor) as shown bellow: +- Register a sensor module (e.g. a Light sensor) as shown below: ```java -mSensingKitLib.registerSensorModule(SKSensorModuleType.LIGHT); +//You will need a try..catch block around this code +mSensingKitLib.registerSensor(SKSensorType.LIGHT); ``` - Subscribe a sensor data listener: ```java -mSensingKitLib.subscribeSensorDataListener(SKSensorModuleType.LIGHT, new SKSensorDataListener() { +//You will need a try..catch block around this code +mSensingKitLib.subscribeSensorDataListener(SKSensorType.LIGHT, new SKSensorDataListener() { @Override - public void onDataReceived(final SKSensorModuleType moduleType, final SKSensorData sensorData) { + public void onDataReceived(final SKSensorType moduleType, final SKSensorData sensorData) { System.out.println(sensorData.getDataInCSV()); // Print data in CSV format } }); @@ -102,8 +114,9 @@ SKLightData lightData = (SKLightData)sensorData; - You can Start and Stop the Continuous Sensing using the following commands: ```java -mSensingKitLib.startContinuousSensingWithSensor(SKSensorModuleType.LIGHT); -mSensingKitLib.stopContinuousSensingWithSensor(SKSensorModuleType.LIGHT); +//You will need try..catch blocks around these statements +mSensingKitLib.startContinuousSensingWithSensor(SKSensorType.LIGHT); +mSensingKitLib.stopContinuousSensingWithSensor(SKSensorType.LIGHT); ``` From b772ef69b6c52c7cf609cb7e1476b19479fcb45e Mon Sep 17 00:00:00 2001 From: Susan Crayne Date: Fri, 8 Jan 2016 14:50:01 -0500 Subject: [PATCH 034/295] changed 'getLight' to 'getHumidity' --- .../sensingkitlib/data/SKHumidityData.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java index 8c910a6..2fb2b0e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKHumidityData encapsulates measurements related to the Humidity sensor. + */ public class SKHumidityData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKHumidityData extends SKAbstractData { protected final float humidity; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param humidity Humidity measurement + */ public SKHumidityData(long timestamp, float humidity) { super(SKSensorType.HUMIDITY, timestamp); @@ -39,13 +49,18 @@ public SKHumidityData(long timestamp, float humidity) { this.humidity = humidity; } + /** + * Get humidity sensor data in CSV format + * + * @return String in CSV format: timestamp, humidity + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.humidity); } @SuppressWarnings("unused") - public float getLight() { + public float getHumidity() { return this.humidity; } From 162e0d4be502f0d6ab73ea291aaa746c54aefd01 Mon Sep 17 00:00:00 2001 From: Susan Crayne Date: Sun, 10 Jan 2016 19:23:17 -0500 Subject: [PATCH 035/295] created comments for Javadoc --- .../sensingkit/sensingkitlib/SKException.java | 16 ++++ .../sensingkitlib/SKSensorDataListener.java | 8 ++ .../sensingkitlib/SKSensorManager.java | 69 ++++++++++++++ .../sensingkitlib/SKSensorType.java | 62 +++++++++++++ .../sensingkit/sensingkitlib/SKUtilities.java | 22 +++++ .../sensingkitlib/SensingKitLib.java | 72 ++++++++++++++- .../sensingkitlib/data/SKAbstractData.java | 25 +++++ .../data/SKAccelerometerData.java | 37 ++++++++ .../sensingkitlib/data/SKActivityData.java | 43 +++++++++ .../sensingkitlib/data/SKAirPressureData.java | 21 +++++ .../data/SKAmbientTemperatureData.java | 21 +++++ .../sensingkitlib/data/SKAudioLevelData.java | 20 ++++ .../sensingkitlib/data/SKBatteryData.java | 91 ++++++++++++++++++- .../sensingkitlib/data/SKBluetoothData.java | 20 ++++ .../data/SKBluetoothDeviceData.java | 32 +++++++ .../sensingkitlib/data/SKGravityData.java | 34 +++++++ .../sensingkitlib/data/SKGyroscopeData.java | 34 +++++++ .../sensingkitlib/data/SKLightData.java | 20 ++++ .../data/SKLinearAccelerationData.java | 35 +++++++ .../sensingkitlib/data/SKLocationData.java | 20 ++++ .../data/SKMagnetometerData.java | 37 ++++++++ .../sensingkitlib/data/SKRotationData.java | 63 +++++++++++++ .../data/SKScreenStatusData.java | 24 +++++ .../sensingkitlib/data/SKStepCounterData.java | 20 ++++ .../data/SKStepDetectorData.java | 13 +++ 25 files changed, 856 insertions(+), 3 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java index 8afa1b5..660370b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java @@ -26,17 +26,33 @@ public class SKException extends Exception { private final SKExceptionErrorCode errorCode; private final String TAG; + /** + * + * @param TAG - TAG + * @param message - error message + * @param errorCode - error code + */ public SKException(String TAG, String message, SKExceptionErrorCode errorCode) { super(message); this.TAG = TAG; this.errorCode = errorCode; } + /** + * Get the error code + * + * @return error code + */ @SuppressWarnings("unused") public SKExceptionErrorCode getErrorCode() { return this.errorCode; } + /** + * Get the tag + * + * @return tag + */ @SuppressWarnings("unused") public String getTAG() { return this.TAG; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java index d12b283..41201d1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java @@ -23,7 +23,15 @@ import org.sensingkit.sensingkitlib.data.SKSensorData; + public interface SKSensorDataListener { + /** + * Event Listener to be invoked when new sensor data is available. You can cast the sensorData object + * into the actual sensor data (e.g. SKAccelerometerData), based on the reported sensorType. + *
+ * parameter sensorType The type of the sensor producing the SKSensorData object.
+ * parameter sensorData The new sensor data produced by the SKSensorType sensor. + */ void onDataReceived(final SKSensorType sensorType, final SKSensorData sensorData); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index b0a2a79..99ab93b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -61,6 +61,12 @@ private SKSensorManager(final Context context) throws SKException { mSensors = new SparseArray<>(TOTAL_SENSORS); } + + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ public void registerSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Register sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -75,6 +81,11 @@ public void registerSensor(SKSensorType sensorType) throws SKException { mSensors.put(sensorIndex, sensor); } + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ public void deregisterSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Deregister sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -95,12 +106,26 @@ public void deregisterSensor(SKSensorType sensorType) throws SKException { mSensors.delete(sensorIndex); } + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { int sensorIndex = sensorType.ordinal(); return (mSensors.get(sensorIndex) != null); } + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ public boolean isSensorSensing(SKSensorType sensorType) throws SKException { if (!isSensorRegistered(sensorType)) { @@ -211,6 +236,15 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept return sensor; } + /** + * Get data from the sensor + * + * @param sensorType of type SKSensorType + * + * @return an SKSensorData object + * + * @throws SKException + */ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Get data from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -218,6 +252,13 @@ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKExceptio throw new SKException(TAG, "This feature is not supported just yet!", SKExceptionErrorCode.UNKNOWN_ERROR); } + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { Log.i(TAG, "Subscribe to sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -225,6 +266,12 @@ public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataLis getSensor(sensorType).subscribeSensorDataListener(dataListener); } + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { Log.i(TAG, "Unsubscribe from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -232,6 +279,12 @@ public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataL getSensor(sensorType).unsubscribeSensorDataListener(dataListener); } + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ + public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { Log.i(TAG, "Unsubscribe from all sensors."); @@ -239,6 +292,11 @@ public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SK getSensor(sensorType).unsubscribeAllSensorDataListeners(); } + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Start sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -251,6 +309,11 @@ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKE getSensor(sensorType).startSensing(); } + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Stop sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -265,6 +328,9 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx sensor.stopSensing(); } + /** + * Starts continuous sensing with all registered sensors. + */ public void startContinuousSensingWithAllRegisteredSensors() throws SKException { for (int i = 0; i < TOTAL_SENSORS; i++){ @@ -281,6 +347,9 @@ public void startContinuousSensingWithAllRegisteredSensors() throws SKException } } + /** + * Stops continuous sensing with all registered sensors. + */ public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { for (int i = 0; i < TOTAL_SENSORS; i++) { if (mSensors.get(i) != null) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 4b9a9ad..52d02f1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -21,24 +21,86 @@ package org.sensingkit.sensingkitlib; +/** + * These constants indicate the type of the sensor. + */ public enum SKSensorType { + /** + * Measures the device acceleration changes in three‑dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. + */ ACCELEROMETER, + /** + * Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z). + */ GRAVITY, + /** + * Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity. + */ LINEAR_ACCELERATION, + /** + * Measures the device’s rate of rotation around each of the three spatial axes. + */ GYROSCOPE, + /** + * Measures the orientation of a device by providing the three elements of the device's rotation vector. + */ ROTATION, + /** + * Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT. + */ MAGNETOMETER, + /** + * Room temperature in degrees Celcius + */ AMBIENT_TEMPERATURE, + /** + * Returns 1.0 each time a step is taken + */ STEP_DETECTOR, + /** + * Number of steps taken by the user since the last reboot while activated + */ STEP_COUNTER, + /** + * Measures the ambient light level (illumination) in lux. + */ LIGHT, + /** + * Location sensor determines the current location of the device using a combination of Cellular, Wi‑Fi, Bluetooth and GPS sensors. It provides 2D geographical coordinate information (latitude, longitude), as well as the altitude of the device. + */ LOCATION, + /** + * Motion Activity sensor uses an embedded motion co‑processor that senses the user’s activity classified as Stationary, Walking, Running, Automotive or Cycling. + * Assume that Activity is the same as Motion Activity + */ ACTIVITY, + /** + * Battery sensor listens to changes in the battery charge state (Charging, Full, Unplugged) as well as in the battery charge level (with 1% precision). + */ BATTERY, + /** + * Not defined in IOS docs + */ SCREEN_STATUS, + /** + * Microphone sensor can be used to record audio from the environment (up to 4 hours) by converting sound into electrical signal. + * Assume that Microphone is the same as AUDIO RECORDER + */ AUDIO_RECORDER, + /** + * Maximum level of the audio signal in a buffer + */ AUDIO_LEVEL, + /** + * Get data from a bluetooth device + */ BLUETOOTH, + /** + * Relative ambient air humidity in percent + */ HUMIDITY, + /** + * Atmospheric pressure in hPa (millibar) + */ AIR_PRESSURE } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java index 3aa2e50..7547f41 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java @@ -29,6 +29,17 @@ public final class SKUtilities { @SuppressWarnings("unused") private static final String TAG = "SKUtilities"; + /** + * Check whether a given permission has been granted + * + * @param context Android Context + * + * @param permission Android permission + * + * @return 1 if permission is granted; 0 if it is not + * + * @throws SKException + */ public static boolean checkPermission(Context context, String permission) throws SKException { if (context == null) { @@ -39,10 +50,21 @@ public static boolean checkPermission(Context context, String permission) throws return (res == PackageManager.PERMISSION_GRANTED); } + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @return the current time in milliseconds + */ public static long getCurrentTimeMillis() { return System.currentTimeMillis(); } + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + * + * @return the current time in nanoseconds + + */ public static long getNanoTime() { return System.nanoTime(); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 6c72829..99197d9 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -58,16 +58,33 @@ private SensingKitLib(final Context context) throws SKException { mSensorManager = SKSensorManager.getSensorManager(context); } + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ @Override public void registerSensor(SKSensorType sensorType) throws SKException { mSensorManager.registerSensor(sensorType); } + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ @Override public void deregisterSensor(SKSensorType sensorType) throws SKException { mSensorManager.deregisterSensor(sensorType); } + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ @Override public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { return mSensorManager.isSensorRegistered(sensorType); @@ -78,51 +95,102 @@ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKExceptio return mSensorManager.getDataFromSensor(sensorType); } + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ @Override public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { mSensorManager.subscribeSensorDataListener(sensorType, dataListener); } - @Override + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ + @Override public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { mSensorManager.unsubscribeSensorDataListener(sensorType, dataListener); } - @Override + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ + @Override public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { mSensorManager.unsubscribeAllSensorDataListeners(sensorType); } + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ @Override public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { mSensorManager.startContinuousSensingWithSensor(sensorType); } + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ @Override public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { mSensorManager.stopContinuousSensingWithSensor(sensorType); } + /** + * Starts continuous sensing with all registered sensors. + */ @Override public void startContinuousSensingWithAllRegisteredSensors() throws SKException { mSensorManager.startContinuousSensingWithAllRegisteredSensors(); } + /** + * Starts continuous sensing with all registered sensors. + */ @Override public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { mSensorManager.stopContinuousSensingWithAllRegisteredSensors(); } + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ @Override public boolean isSensorSensing(SKSensorType sensorType) throws SKException { return mSensorManager.isSensorSensing(sensorType); } + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC). + * + * @return current time in milliseconds + */ @Override public long getCurrentTimeMillis() { return SKUtilities.getCurrentTimeMillis(); } + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + + * + * @return current time in nanoseconds + */ @Override public long getNanoTime() { return SKUtilities.getNanoTime(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java index cd24162..f6ae4bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java @@ -23,6 +23,9 @@ import org.sensingkit.sensingkitlib.SKSensorType; +/* +Abstract class for sensor data + */ public abstract class SKAbstractData implements SKSensorData { @SuppressWarnings("unused") @@ -31,20 +34,42 @@ public abstract class SKAbstractData implements SKSensorData protected final SKSensorType sensorType; protected final long timestamp; + /** + * Initialize the instance + * + * @param sensorType of type SKSensorType + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + */ public SKAbstractData(SKSensorType sensorType, long timestamp) { this.sensorType = sensorType; this.timestamp = timestamp; } + /** + * Get the sensor data in csv format + * + * @return String in csv format + */ public String toString() { return this.getDataInCSV(); } + /** + * Get the sensor type + * + * @return sensor type + */ @SuppressWarnings("unused") public SKSensorType getSensorType() { return sensorType; } + /** + * Get the timestamp + * + * @return timestamp + */ @SuppressWarnings("unused") public long getTimestamp() { return timestamp; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java index d2937e9..54e7633 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java @@ -25,6 +25,10 @@ import java.util.Locale; + +/** + * An instance of SKAccelerometerData encapsulates measurements related to the Accelerometer sensor. + */ public class SKAccelerometerData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +38,18 @@ public class SKAccelerometerData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis value of the Accelerometer sensor + * + * @param y Y-axis value of the Accelerometer sensor + * + * @param z Z-axis value of the Accelerometer sensor + */ + public SKAccelerometerData(long timestamp, float x, float y, float z) { super(SKSensorType.ACCELEROMETER, timestamp); @@ -43,21 +59,42 @@ public SKAccelerometerData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the accelerator measurements in csv format + * + * @returns String containing the timestamp and accelerometer measurements in csv format: timestamp,x,y,z + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the X-axis acceleromator measurement + * + * @return Float containing the X-axis value of the Accelerometer sensor + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Y-axis accelerator measurement + * + * @return Float containing the y-axis value of the Accelerometer sensor + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Z-axis accelerator measurement + * + * @return Float containing the z-axis value of the Accelerometer sensor + */ + @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java index 80fdc14..13c40bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java @@ -27,6 +27,10 @@ import java.util.Locale; +/** + * An instance of SKActivityData encapsulates measurements related to the Activity sensor. + * Activity is classified as Stationary, Walking, Running, Automotive, Cycling, Tilt, or Unknown. + */ public class SKActivityData extends SKAbstractData { @SuppressWarnings("unused") @@ -35,6 +39,15 @@ public class SKActivityData extends SKAbstractData { protected final int activityType; protected final int confidence; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param activityType The type of the activity + * + * @param confidence Confidence percentage for the most probable activity + */ public SKActivityData(long timestamp, int activityType, int confidence) { super(SKSensorType.ACTIVITY, timestamp); @@ -43,26 +56,56 @@ public SKActivityData(long timestamp, int activityType, int confidence) { this.confidence = confidence; } + /** + * Get the Activity sensor data in csv format + * + * @return Activity data in csv format: timestamp,activity type,activity string, confidence + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%d,%s,%d", this.timestamp, this.activityType, getActivityString(), this.confidence); } + /** + * Get the activity type + * + * @return Activity type + * + */ @SuppressWarnings("unused") public int getActivityType() { return this.activityType; } + /** + * Get the confidence percentage + * + * @return Confidence + * + */ @SuppressWarnings("unused") public int getConfidence() { return this.confidence; } + /** + * Get the name of the activity type + * + * @return Name of the activity type + */ @SuppressWarnings("unused") public String getActivityString() { return getNameFromActivityType(this.activityType); } + /** + * Get the name of an activity type + * + * @param activityType + * + * @return name + */ public static String getNameFromActivityType(int activityType) { switch (activityType) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java index c2cc38a..56cf740 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAirPressureData encapsulates measurements related to the Air Pressure sensor. + */ public class SKAirPressureData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAirPressureData extends SKAbstractData { protected final float pressure; + /** + * Initialize the Air Pressure data instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param pressure Air pressure + */ public SKAirPressureData(long timestamp, float pressure) { super(SKSensorType.AIR_PRESSURE, timestamp); @@ -39,11 +49,22 @@ public SKAirPressureData(long timestamp, float pressure) { this.pressure = pressure; } + /** + * Get the Air Pressure sensor data in csv format + * + * @return Air Pressure data in csv format: timestamp,air pressure + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.pressure); } + /** + * Get the Air Pressure measurement along + * + * @return Air Pressure measurement + */ @SuppressWarnings("unused") public float getLight() { return this.pressure; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java index 229a05b..d11642e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAirPressureData encapsulates measurements related to the Air Pressure sensor. + */ public class SKAmbientTemperatureData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAmbientTemperatureData extends SKAbstractData { protected final float temperature; + /** + * Initialize Ambient Temperature data instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param temperature In degrees Celsius + */ public SKAmbientTemperatureData(long timestamp, float temperature) { super(SKSensorType.AMBIENT_TEMPERATURE, timestamp); @@ -39,11 +49,22 @@ public SKAmbientTemperatureData(long timestamp, float temperature) { this.temperature = temperature; } + /** + * Get the Ambient Temperature sensor data in csv format + * + * @return Ambient Temperature data in csv format: timestamp,ambient temperature + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.temperature); } + /** + * Get only the Ambient Temperature + * + * @return Ambient Temperature + */ @SuppressWarnings("unused") public float getTemperature() { return this.temperature; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java index df078f2..0f17125 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAudioLevelData encapsulates measurements related to the Audio Level sensor. + */ public class SKAudioLevelData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAudioLevelData extends SKAbstractData { protected final int level; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param level - Audio Level + */ public SKAudioLevelData(long timestamp, int level) { super(SKSensorType.AUDIO_LEVEL, timestamp); @@ -39,11 +49,21 @@ public SKAudioLevelData(long timestamp, int level) { this.level = level; } + /** + * Get the audio level measurement in csv format + * + * @returns String containing the timestamp and audio level measurements in csv format: timestamp,level + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%d", this.timestamp, this.level); } + /** + * Get the audio level only + * + * @return Audio level + */ @SuppressWarnings("unused") public int getLevel() { return this.level; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java index ce5118d..b0a38ae 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java @@ -29,6 +29,9 @@ import static android.os.BatteryManager.*; +/** + * An instance of SKBatteryData encapsulates Battery properties + */ public class SKBatteryData extends SKAbstractData { @SuppressWarnings("unused") @@ -42,6 +45,27 @@ public class SKBatteryData extends SKAbstractData { protected final int status; protected final int health; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param level Indicates the current battery charge level. Value ranges from 0 to maximum battery level + * + * @param scale Maximum battery level + * + * @param temperature Current battery temperature + * + * @param voltage Current battery voltage + * + * @param plugged Values are: 0 - on battery, BATTERY_PLUGGED_AC, BATTERY_PLUGGED_USB, BATTERY_PLUGGED_WIRELESS + * + * @param status Values are: BATTERY_STATUS_CHARGING, BATTERY_STATUS_DISCHARGING, BATTERY_STATUS_FULL, + * BATTERY_STATUS_NOT_CHARGING, BATTERY_STATUS_UNKNOWN + * + * @param health Values are: BATTERY_HEALTH_COLD, BATTERY_HEALTH_DEAD, BATTERY_HEALTH_GOOD, BATTERY_HEALTH_OVERHEAT, + * BATTERY_HEALTH_OVER_VOLTAGE, BATTERY_HEALTH_UNKNOWN + */ public SKBatteryData(long timestamp, int level, int scale, int temperature, int voltage, int plugged, int status, int health) { super(SKSensorType.BATTERY, timestamp); @@ -55,11 +79,26 @@ public SKBatteryData(long timestamp, int level, int scale, int temperature, int this.health = health; } - @Override + /** + * Get the battery properties in csv format + * + * @return String containing the battery properties in csv format: timestamp,charge,temperature, + * voltage, + * plugged string ("usb", "ac", "wireless" or "unknown"), + * status string ("charging", "discharging", "full", "not charging", "unknown" or "unsupported"), + * health string ("cold", "dead", "good", "over heat", "over voltage", "unknown", "failure" or "unsupported") + */ + + @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%d,%d,%s,%s,%s", this.timestamp, this.getLevelRatio(), this.temperature, this.voltage, getPluggedString(), getBatteryStatusString(), getBatteryHealthString()); } + /** + * Get the battery charge + * + * @return charge (level/scale) + */ @SuppressWarnings("unused") public float getLevelRatio() { @@ -72,51 +111,101 @@ public float getLevelRatio() { } } + /** + * Get the battery level + * + * @return level + */ @SuppressWarnings("unused") public int getLevel() { return this.level; } + /** + * Get the battery scale + * + * @return scale + */ @SuppressWarnings("unused") public int getScale() { return this.scale; } + /** + * Get the battery temperature + * + * @return temperature + */ @SuppressWarnings("unused") public int getTemperature() { return this.temperature; } + /** + * Get the battery voltage + * + * @return voltage + */ @SuppressWarnings("unused") public int getVoltage() { return this.voltage; } + /** + * Get the battery plugged state + * + * @return plugged + */ @SuppressWarnings("unused") public int getPlugged() { return this.plugged; } + /** + * Get the battery status + * + * @return status + */ @SuppressWarnings("unused") public int getBatteryStatus() { return this.status; } + /** + * Get the battery health + * + * @return health + */ @SuppressWarnings("unused") public int getBatteryHealth() { return this.health; } + /** + * Get the battery plugged state in string format + * + * @return plugged in string format + */ @SuppressWarnings("unused") public String getPluggedString() { return getPluggedString(this.plugged); } + /** + * Get the battery status in string format + * + * @return status in string format + */ @SuppressWarnings("unused") public String getBatteryStatusString() { return getBatteryStatusString(this.status); } + /** + * Get the battery health in string format + * + * @return health in string format + */ @SuppressWarnings("unused") public String getBatteryHealthString() { return getBatteryHealthString(this.health); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java index a7c8410..579d55e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java @@ -26,6 +26,9 @@ import java.util.ArrayList; import java.util.Locale; +/** + * An instance of SKBluetoothData encapsulates measurements related to all the Bluetooth devices. + */ public class SKBluetoothData extends SKAbstractData { @SuppressWarnings("unused") @@ -33,6 +36,13 @@ public class SKBluetoothData extends SKAbstractData { private final ArrayList mBluetoothDevices; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param bluetoothDevices One BluetoothDeviceData object for each Bluetooth device + */ public SKBluetoothData(long timestamp, ArrayList bluetoothDevices) { super(SKSensorType.BLUETOOTH, timestamp); @@ -40,6 +50,11 @@ public SKBluetoothData(long timestamp, ArrayList bluetoot this.mBluetoothDevices = bluetoothDevices; } + /** + * Get the data for all Bluetooth devices in CSV format + * + * @return String formatted as follows: timestamp,device1 data, device2 data,,, + */ @Override public String getDataInCSV() { @@ -60,6 +75,11 @@ public String getDataInCSV() { return stringBuilder.toString(); } + /** + * Get Bluetooth Device data + * + * @return an ArrayList containing an SKBluetoothDeviceData object for each Bluetooth Device + */ @SuppressWarnings("unused") public ArrayList getBluetoothDevices() { return this.mBluetoothDevices; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java index d4f2c44..9cf7dde 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKBluetoothData encapsulates measurements related to one Bluetooth device. + */ public class SKBluetoothDeviceData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,15 @@ public class SKBluetoothDeviceData extends SKAbstractData { protected final String address; protected final int rssi; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param name Device name + * @param address Device Address + * @param rssi Device RSSI + */ public SKBluetoothDeviceData(long timestamp, String name, String address, int rssi) { super(SKSensorType.BLUETOOTH, timestamp); @@ -43,21 +55,41 @@ public SKBluetoothDeviceData(long timestamp, String name, String address, int rs this.rssi = rssi; } + /** + * Get Bluetooth data in CSV format + * + * @return String formatted as a CSV, containing: timestamp,name,address,rssi + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s,%s,%d", this.timestamp, this.name, this.address, this.rssi); } + /** + * Get the Bluetooth device name + * + * @return Bluetooth device name + */ @SuppressWarnings("unused") public String getName() { return this.name; } + /** + * Get the Bluetooth device address + * + * @return Bluetooth device address + */ @SuppressWarnings("unused") public String getAddress() { return this.address; } + /** + * Get the Bluetooth device RSSI + * + * @return Bluetooth device RSSI + */ @SuppressWarnings("unused") public int getRssi() { return this.rssi; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java index f51e47d..2064f6c 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKGravityData encapsulates measurements related to the Gravity sensor. + */ public class SKGravityData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,17 @@ public class SKGravityData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis value + * + * @param y Y-axis value + * + * @param z Z-axis value + */ public SKGravityData(long timestamp, float x, float y, float z) { super(SKSensorType.GRAVITY, timestamp); @@ -43,21 +57,41 @@ public SKGravityData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the Gravity sensor data in csv format + * + * @return String in csv format: timestamp, x-axis, y-axis, z-axis + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the Gravity sensor X-axis value + * + * @return X-axis value + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Gravity sensor Y-axis value + * + * @return Y-axis value + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Gravity sensor Z-axis value + * + * @return Z-axis value + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java index da3a904..41620ea 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKGyroscopeData encapsulates measurements related to the Gyroscope sensor. + */ public class SKGyroscopeData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,17 @@ public class SKGyroscopeData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis of the Gyroscope data + * + * @param y Y-axis of the Gyroscope data + * + * @param z Z-axis of the Gyroscope data + */ public SKGyroscopeData(long timestamp, float x, float y, float z) { super(SKSensorType.GYROSCOPE, timestamp); @@ -43,21 +57,41 @@ public SKGyroscopeData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the Gyroscope data in csv format + * + * @return String in csv format: timestamp, X-axis, Y-axis, Z-axis + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the X-axis of the Gyroscope sensor data + * + * @return X-axis value + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Y-axis of the Gyroscope sensor data + * + * @return Y-axis value + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Z-axis of the Gyroscope sensor data + * + * @return Z-axis value + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java index 1badf50..101ec40 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKLightData encapsulates measurements related to the Light sensor. + */ public class SKLightData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKLightData extends SKAbstractData { protected final float light; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param light Ambient light in lux + */ public SKLightData(long timestamp, float light) { super(SKSensorType.LIGHT, timestamp); @@ -39,11 +49,21 @@ public SKLightData(long timestamp, float light) { this.light = light; } + /** + * Get light sensor data in CSV format + * + * @return String in CSV format: timestamp, ambient light in lux + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.light); } + /** + * Get light sensor data + * + * @return Ambient light in lux + */ @SuppressWarnings("unused") public float getLight() { return this.light; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java index 74cf396..2ba4db6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java @@ -25,6 +25,10 @@ import java.util.Locale; +/** + * An instance of SKLinearAccelerationData encapsulates measurements related to the Linear Acceleration sensor. + * Measures the acceleration force in mass/seconds**2, excluding the force of gravity + */ public class SKLinearAccelerationData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +38,17 @@ public class SKLinearAccelerationData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Force in X direction + * + * @param y Force in Y direction + * + * @param z Force in Z direction + */ public SKLinearAccelerationData(long timestamp, float x, float y, float z) { super(SKSensorType.LINEAR_ACCELERATION, timestamp); @@ -43,21 +58,41 @@ public SKLinearAccelerationData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get Linear Acceleration sensor data in CSV format + * + * @return String in CSV format: timestamp, x force, y force, z force + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get Linear Acceleration force in X direction + * + * @return force in X direction + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Linear Acceleration force in Y direction + * + * @return force in Y direction + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Linear Acceleration force in Z direction + * + * @return force in Z direction + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java index 298a078..a60a450 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java @@ -28,6 +28,9 @@ import java.util.Locale; +/** + * An instance of SKLocationData encapsulates measurements related to the Light sensor. + */ public class SKLocationData extends SKAbstractData { @SuppressWarnings("unused") @@ -35,6 +38,13 @@ public class SKLocationData extends SKAbstractData { protected final Location location; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param location Location object + */ public SKLocationData(long timestamp, Location location) { super(SKSensorType.LOCATION, timestamp); @@ -42,11 +52,21 @@ public SKLocationData(long timestamp, Location location) { this.location = location; } + /** + * Get location sensor data in CSV format + * + * @return String in CSV format: timestamp, location + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s", this.timestamp, this.location); } + /** + * Get Location object + * + * @return Location object + */ @SuppressWarnings("unused") public Location getLocation() { return location; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java index f444adb..f55f1d8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java @@ -25,6 +25,12 @@ import java.util.Locale; + +/** + * An instance of SKMagnetometerData encapsulates measurements related to the Magnetometer sensor. + * Measures the magnetic force in micro-Tesla + */ + public class SKMagnetometerData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +40,17 @@ public class SKMagnetometerData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Force in X-direction + * + * @param y Force in Y-direction + * + * @param z Force in Z-direction + */ public SKMagnetometerData(long timestamp, float x, float y, float z) { super(SKSensorType.MAGNETOMETER, timestamp); @@ -43,21 +60,41 @@ public SKMagnetometerData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get Magnetometer sensor data in CSV format + * + * @return String in CSV format: timestamp, x force, y force, z force + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get Magnetometer force in X direction + * + * @return force in X direction + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Magnetometer force in Y direction + * + * @return force in Y direction + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Magnetometer force in Z direction + * + * @return force in Z direction + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java index 87e1ac2..93a0d6c 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKRotationData encapsulates measurements related to the Rotation sensor. + */ public class SKRotationData extends SKAbstractData { @SuppressWarnings("unused") @@ -36,6 +39,23 @@ public class SKRotationData extends SKAbstractData { protected final float cos; protected final float headingAccuracy; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Rotation axis x-component*sin(theta/2) + * + * @param y Rotation axis y-component*sin(theta/2) + * + * @param z Rotation axis z-component*sin(theta/2) + * + * @param cos Cos(theta) + * + * where theta is the angle of rotation + * + * @param headingAccuracy Estimated accuracy in radians + */ public SKRotationData(long timestamp, float x, float y, float z, float cos, float headingAccuracy) { super(SKSensorType.ROTATION, timestamp); @@ -47,35 +67,78 @@ public SKRotationData(long timestamp, float x, float y, float z, float cos, floa this.headingAccuracy = headingAccuracy; } + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Rotation axis x-component*sin(theta/2) + * + * @param y Rotation axis y-component*sin(theta/2) + * + * @param z Rotation axis z-component*sin(theta/2) + * + * where theta is the angle of rotation + */ public SKRotationData(long timestamp, float x, float y, float z) { this(timestamp, x, y, z, 0, 0); } + /** + * Get Rotation sensor data in CSV format + * + * @return String in CSV format: timestamp, x, y, z, cos, headingAccuracy + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f,%f,%f", this.timestamp, this.x, this.y, this.z, this.cos, this.headingAccuracy); } + /** + * Get X component of rotation + * + * @return X component + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Y component of rotation + * + * @return Y component + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Z component of rotation + * + * @return Z component + */ @SuppressWarnings("unused") public float getZ() { return this.z; } + /** + * Get cos of the angle of rotation + * + * @return Cos(theta) + */ @SuppressWarnings("unused") public float getCos() { return this.cos; } + /** + * Get heading accuracy of rotation data + * + * @return Heading accuracy + */ @SuppressWarnings("unused") public float getHeadingAccuracy() { return this.headingAccuracy; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java index 449f5b1..3a70139 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKScreenStatusData encapsulates measurements related to the Screen Status sensor. + */ public class SKScreenStatusData extends SKAbstractData { @SuppressWarnings("unused") @@ -36,6 +39,12 @@ public class SKScreenStatusData extends SKAbstractData { protected final int status; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * @param status Screen status + */ public SKScreenStatusData(long timestamp, int status) { super(SKSensorType.SCREEN_STATUS, timestamp); @@ -43,16 +52,31 @@ public SKScreenStatusData(long timestamp, int status) { this.status = status; } + /** + * Get Screen Status sensor data in CSV format + * + * @return String in CSV format: timestamp, screen status string + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s", this.timestamp, this.getStatusString()); } + /** + * Get screen status + * + * @return Screen status as an int + */ @SuppressWarnings("unused") public int getStatus() { return this.status; } + /** + * Get screen status as a string + * + * @return Screen status as a string: "screen off", "screen on", or "unknown" + */ @SuppressWarnings("unused") public String getStatusString() { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java index a88a603..efe8051 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKStepCounterData encapsulates measurements related to the Step Counter sensor. + */ public class SKStepCounterData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKStepCounterData extends SKAbstractData { protected final float steps; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param steps Number of steps + */ public SKStepCounterData(long timestamp, float steps) { super(SKSensorType.STEP_COUNTER, timestamp); @@ -39,11 +49,21 @@ public SKStepCounterData(long timestamp, float steps) { this.steps = steps; } + /** + * Get Step Counter sensor data in CSV format + * + * @return String in CSV format: timestamp, number of steps + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.steps); } + /** + * Get number of steps + * + * @return number of steps + */ @SuppressWarnings("unused") public float getSteps() { return this.steps; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java index 089902e..85b21b7 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java @@ -25,16 +25,29 @@ import java.util.Locale; +/** + * An instance of SKStepCounterData encapsulates measurements related to the Step Counter sensor. + */ public class SKStepDetectorData extends SKAbstractData { @SuppressWarnings("unused") private static final String TAG = "SKStepDetectorData"; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + */ public SKStepDetectorData(long timestamp) { super(SKSensorType.STEP_DETECTOR, timestamp); } + /** + * Get Step Detector sensor data in CSV format + * + * @return String in CSV format: timestamp, step detector data + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d", this.timestamp); From ea489ba9e204621932309e85ec446089f80af6a8 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:16:01 +0000 Subject: [PATCH 036/295] Fix non-ascii characters --- .../org/sensingkit/sensingkitlib/SKSensorType.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 52d02f1..39d320f 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -26,7 +26,7 @@ */ public enum SKSensorType { /** - * Measures the device acceleration changes in three‑dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. + * Measures the device acceleration changes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. */ ACCELEROMETER, /** @@ -38,7 +38,7 @@ public enum SKSensorType { */ LINEAR_ACCELERATION, /** - * Measures the device’s rate of rotation around each of the three spatial axes. + * Measures the device's rate of rotation around each of the three spatial axes. */ GYROSCOPE, /** @@ -46,7 +46,7 @@ public enum SKSensorType { */ ROTATION, /** - * Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT. + * Measures the ambient geomagnetic field for all three physical axes (x, y, z) in microtesla. */ MAGNETOMETER, /** @@ -66,11 +66,11 @@ public enum SKSensorType { */ LIGHT, /** - * Location sensor determines the current location of the device using a combination of Cellular, Wi‑Fi, Bluetooth and GPS sensors. It provides 2D geographical coordinate information (latitude, longitude), as well as the altitude of the device. + * Location sensor determines the current location of the device using a combination of Cellular, Wi-Fi, Bluetooth and GPS sensors. It provides 2D geographical coordinate information (latitude, longitude), as well as the altitude of the device. */ LOCATION, /** - * Motion Activity sensor uses an embedded motion co‑processor that senses the user’s activity classified as Stationary, Walking, Running, Automotive or Cycling. + * Motion Activity sensor uses an embedded motion co-processor that senses the user's activity classified as Stationary, Walking, Running, Automotive or Cycling. * Assume that Activity is the same as Motion Activity */ ACTIVITY, From 331d2d9d0a7a2afd0da786639ab283066a2b62e8 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:22:15 +0000 Subject: [PATCH 037/295] Fix @returns to @return --- .../org/sensingkit/sensingkitlib/data/SKAccelerometerData.java | 2 +- .../org/sensingkit/sensingkitlib/data/SKAudioLevelData.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java index 54e7633..35f5690 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java @@ -62,7 +62,7 @@ public SKAccelerometerData(long timestamp, float x, float y, float z) { /** * Get the accelerator measurements in csv format * - * @returns String containing the timestamp and accelerometer measurements in csv format: timestamp,x,y,z + * @return String containing the timestamp and accelerometer measurements in csv format: timestamp,x,y,z */ @Override public String getDataInCSV() { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java index 0f17125..9e79f10 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java @@ -52,7 +52,7 @@ public SKAudioLevelData(long timestamp, int level) { /** * Get the audio level measurement in csv format * - * @returns String containing the timestamp and audio level measurements in csv format: timestamp,level + * @return String containing the timestamp and audio level measurements in csv format: timestamp,level */ @Override public String getDataInCSV() { From 16ef23dfe4ccf12a80188910dd2e2ba98e58a0fc Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:22:22 +0000 Subject: [PATCH 038/295] Remove empty line --- .../main/java/org/sensingkit/sensingkitlib/SensingKitLib.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 99197d9..94207c3 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -187,7 +187,6 @@ public long getCurrentTimeMillis() { /** * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) - * * @return current time in nanoseconds */ From 29bd09a93642d0b7bf6a35b67bceec510f63f0f8 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:23:22 +0000 Subject: [PATCH 039/295] Copied javadoc comments from SensingKitLib.java --- .../sensingkitlib/SensingKitLibInterface.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java index ba8796a..be6ca3a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java @@ -28,10 +28,27 @@ public interface SensingKitLibInterface { /** Sensor Registration */ + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ void registerSensor(SKSensorType sensorType) throws SKException; + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ void deregisterSensor(SKSensorType sensorType) throws SKException; + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ boolean isSensorRegistered(SKSensorType sensorType) throws SKException; /** Configuration */ @@ -45,26 +62,76 @@ public interface SensingKitLibInterface { /** Continuous Sensing */ + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException; + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; + /** + * Starts continuous sensing with all registered sensors. + */ void startContinuousSensingWithAllRegisteredSensors() throws SKException; + /** + * Starts continuous sensing with all registered sensors. + */ void stopContinuousSensingWithAllRegisteredSensors() throws SKException; + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ boolean isSensorSensing(SKSensorType sensorType) throws SKException; /** Time */ + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC). + * + * @return current time in milliseconds + */ long getCurrentTimeMillis(); + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + * + * @return current time in nanoseconds + */ long getNanoTime(); } From 1a4f699a791066f343ee5e5b288904a983965d9e Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:27:13 +0000 Subject: [PATCH 040/295] Update Google Play Services to 8.4.0 --- SensingKitLib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 7bf7c72..66ad97a 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,5 +20,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.android.gms:play-services-location:8.3.0' + compile 'com.google.android.gms:play-services-location:8.4.0' } From 2258bf51bfcf11f16c3e46d9fd365b0a13d98f44 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:30:38 +0000 Subject: [PATCH 041/295] Add missing javadoc description --- .../java/org/sensingkit/sensingkitlib/data/SKActivityData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java index 13c40bc..8cada79 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java @@ -102,7 +102,7 @@ public String getActivityString() { /** * Get the name of an activity type * - * @param activityType + * @param activityType The type of the activity * * @return name */ From 774aebbc2b8727a3c60a429c39e4b0bb1f9d92a3 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:30:53 +0000 Subject: [PATCH 042/295] Fix lint issue --- .../sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java index a8070f2..87041d0 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.Bundle; +import android.support.annotation.NonNull; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; @@ -57,7 +58,7 @@ public void onConnectionSuspended(int cause) { } @Override - public void onConnectionFailed(ConnectionResult result) { + public void onConnectionFailed(@NonNull ConnectionResult result) { // At least one of the API client connect attempts failed // No client is connected } From 05af2b204bc8735875e125ab7b3fe21f78c2ebbd Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Mon, 11 Jan 2016 15:31:09 +0000 Subject: [PATCH 043/295] Update Google Play Services --- SensingKitLib/SensingKitLib.iml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index c7e8c68..ae29c0a 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -71,11 +71,11 @@ - - - - - + + + + + @@ -88,11 +88,11 @@ - - - - - - + + + + + + \ No newline at end of file From f8fe58cb8defb67a6dd2c3e0007ca38f8e3fd3ac Mon Sep 17 00:00:00 2001 From: U3D3 Date: Tue, 12 Jan 2016 11:55:53 +0000 Subject: [PATCH 044/295] Import estimate library Import estimate library for EddyStone --- SensingKitLib/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 7bf7c72..28a39e4 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -21,4 +21,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services-location:8.3.0' + compile 'com.estimote:sdk:0.9.4@aar' } From ceda856e32aeb69cc84a42d53a8538eb8481d594 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Tue, 12 Jan 2016 11:57:49 +0000 Subject: [PATCH 045/295] Add SKiBeacon Sensor --- .../sensingkitlib/SKSensorType.java | 3 +- .../sensingkitlib/data/SKiBeaconData.java | 53 +++++++++++++++++++ .../sensors/SKSensorUtilities.java | 3 ++ .../sensingkitlib/sensors/SKiBeacon.java | 7 +++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java create mode 100644 SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index e14d8bc..a817775 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -41,5 +41,6 @@ public enum SKSensorType { BLUETOOTH, HUMIDITY, AIR_PRESSURE, - EDDYSTONE_PROXIMITY + EDDYSTONE_PROXIMITY, + IBEACON } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java new file mode 100644 index 0000000..0a2287d --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java @@ -0,0 +1,53 @@ +package org.sensingkit.sensingkitlib.data; + +import org.sensingkit.sensingkitlib.SKSensorType; + +import java.util.Locale; + +/** + * Created by U3D3 on 1/12/16. + */ +public class SKiBeaconData extends SKAbstractData{ + + @SuppressWarnings("unused") + private static final String TAG = "SKiBeaconData"; + + protected final String namespaceId; + protected final String instanceId; + protected final int rssi; + protected final int txPower; + + public SKiBeaconData(long timestamp, String namespaceId, String instanceId, int rssi, int txPower) { + super(SKSensorType.IBEACON, timestamp); + this.namespaceId = namespaceId; //** + this.instanceId = instanceId; //** + this.rssi = rssi; + this.txPower = txPower; + } + + @Override + public String getDataInCSV() { + //TODO Check format + return String.format(Locale.US, "%d,%s,%s,%d,%d", this.timestamp, this.namespaceId, this.instanceId, this.rssi, this.txPower ); + } + + @SuppressWarnings("unused") + public String getNamespaceId(){ + return this.namespaceId; + } + + @SuppressWarnings("unused") + public String getInstanceId(){ + return this.instanceId; + } + + @SuppressWarnings("unused") + public int getRssi(){ + return this.rssi; + } + + @SuppressWarnings("unused") + public int getTxPower(){ + return this.txPower; + } +} diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java index 7fc26e1..f73f9a6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java @@ -94,6 +94,9 @@ public static String getSensorInString(SKSensorType sensorType) throws SKExcepti case EDDYSTONE_PROXIMITY: return "Eddystone Proximity"; + case IBEACON: + return "iBeacon"; + default: throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java new file mode 100644 index 0000000..37a5505 --- /dev/null +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java @@ -0,0 +1,7 @@ +package org.sensingkit.sensingkitlib.sensors; + +/** + * Created by U3D3 on 1/12/16. + */ +public class SKiBeacon { +} From 8c7502c6012157fab19ca70cdece3cb53729deee Mon Sep 17 00:00:00 2001 From: U3D3 Date: Tue, 12 Jan 2016 11:58:40 +0000 Subject: [PATCH 046/295] Update EddyStone sensor --- SensingKitLib/SensingKitLib.iml | 14 ++-- SensingKitLib/src/main/AndroidManifest.xml | 2 + .../data/SKEddystoneProximityData.java | 11 +-- .../sensors/SKEddystoneProximity.java | 68 ++++++++++++++++++- 4 files changed, 77 insertions(+), 18 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 2473ef5..882e05b 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -65,27 +65,20 @@ + - - - + - - - - - - - + @@ -97,6 +90,7 @@ + diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index b60ae31..b3c2181 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -3,6 +3,8 @@ + + diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java index d8f8e0c..adb03d5 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java @@ -5,19 +5,20 @@ import java.util.Locale; /** - * Created by U3D3 on 11/14/15. + * Created by Ming-Jiun Huang on 11/14/15. */ + public class SKEddystoneProximityData extends SKAbstractData { @SuppressWarnings("unused") private static final String TAG = "SKEddystoneProximityData"; protected final String namespaceId; - protected final int instanceId; + protected final String instanceId; protected final int rssi; protected final int txPower; - public SKEddystoneProximityData(long timestamp, String namespaceId, int instanceId, int rssi, int txPower) { + public SKEddystoneProximityData(long timestamp, String namespaceId, String instanceId, int rssi, int txPower) { super(SKSensorType.EDDYSTONE_PROXIMITY, timestamp); this.namespaceId = namespaceId; this.instanceId = instanceId; @@ -27,7 +28,7 @@ public SKEddystoneProximityData(long timestamp, String namespaceId, int instance @Override public String getDataInCSV() { - + //TODO Check format return String.format(Locale.US, "%d,%s,%s,%d,%d", this.timestamp, this.namespaceId, this.instanceId, this.rssi, this.txPower ); } @@ -37,7 +38,7 @@ public String getNamespaceId(){ } @SuppressWarnings("unused") - public int getInstanceId(){ + public String getInstanceId(){ return this.instanceId; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java index 70185ca..e459d67 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java @@ -1,34 +1,96 @@ package org.sensingkit.sensingkitlib.sensors; +import android.annotation.TargetApi; +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.le.BluetoothLeScanner; +import android.bluetooth.le.ScanCallback; +import android.bluetooth.le.ScanFilter; +import android.bluetooth.le.ScanSettings; import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.ParcelUuid; + +import com.estimote.sdk.BeaconManager; +import com.estimote.sdk.eddystone.Eddystone; import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKExceptionErrorCode; import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; +import org.sensingkit.sensingkitlib.data.SKEddystoneProximityData; + +import java.util.ArrayList; +import java.util.List; /** - * Created by U3D3 on 11/14/15. + * Created by Ming-Jiun Huang on 11/14/15. */ + public class SKEddystoneProximity extends SKAbstractSensor { + @SuppressWarnings("unused") + private static final String TAG = "SKEddystoneProximity"; + //private final static int REQUEST_ENABLE_BLUETOOTH = 1; + private final BluetoothAdapter mBluetoothAdapter; + private ArrayList mEddyStoneProximityData; + private BeaconManager mBeaconManager; + private static final ParcelUuid UUID = ParcelUuid.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"); + + @TargetApi(Build.VERSION_CODES.LOLLIPOP) public SKEddystoneProximity(Context context) throws SKException{ super(context, SKSensorType.EDDYSTONE_PROXIMITY); + + mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); + mEddyStoneProximityData = new ArrayList<>(); + + if (mBluetoothAdapter == null){ + throw new SKException(TAG, "Bluetooth sensor module is not supported from the device.", SKExceptionErrorCode.UNKNOWN_ERROR); + } else if (!mBluetoothAdapter.isEnabled()){ + Intent enableBTIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); + // + } else if (!mBluetoothAdapter.isMultipleAdvertisementSupported()) { + throw new SKException(TAG, "Bluetooth sensor module is not supported from the device.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + + mBeaconManager.setEddystoneListener(new BeaconManager.EddystoneListener() { + @Override + public void onEddystonesFound(List list) { + Eddystone eddystone = list.get(list.size() - 1); + String namespaceId = eddystone.namespace; + String instanceId = eddystone.instance; + int rssi = eddystone.rssi; + int txPower = eddystone.calibratedTxPower; + SKEddystoneProximityData eddystoneProximityData = null; + eddystoneProximityData = new SKEddystoneProximityData(System.currentTimeMillis(), namespaceId, instanceId, rssi, txPower); + + mEddyStoneProximityData.add(eddystoneProximityData); + } + }); } @Override protected boolean shouldPostSensorData(SKAbstractData data) { - return false; - } + + // Always post sensor data + return true; } @Override public void startSensing() throws SKException { + this.isSensing = true; + mBeaconManager.startEddystoneScanning(); + mBluetoothAdapter.startDiscovery(); } @Override public void stopSensing() { + this.isSensing = false; + + mBluetoothAdapter.cancelDiscovery(); } } From c5046ba773d65b1b7680170f3765150cc13355e1 Mon Sep 17 00:00:00 2001 From: U3D3 Date: Tue, 12 Jan 2016 12:14:41 +0000 Subject: [PATCH 047/295] merge --- README.md | 27 ++++-- SensingKitLib/SensingKitLib.iml | 35 ++++--- SensingKitLib/build.gradle | 5 +- SensingKitLib/src/main/AndroidManifest.xml | 10 +- .../sensingkit/sensingkitlib/SKException.java | 16 ++++ .../sensingkitlib/SKSensorDataListener.java | 8 ++ .../sensingkitlib/SKSensorManager.java | 69 ++++++++++++++ .../sensingkitlib/SKSensorType.java | 69 +++++++++++++- .../sensingkit/sensingkitlib/SKUtilities.java | 22 +++++ .../sensingkitlib/SensingKitLib.java | 71 ++++++++++++++- .../sensingkitlib/SensingKitLibInterface.java | 67 ++++++++++++++ .../sensingkitlib/data/SKAbstractData.java | 25 +++++ .../data/SKAccelerometerData.java | 37 ++++++++ .../sensingkitlib/data/SKActivityData.java | 43 +++++++++ .../sensingkitlib/data/SKAirPressureData.java | 21 +++++ .../data/SKAmbientTemperatureData.java | 21 +++++ .../sensingkitlib/data/SKAudioLevelData.java | 20 ++++ .../sensingkitlib/data/SKBatteryData.java | 91 ++++++++++++++++++- .../sensingkitlib/data/SKBluetoothData.java | 20 ++++ .../data/SKBluetoothDeviceData.java | 32 +++++++ .../sensingkitlib/data/SKGravityData.java | 34 +++++++ .../sensingkitlib/data/SKGyroscopeData.java | 34 +++++++ .../sensingkitlib/data/SKHumidityData.java | 17 +++- .../sensingkitlib/data/SKLightData.java | 20 ++++ .../data/SKLinearAccelerationData.java | 35 +++++++ .../sensingkitlib/data/SKLocationData.java | 20 ++++ .../data/SKMagnetometerData.java | 37 ++++++++ .../sensingkitlib/data/SKRotationData.java | 63 +++++++++++++ .../data/SKScreenStatusData.java | 24 +++++ .../sensingkitlib/data/SKStepCounterData.java | 20 ++++ .../data/SKStepDetectorData.java | 13 +++ .../SKAbstractGoogleServicesSensor.java | 3 +- build.gradle | 2 +- 33 files changed, 999 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index d988094..4ee7d36 100644 --- a/README.md +++ b/README.md @@ -63,28 +63,40 @@ dependencies { ## How to Use this Library -- Import and init SensingKit into your Activity class as shown bellow: +- The imports you will need are: ```java +import org.sensingkit.sensingkitlib.SKException; +import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.SensingKitLib; +import org.sensingkit.sensingkitlib.SensingKitLibInterface; //Document: needed to add this to init SensingKit +import org.sensingkit.sensingkitlib.data.SKSensorData; +import org.sensingkit.sensingkitlib.SKSensorDataListener; +``` + +- Init SensingKit in your Activity class as shown below: +```java +//You will need a try..catch block around this code SensingKitLibInterface mSensingKitLib = SensingKitLib.getSensingKitLib(this); ``` -- Register a sensor module (e.g. a Light sensor) as shown bellow: +- Register a sensor module (e.g. a Light sensor) as shown below: ```java -mSensingKitLib.registerSensorModule(SKSensorModuleType.LIGHT); +//You will need a try..catch block around this code +mSensingKitLib.registerSensor(SKSensorType.LIGHT); ``` - Subscribe a sensor data listener: ```java -mSensingKitLib.subscribeSensorDataListener(SKSensorModuleType.LIGHT, new SKSensorDataListener() { +//You will need a try..catch block around this code +mSensingKitLib.subscribeSensorDataListener(SKSensorType.LIGHT, new SKSensorDataListener() { @Override - public void onDataReceived(final SKSensorModuleType moduleType, final SKSensorData sensorData) { + public void onDataReceived(final SKSensorType moduleType, final SKSensorData sensorData) { System.out.println(sensorData.getDataInCSV()); // Print data in CSV format } }); @@ -102,8 +114,9 @@ SKLightData lightData = (SKLightData)sensorData; - You can Start and Stop the Continuous Sensing using the following commands: ```java -mSensingKitLib.startContinuousSensingWithSensor(SKSensorModuleType.LIGHT); -mSensingKitLib.stopContinuousSensingWithSensor(SKSensorModuleType.LIGHT); +//You will need try..catch blocks around these statements +mSensingKitLib.startContinuousSensingWithSensor(SKSensorType.LIGHT); +mSensingKitLib.stopContinuousSensingWithSensor(SKSensorType.LIGHT); ``` diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 882e05b..d713b14 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -67,34 +67,43 @@ + - +<<<<<<< HEAD - - - - +======= + + + + + + + + +>>>>>>> origin/develop + - - - +<<<<<<< HEAD - - - - - +======= + + + + + + +>>>>>>> origin/develop \ No newline at end of file diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 28a39e4..6e7b83a 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,6 +20,9 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.android.gms:play-services-location:8.3.0' +<<<<<<< HEAD compile 'com.estimote:sdk:0.9.4@aar' +======= +>>>>>>> origin/develop + compile 'com.google.android.gms:play-services-location:8.4.0' } diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index b3c2181..eb648a9 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -1,12 +1,16 @@ - - +<<<<<<< HEAD - +======= + +>>>>>>> origin/develop + diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java index 8afa1b5..660370b 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKException.java @@ -26,17 +26,33 @@ public class SKException extends Exception { private final SKExceptionErrorCode errorCode; private final String TAG; + /** + * + * @param TAG - TAG + * @param message - error message + * @param errorCode - error code + */ public SKException(String TAG, String message, SKExceptionErrorCode errorCode) { super(message); this.TAG = TAG; this.errorCode = errorCode; } + /** + * Get the error code + * + * @return error code + */ @SuppressWarnings("unused") public SKExceptionErrorCode getErrorCode() { return this.errorCode; } + /** + * Get the tag + * + * @return tag + */ @SuppressWarnings("unused") public String getTAG() { return this.TAG; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java index d12b283..41201d1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorDataListener.java @@ -23,7 +23,15 @@ import org.sensingkit.sensingkitlib.data.SKSensorData; + public interface SKSensorDataListener { + /** + * Event Listener to be invoked when new sensor data is available. You can cast the sensorData object + * into the actual sensor data (e.g. SKAccelerometerData), based on the reported sensorType. + *
+ * parameter sensorType The type of the sensor producing the SKSensorData object.
+ * parameter sensorData The new sensor data produced by the SKSensorType sensor. + */ void onDataReceived(final SKSensorType sensorType, final SKSensorData sensorData); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 1c59896..2c88f44 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -61,6 +61,12 @@ private SKSensorManager(final Context context) throws SKException { mSensors = new SparseArray<>(TOTAL_SENSORS); } + + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ public void registerSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Register sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -75,6 +81,11 @@ public void registerSensor(SKSensorType sensorType) throws SKException { mSensors.put(sensorIndex, sensor); } + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ public void deregisterSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Deregister sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -95,12 +106,26 @@ public void deregisterSensor(SKSensorType sensorType) throws SKException { mSensors.delete(sensorIndex); } + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { int sensorIndex = sensorType.ordinal(); return (mSensors.get(sensorIndex) != null); } + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ public boolean isSensorSensing(SKSensorType sensorType) throws SKException { if (!isSensorRegistered(sensorType)) { @@ -215,6 +240,15 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept return sensor; } + /** + * Get data from the sensor + * + * @param sensorType of type SKSensorType + * + * @return an SKSensorData object + * + * @throws SKException + */ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Get data from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -222,6 +256,13 @@ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKExceptio throw new SKException(TAG, "This feature is not supported just yet!", SKExceptionErrorCode.UNKNOWN_ERROR); } + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { Log.i(TAG, "Subscribe to sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -229,6 +270,12 @@ public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataLis getSensor(sensorType).subscribeSensorDataListener(dataListener); } + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { Log.i(TAG, "Unsubscribe from sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -236,6 +283,12 @@ public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataL getSensor(sensorType).unsubscribeSensorDataListener(dataListener); } + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ + public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { Log.i(TAG, "Unsubscribe from all sensors."); @@ -243,6 +296,11 @@ public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SK getSensor(sensorType).unsubscribeAllSensorDataListeners(); } + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Start sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -255,6 +313,11 @@ public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKE getSensor(sensorType).startSensing(); } + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { Log.i(TAG, "Stop sensing with sensor: " + SKSensorUtilities.getSensorInString(sensorType) + "."); @@ -269,6 +332,9 @@ public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKEx sensor.stopSensing(); } + /** + * Starts continuous sensing with all registered sensors. + */ public void startContinuousSensingWithAllRegisteredSensors() throws SKException { for (int i = 0; i < TOTAL_SENSORS; i++){ @@ -285,6 +351,9 @@ public void startContinuousSensingWithAllRegisteredSensors() throws SKException } } + /** + * Stops continuous sensing with all registered sensors. + */ public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { for (int i = 0; i < TOTAL_SENSORS; i++) { if (mSensors.get(i) != null) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index a817775..a33e413 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -21,26 +21,91 @@ package org.sensingkit.sensingkitlib; +/** + * These constants indicate the type of the sensor. + */ public enum SKSensorType { + /** + * Measures the device acceleration changes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. + */ ACCELEROMETER, + /** + * Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z). + */ GRAVITY, + /** + * Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity. + */ LINEAR_ACCELERATION, + /** + * Measures the device's rate of rotation around each of the three spatial axes. + */ GYROSCOPE, + /** + * Measures the orientation of a device by providing the three elements of the device's rotation vector. + */ ROTATION, + /** + * Measures the ambient geomagnetic field for all three physical axes (x, y, z) in microtesla. + */ MAGNETOMETER, + /** + * Room temperature in degrees Celcius + */ AMBIENT_TEMPERATURE, + /** + * Returns 1.0 each time a step is taken + */ STEP_DETECTOR, + /** + * Number of steps taken by the user since the last reboot while activated + */ STEP_COUNTER, + /** + * Measures the ambient light level (illumination) in lux. + */ LIGHT, + /** + * Location sensor determines the current location of the device using a combination of Cellular, Wi-Fi, Bluetooth and GPS sensors. It provides 2D geographical coordinate information (latitude, longitude), as well as the altitude of the device. + */ LOCATION, + /** + * Motion Activity sensor uses an embedded motion co-processor that senses the user's activity classified as Stationary, Walking, Running, Automotive or Cycling. + * Assume that Activity is the same as Motion Activity + */ ACTIVITY, + /** + * Battery sensor listens to changes in the battery charge state (Charging, Full, Unplugged) as well as in the battery charge level (with 1% precision). + */ BATTERY, + /** + * Not defined in IOS docs + */ SCREEN_STATUS, + /** + * Microphone sensor can be used to record audio from the environment (up to 4 hours) by converting sound into electrical signal. + * Assume that Microphone is the same as AUDIO RECORDER + */ AUDIO_RECORDER, + /** + * Maximum level of the audio signal in a buffer + */ AUDIO_LEVEL, + /** + * Get data from a bluetooth device + */ BLUETOOTH, + /** + * Relative ambient air humidity in percent + */ HUMIDITY, - AIR_PRESSURE, +<<<<<<< HEAD EDDYSTONE_PROXIMITY, - IBEACON + IBEACON, +======= +>>>>>>> origin/develop + /** + * Atmospheric pressure in hPa (millibar) + */ + AIR_PRESSURE } \ No newline at end of file diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java index 3aa2e50..7547f41 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKUtilities.java @@ -29,6 +29,17 @@ public final class SKUtilities { @SuppressWarnings("unused") private static final String TAG = "SKUtilities"; + /** + * Check whether a given permission has been granted + * + * @param context Android Context + * + * @param permission Android permission + * + * @return 1 if permission is granted; 0 if it is not + * + * @throws SKException + */ public static boolean checkPermission(Context context, String permission) throws SKException { if (context == null) { @@ -39,10 +50,21 @@ public static boolean checkPermission(Context context, String permission) throws return (res == PackageManager.PERMISSION_GRANTED); } + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @return the current time in milliseconds + */ public static long getCurrentTimeMillis() { return System.currentTimeMillis(); } + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + * + * @return the current time in nanoseconds + + */ public static long getNanoTime() { return System.nanoTime(); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java index 6c72829..94207c3 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLib.java @@ -58,16 +58,33 @@ private SensingKitLib(final Context context) throws SKException { mSensorManager = SKSensorManager.getSensorManager(context); } + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ @Override public void registerSensor(SKSensorType sensorType) throws SKException { mSensorManager.registerSensor(sensorType); } + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ @Override public void deregisterSensor(SKSensorType sensorType) throws SKException { mSensorManager.deregisterSensor(sensorType); } + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ @Override public boolean isSensorRegistered(SKSensorType sensorType) throws SKException { return mSensorManager.isSensorRegistered(sensorType); @@ -78,51 +95,101 @@ public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKExceptio return mSensorManager.getDataFromSensor(sensorType); } + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ @Override public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { mSensorManager.subscribeSensorDataListener(sensorType, dataListener); } - @Override + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ + @Override public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException { mSensorManager.unsubscribeSensorDataListener(sensorType, dataListener); } - @Override + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ + @Override public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException { mSensorManager.unsubscribeAllSensorDataListeners(sensorType); } + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ @Override public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { mSensorManager.startContinuousSensingWithSensor(sensorType); } + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ @Override public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException { mSensorManager.stopContinuousSensingWithSensor(sensorType); } + /** + * Starts continuous sensing with all registered sensors. + */ @Override public void startContinuousSensingWithAllRegisteredSensors() throws SKException { mSensorManager.startContinuousSensingWithAllRegisteredSensors(); } + /** + * Starts continuous sensing with all registered sensors. + */ @Override public void stopContinuousSensingWithAllRegisteredSensors() throws SKException { mSensorManager.stopContinuousSensingWithAllRegisteredSensors(); } + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ @Override public boolean isSensorSensing(SKSensorType sensorType) throws SKException { return mSensorManager.isSensorSensing(sensorType); } + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC). + * + * @return current time in milliseconds + */ @Override public long getCurrentTimeMillis() { return SKUtilities.getCurrentTimeMillis(); } + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + * + * @return current time in nanoseconds + */ @Override public long getNanoTime() { return SKUtilities.getNanoTime(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java index ba8796a..be6ca3a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SensingKitLibInterface.java @@ -28,10 +28,27 @@ public interface SensingKitLibInterface { /** Sensor Registration */ + /** + * Initializes and registers a sensor into the library with a default sensor configuration. + * + * @param sensorType The type of the sensor that will be initialized and registered in the library. + */ void registerSensor(SKSensorType sensorType) throws SKException; + /** + * Deregisters a sensor from the library. Sensor should not be actively sensing when this method is called. All previously subscribed blocks will also be unsubscribed. + * + * @param sensorType The type of the sensor that will be deregistered. + */ void deregisterSensor(SKSensorType sensorType) throws SKException; + /** + * A Boolean value that indicates whether the sensor is registered. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is registered or FALSE if it is not. + */ boolean isSensorRegistered(SKSensorType sensorType) throws SKException; /** Configuration */ @@ -45,26 +62,76 @@ public interface SensingKitLibInterface { /** Continuous Sensing */ + /** + * Subscribes for sensor updates using a specified event listener. + * + * @param sensorType The type of the sensor that the data handler will be subscribed to. + * @param dataListener An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type. + */ void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; + /** + * Unsubscribes an event listener. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + * @param dataListener The event listener to be unsubscribed. + */ void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException; + /** + * Unsubscribes all event listenerss. + * + * @param sensorType The type of the sensor for which the event listener will be unsubscribed. + */ void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException; + /** + * Starts continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be started. + */ void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; + /** + * Stops continuous sensing with the specified sensor. + * + * @param sensorType The type of the sensor that will be stopped. + */ void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException; + /** + * Starts continuous sensing with all registered sensors. + */ void startContinuousSensingWithAllRegisteredSensors() throws SKException; + /** + * Starts continuous sensing with all registered sensors. + */ void stopContinuousSensingWithAllRegisteredSensors() throws SKException; + /** + * A Boolean value that indicates whether the sensor is currently sensing. + * + * @param sensorType The type of the sensor that will be checked. + * + * @return TRUE if the sensor is currently sensing or FALSE if it is not. + */ boolean isSensorSensing(SKSensorType sensorType) throws SKException; /** Time */ + /** + * Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC). + * + * @return current time in milliseconds + */ long getCurrentTimeMillis(); + /** + * Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source) + * + * @return current time in nanoseconds + */ long getNanoTime(); } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java index cd24162..f6ae4bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAbstractData.java @@ -23,6 +23,9 @@ import org.sensingkit.sensingkitlib.SKSensorType; +/* +Abstract class for sensor data + */ public abstract class SKAbstractData implements SKSensorData { @SuppressWarnings("unused") @@ -31,20 +34,42 @@ public abstract class SKAbstractData implements SKSensorData protected final SKSensorType sensorType; protected final long timestamp; + /** + * Initialize the instance + * + * @param sensorType of type SKSensorType + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + */ public SKAbstractData(SKSensorType sensorType, long timestamp) { this.sensorType = sensorType; this.timestamp = timestamp; } + /** + * Get the sensor data in csv format + * + * @return String in csv format + */ public String toString() { return this.getDataInCSV(); } + /** + * Get the sensor type + * + * @return sensor type + */ @SuppressWarnings("unused") public SKSensorType getSensorType() { return sensorType; } + /** + * Get the timestamp + * + * @return timestamp + */ @SuppressWarnings("unused") public long getTimestamp() { return timestamp; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java index d2937e9..35f5690 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAccelerometerData.java @@ -25,6 +25,10 @@ import java.util.Locale; + +/** + * An instance of SKAccelerometerData encapsulates measurements related to the Accelerometer sensor. + */ public class SKAccelerometerData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +38,18 @@ public class SKAccelerometerData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis value of the Accelerometer sensor + * + * @param y Y-axis value of the Accelerometer sensor + * + * @param z Z-axis value of the Accelerometer sensor + */ + public SKAccelerometerData(long timestamp, float x, float y, float z) { super(SKSensorType.ACCELEROMETER, timestamp); @@ -43,21 +59,42 @@ public SKAccelerometerData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the accelerator measurements in csv format + * + * @return String containing the timestamp and accelerometer measurements in csv format: timestamp,x,y,z + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the X-axis acceleromator measurement + * + * @return Float containing the X-axis value of the Accelerometer sensor + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Y-axis accelerator measurement + * + * @return Float containing the y-axis value of the Accelerometer sensor + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Z-axis accelerator measurement + * + * @return Float containing the z-axis value of the Accelerometer sensor + */ + @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java index 80fdc14..8cada79 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java @@ -27,6 +27,10 @@ import java.util.Locale; +/** + * An instance of SKActivityData encapsulates measurements related to the Activity sensor. + * Activity is classified as Stationary, Walking, Running, Automotive, Cycling, Tilt, or Unknown. + */ public class SKActivityData extends SKAbstractData { @SuppressWarnings("unused") @@ -35,6 +39,15 @@ public class SKActivityData extends SKAbstractData { protected final int activityType; protected final int confidence; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param activityType The type of the activity + * + * @param confidence Confidence percentage for the most probable activity + */ public SKActivityData(long timestamp, int activityType, int confidence) { super(SKSensorType.ACTIVITY, timestamp); @@ -43,26 +56,56 @@ public SKActivityData(long timestamp, int activityType, int confidence) { this.confidence = confidence; } + /** + * Get the Activity sensor data in csv format + * + * @return Activity data in csv format: timestamp,activity type,activity string, confidence + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%d,%s,%d", this.timestamp, this.activityType, getActivityString(), this.confidence); } + /** + * Get the activity type + * + * @return Activity type + * + */ @SuppressWarnings("unused") public int getActivityType() { return this.activityType; } + /** + * Get the confidence percentage + * + * @return Confidence + * + */ @SuppressWarnings("unused") public int getConfidence() { return this.confidence; } + /** + * Get the name of the activity type + * + * @return Name of the activity type + */ @SuppressWarnings("unused") public String getActivityString() { return getNameFromActivityType(this.activityType); } + /** + * Get the name of an activity type + * + * @param activityType The type of the activity + * + * @return name + */ public static String getNameFromActivityType(int activityType) { switch (activityType) { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java index c2cc38a..56cf740 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAirPressureData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAirPressureData encapsulates measurements related to the Air Pressure sensor. + */ public class SKAirPressureData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAirPressureData extends SKAbstractData { protected final float pressure; + /** + * Initialize the Air Pressure data instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param pressure Air pressure + */ public SKAirPressureData(long timestamp, float pressure) { super(SKSensorType.AIR_PRESSURE, timestamp); @@ -39,11 +49,22 @@ public SKAirPressureData(long timestamp, float pressure) { this.pressure = pressure; } + /** + * Get the Air Pressure sensor data in csv format + * + * @return Air Pressure data in csv format: timestamp,air pressure + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.pressure); } + /** + * Get the Air Pressure measurement along + * + * @return Air Pressure measurement + */ @SuppressWarnings("unused") public float getLight() { return this.pressure; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java index 229a05b..d11642e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAmbientTemperatureData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAirPressureData encapsulates measurements related to the Air Pressure sensor. + */ public class SKAmbientTemperatureData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAmbientTemperatureData extends SKAbstractData { protected final float temperature; + /** + * Initialize Ambient Temperature data instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param temperature In degrees Celsius + */ public SKAmbientTemperatureData(long timestamp, float temperature) { super(SKSensorType.AMBIENT_TEMPERATURE, timestamp); @@ -39,11 +49,22 @@ public SKAmbientTemperatureData(long timestamp, float temperature) { this.temperature = temperature; } + /** + * Get the Ambient Temperature sensor data in csv format + * + * @return Ambient Temperature data in csv format: timestamp,ambient temperature + * + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.temperature); } + /** + * Get only the Ambient Temperature + * + * @return Ambient Temperature + */ @SuppressWarnings("unused") public float getTemperature() { return this.temperature; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java index df078f2..9e79f10 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKAudioLevelData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKAudioLevelData encapsulates measurements related to the Audio Level sensor. + */ public class SKAudioLevelData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKAudioLevelData extends SKAbstractData { protected final int level; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param level - Audio Level + */ public SKAudioLevelData(long timestamp, int level) { super(SKSensorType.AUDIO_LEVEL, timestamp); @@ -39,11 +49,21 @@ public SKAudioLevelData(long timestamp, int level) { this.level = level; } + /** + * Get the audio level measurement in csv format + * + * @return String containing the timestamp and audio level measurements in csv format: timestamp,level + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%d", this.timestamp, this.level); } + /** + * Get the audio level only + * + * @return Audio level + */ @SuppressWarnings("unused") public int getLevel() { return this.level; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java index ce5118d..b0a38ae 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBatteryData.java @@ -29,6 +29,9 @@ import static android.os.BatteryManager.*; +/** + * An instance of SKBatteryData encapsulates Battery properties + */ public class SKBatteryData extends SKAbstractData { @SuppressWarnings("unused") @@ -42,6 +45,27 @@ public class SKBatteryData extends SKAbstractData { protected final int status; protected final int health; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param level Indicates the current battery charge level. Value ranges from 0 to maximum battery level + * + * @param scale Maximum battery level + * + * @param temperature Current battery temperature + * + * @param voltage Current battery voltage + * + * @param plugged Values are: 0 - on battery, BATTERY_PLUGGED_AC, BATTERY_PLUGGED_USB, BATTERY_PLUGGED_WIRELESS + * + * @param status Values are: BATTERY_STATUS_CHARGING, BATTERY_STATUS_DISCHARGING, BATTERY_STATUS_FULL, + * BATTERY_STATUS_NOT_CHARGING, BATTERY_STATUS_UNKNOWN + * + * @param health Values are: BATTERY_HEALTH_COLD, BATTERY_HEALTH_DEAD, BATTERY_HEALTH_GOOD, BATTERY_HEALTH_OVERHEAT, + * BATTERY_HEALTH_OVER_VOLTAGE, BATTERY_HEALTH_UNKNOWN + */ public SKBatteryData(long timestamp, int level, int scale, int temperature, int voltage, int plugged, int status, int health) { super(SKSensorType.BATTERY, timestamp); @@ -55,11 +79,26 @@ public SKBatteryData(long timestamp, int level, int scale, int temperature, int this.health = health; } - @Override + /** + * Get the battery properties in csv format + * + * @return String containing the battery properties in csv format: timestamp,charge,temperature, + * voltage, + * plugged string ("usb", "ac", "wireless" or "unknown"), + * status string ("charging", "discharging", "full", "not charging", "unknown" or "unsupported"), + * health string ("cold", "dead", "good", "over heat", "over voltage", "unknown", "failure" or "unsupported") + */ + + @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%d,%d,%s,%s,%s", this.timestamp, this.getLevelRatio(), this.temperature, this.voltage, getPluggedString(), getBatteryStatusString(), getBatteryHealthString()); } + /** + * Get the battery charge + * + * @return charge (level/scale) + */ @SuppressWarnings("unused") public float getLevelRatio() { @@ -72,51 +111,101 @@ public float getLevelRatio() { } } + /** + * Get the battery level + * + * @return level + */ @SuppressWarnings("unused") public int getLevel() { return this.level; } + /** + * Get the battery scale + * + * @return scale + */ @SuppressWarnings("unused") public int getScale() { return this.scale; } + /** + * Get the battery temperature + * + * @return temperature + */ @SuppressWarnings("unused") public int getTemperature() { return this.temperature; } + /** + * Get the battery voltage + * + * @return voltage + */ @SuppressWarnings("unused") public int getVoltage() { return this.voltage; } + /** + * Get the battery plugged state + * + * @return plugged + */ @SuppressWarnings("unused") public int getPlugged() { return this.plugged; } + /** + * Get the battery status + * + * @return status + */ @SuppressWarnings("unused") public int getBatteryStatus() { return this.status; } + /** + * Get the battery health + * + * @return health + */ @SuppressWarnings("unused") public int getBatteryHealth() { return this.health; } + /** + * Get the battery plugged state in string format + * + * @return plugged in string format + */ @SuppressWarnings("unused") public String getPluggedString() { return getPluggedString(this.plugged); } + /** + * Get the battery status in string format + * + * @return status in string format + */ @SuppressWarnings("unused") public String getBatteryStatusString() { return getBatteryStatusString(this.status); } + /** + * Get the battery health in string format + * + * @return health in string format + */ @SuppressWarnings("unused") public String getBatteryHealthString() { return getBatteryHealthString(this.health); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java index a7c8410..579d55e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothData.java @@ -26,6 +26,9 @@ import java.util.ArrayList; import java.util.Locale; +/** + * An instance of SKBluetoothData encapsulates measurements related to all the Bluetooth devices. + */ public class SKBluetoothData extends SKAbstractData { @SuppressWarnings("unused") @@ -33,6 +36,13 @@ public class SKBluetoothData extends SKAbstractData { private final ArrayList mBluetoothDevices; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param bluetoothDevices One BluetoothDeviceData object for each Bluetooth device + */ public SKBluetoothData(long timestamp, ArrayList bluetoothDevices) { super(SKSensorType.BLUETOOTH, timestamp); @@ -40,6 +50,11 @@ public SKBluetoothData(long timestamp, ArrayList bluetoot this.mBluetoothDevices = bluetoothDevices; } + /** + * Get the data for all Bluetooth devices in CSV format + * + * @return String formatted as follows: timestamp,device1 data, device2 data,,, + */ @Override public String getDataInCSV() { @@ -60,6 +75,11 @@ public String getDataInCSV() { return stringBuilder.toString(); } + /** + * Get Bluetooth Device data + * + * @return an ArrayList containing an SKBluetoothDeviceData object for each Bluetooth Device + */ @SuppressWarnings("unused") public ArrayList getBluetoothDevices() { return this.mBluetoothDevices; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java index d4f2c44..9cf7dde 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKBluetoothDeviceData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKBluetoothData encapsulates measurements related to one Bluetooth device. + */ public class SKBluetoothDeviceData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,15 @@ public class SKBluetoothDeviceData extends SKAbstractData { protected final String address; protected final int rssi; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param name Device name + * @param address Device Address + * @param rssi Device RSSI + */ public SKBluetoothDeviceData(long timestamp, String name, String address, int rssi) { super(SKSensorType.BLUETOOTH, timestamp); @@ -43,21 +55,41 @@ public SKBluetoothDeviceData(long timestamp, String name, String address, int rs this.rssi = rssi; } + /** + * Get Bluetooth data in CSV format + * + * @return String formatted as a CSV, containing: timestamp,name,address,rssi + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s,%s,%d", this.timestamp, this.name, this.address, this.rssi); } + /** + * Get the Bluetooth device name + * + * @return Bluetooth device name + */ @SuppressWarnings("unused") public String getName() { return this.name; } + /** + * Get the Bluetooth device address + * + * @return Bluetooth device address + */ @SuppressWarnings("unused") public String getAddress() { return this.address; } + /** + * Get the Bluetooth device RSSI + * + * @return Bluetooth device RSSI + */ @SuppressWarnings("unused") public int getRssi() { return this.rssi; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java index f51e47d..2064f6c 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGravityData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKGravityData encapsulates measurements related to the Gravity sensor. + */ public class SKGravityData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,17 @@ public class SKGravityData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis value + * + * @param y Y-axis value + * + * @param z Z-axis value + */ public SKGravityData(long timestamp, float x, float y, float z) { super(SKSensorType.GRAVITY, timestamp); @@ -43,21 +57,41 @@ public SKGravityData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the Gravity sensor data in csv format + * + * @return String in csv format: timestamp, x-axis, y-axis, z-axis + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the Gravity sensor X-axis value + * + * @return X-axis value + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Gravity sensor Y-axis value + * + * @return Y-axis value + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Gravity sensor Z-axis value + * + * @return Z-axis value + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java index da3a904..41620ea 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKGyroscopeData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKGyroscopeData encapsulates measurements related to the Gyroscope sensor. + */ public class SKGyroscopeData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +37,17 @@ public class SKGyroscopeData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x X-axis of the Gyroscope data + * + * @param y Y-axis of the Gyroscope data + * + * @param z Z-axis of the Gyroscope data + */ public SKGyroscopeData(long timestamp, float x, float y, float z) { super(SKSensorType.GYROSCOPE, timestamp); @@ -43,21 +57,41 @@ public SKGyroscopeData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get the Gyroscope data in csv format + * + * @return String in csv format: timestamp, X-axis, Y-axis, Z-axis + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get the X-axis of the Gyroscope sensor data + * + * @return X-axis value + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get the Y-axis of the Gyroscope sensor data + * + * @return Y-axis value + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get the Z-axis of the Gyroscope sensor data + * + * @return Z-axis value + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java index 8c910a6..2fb2b0e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKHumidityData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKHumidityData encapsulates measurements related to the Humidity sensor. + */ public class SKHumidityData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKHumidityData extends SKAbstractData { protected final float humidity; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param humidity Humidity measurement + */ public SKHumidityData(long timestamp, float humidity) { super(SKSensorType.HUMIDITY, timestamp); @@ -39,13 +49,18 @@ public SKHumidityData(long timestamp, float humidity) { this.humidity = humidity; } + /** + * Get humidity sensor data in CSV format + * + * @return String in CSV format: timestamp, humidity + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.humidity); } @SuppressWarnings("unused") - public float getLight() { + public float getHumidity() { return this.humidity; } diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java index 1badf50..101ec40 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLightData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKLightData encapsulates measurements related to the Light sensor. + */ public class SKLightData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKLightData extends SKAbstractData { protected final float light; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param light Ambient light in lux + */ public SKLightData(long timestamp, float light) { super(SKSensorType.LIGHT, timestamp); @@ -39,11 +49,21 @@ public SKLightData(long timestamp, float light) { this.light = light; } + /** + * Get light sensor data in CSV format + * + * @return String in CSV format: timestamp, ambient light in lux + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.light); } + /** + * Get light sensor data + * + * @return Ambient light in lux + */ @SuppressWarnings("unused") public float getLight() { return this.light; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java index 74cf396..2ba4db6 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLinearAccelerationData.java @@ -25,6 +25,10 @@ import java.util.Locale; +/** + * An instance of SKLinearAccelerationData encapsulates measurements related to the Linear Acceleration sensor. + * Measures the acceleration force in mass/seconds**2, excluding the force of gravity + */ public class SKLinearAccelerationData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +38,17 @@ public class SKLinearAccelerationData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Force in X direction + * + * @param y Force in Y direction + * + * @param z Force in Z direction + */ public SKLinearAccelerationData(long timestamp, float x, float y, float z) { super(SKSensorType.LINEAR_ACCELERATION, timestamp); @@ -43,21 +58,41 @@ public SKLinearAccelerationData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get Linear Acceleration sensor data in CSV format + * + * @return String in CSV format: timestamp, x force, y force, z force + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get Linear Acceleration force in X direction + * + * @return force in X direction + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Linear Acceleration force in Y direction + * + * @return force in Y direction + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Linear Acceleration force in Z direction + * + * @return force in Z direction + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java index 298a078..a60a450 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKLocationData.java @@ -28,6 +28,9 @@ import java.util.Locale; +/** + * An instance of SKLocationData encapsulates measurements related to the Light sensor. + */ public class SKLocationData extends SKAbstractData { @SuppressWarnings("unused") @@ -35,6 +38,13 @@ public class SKLocationData extends SKAbstractData { protected final Location location; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param location Location object + */ public SKLocationData(long timestamp, Location location) { super(SKSensorType.LOCATION, timestamp); @@ -42,11 +52,21 @@ public SKLocationData(long timestamp, Location location) { this.location = location; } + /** + * Get location sensor data in CSV format + * + * @return String in CSV format: timestamp, location + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s", this.timestamp, this.location); } + /** + * Get Location object + * + * @return Location object + */ @SuppressWarnings("unused") public Location getLocation() { return location; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java index f444adb..f55f1d8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMagnetometerData.java @@ -25,6 +25,12 @@ import java.util.Locale; + +/** + * An instance of SKMagnetometerData encapsulates measurements related to the Magnetometer sensor. + * Measures the magnetic force in micro-Tesla + */ + public class SKMagnetometerData extends SKAbstractData { @SuppressWarnings("unused") @@ -34,6 +40,17 @@ public class SKMagnetometerData extends SKAbstractData { protected final float y; protected final float z; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Force in X-direction + * + * @param y Force in Y-direction + * + * @param z Force in Z-direction + */ public SKMagnetometerData(long timestamp, float x, float y, float z) { super(SKSensorType.MAGNETOMETER, timestamp); @@ -43,21 +60,41 @@ public SKMagnetometerData(long timestamp, float x, float y, float z) { this.z = z; } + /** + * Get Magnetometer sensor data in CSV format + * + * @return String in CSV format: timestamp, x force, y force, z force + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f", this.timestamp, this.x, this.y, this.z); } + /** + * Get Magnetometer force in X direction + * + * @return force in X direction + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Magnetometer force in Y direction + * + * @return force in Y direction + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Magnetometer force in Z direction + * + * @return force in Z direction + */ @SuppressWarnings("unused") public float getZ() { return this.z; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java index 87e1ac2..93a0d6c 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKRotationData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKRotationData encapsulates measurements related to the Rotation sensor. + */ public class SKRotationData extends SKAbstractData { @SuppressWarnings("unused") @@ -36,6 +39,23 @@ public class SKRotationData extends SKAbstractData { protected final float cos; protected final float headingAccuracy; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Rotation axis x-component*sin(theta/2) + * + * @param y Rotation axis y-component*sin(theta/2) + * + * @param z Rotation axis z-component*sin(theta/2) + * + * @param cos Cos(theta) + * + * where theta is the angle of rotation + * + * @param headingAccuracy Estimated accuracy in radians + */ public SKRotationData(long timestamp, float x, float y, float z, float cos, float headingAccuracy) { super(SKSensorType.ROTATION, timestamp); @@ -47,35 +67,78 @@ public SKRotationData(long timestamp, float x, float y, float z, float cos, floa this.headingAccuracy = headingAccuracy; } + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param x Rotation axis x-component*sin(theta/2) + * + * @param y Rotation axis y-component*sin(theta/2) + * + * @param z Rotation axis z-component*sin(theta/2) + * + * where theta is the angle of rotation + */ public SKRotationData(long timestamp, float x, float y, float z) { this(timestamp, x, y, z, 0, 0); } + /** + * Get Rotation sensor data in CSV format + * + * @return String in CSV format: timestamp, x, y, z, cos, headingAccuracy + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f,%f,%f,%f,%f", this.timestamp, this.x, this.y, this.z, this.cos, this.headingAccuracy); } + /** + * Get X component of rotation + * + * @return X component + */ @SuppressWarnings("unused") public float getX() { return this.x; } + /** + * Get Y component of rotation + * + * @return Y component + */ @SuppressWarnings("unused") public float getY() { return this.y; } + /** + * Get Z component of rotation + * + * @return Z component + */ @SuppressWarnings("unused") public float getZ() { return this.z; } + /** + * Get cos of the angle of rotation + * + * @return Cos(theta) + */ @SuppressWarnings("unused") public float getCos() { return this.cos; } + /** + * Get heading accuracy of rotation data + * + * @return Heading accuracy + */ @SuppressWarnings("unused") public float getHeadingAccuracy() { return this.headingAccuracy; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java index 449f5b1..3a70139 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKScreenStatusData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKScreenStatusData encapsulates measurements related to the Screen Status sensor. + */ public class SKScreenStatusData extends SKAbstractData { @SuppressWarnings("unused") @@ -36,6 +39,12 @@ public class SKScreenStatusData extends SKAbstractData { protected final int status; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * @param status Screen status + */ public SKScreenStatusData(long timestamp, int status) { super(SKSensorType.SCREEN_STATUS, timestamp); @@ -43,16 +52,31 @@ public SKScreenStatusData(long timestamp, int status) { this.status = status; } + /** + * Get Screen Status sensor data in CSV format + * + * @return String in CSV format: timestamp, screen status string + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%s", this.timestamp, this.getStatusString()); } + /** + * Get screen status + * + * @return Screen status as an int + */ @SuppressWarnings("unused") public int getStatus() { return this.status; } + /** + * Get screen status as a string + * + * @return Screen status as a string: "screen off", "screen on", or "unknown" + */ @SuppressWarnings("unused") public String getStatusString() { diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java index a88a603..efe8051 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepCounterData.java @@ -25,6 +25,9 @@ import java.util.Locale; +/** + * An instance of SKStepCounterData encapsulates measurements related to the Step Counter sensor. + */ public class SKStepCounterData extends SKAbstractData { @SuppressWarnings("unused") @@ -32,6 +35,13 @@ public class SKStepCounterData extends SKAbstractData { protected final float steps; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + * + * @param steps Number of steps + */ public SKStepCounterData(long timestamp, float steps) { super(SKSensorType.STEP_COUNTER, timestamp); @@ -39,11 +49,21 @@ public SKStepCounterData(long timestamp, float steps) { this.steps = steps; } + /** + * Get Step Counter sensor data in CSV format + * + * @return String in CSV format: timestamp, number of steps + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d,%f", this.timestamp, this.steps); } + /** + * Get number of steps + * + * @return number of steps + */ @SuppressWarnings("unused") public float getSteps() { return this.steps; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java index 089902e..85b21b7 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKStepDetectorData.java @@ -25,16 +25,29 @@ import java.util.Locale; +/** + * An instance of SKStepCounterData encapsulates measurements related to the Step Counter sensor. + */ public class SKStepDetectorData extends SKAbstractData { @SuppressWarnings("unused") private static final String TAG = "SKStepDetectorData"; + /** + * Initialize the instance + * + * @param timestamp Time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC) + */ public SKStepDetectorData(long timestamp) { super(SKSensorType.STEP_DETECTOR, timestamp); } + /** + * Get Step Detector sensor data in CSV format + * + * @return String in CSV format: timestamp, step detector data + */ @Override public String getDataInCSV() { return String.format(Locale.US, "%d", this.timestamp); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java index a8070f2..87041d0 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractGoogleServicesSensor.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.Bundle; +import android.support.annotation.NonNull; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; @@ -57,7 +58,7 @@ public void onConnectionSuspended(int cause) { } @Override - public void onConnectionFailed(ConnectionResult result) { + public void onConnectionFailed(@NonNull ConnectionResult result) { // At least one of the API client connect attempts failed // No client is connected } diff --git a/build.gradle b/build.gradle index 1b7886d..a6fcfe1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' + classpath 'com.android.tools.build:gradle:1.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From f16b06231fc43c987dab055f4798b01d517655a0 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 13:40:25 +0000 Subject: [PATCH 048/295] Fix merge issues --- SensingKitLib/SensingKitLib.iml | 13 ++----------- SensingKitLib/build.gradle | 3 --- SensingKitLib/src/main/AndroidManifest.xml | 4 ---- .../org/sensingkit/sensingkitlib/SKSensorType.java | 3 --- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index d713b14..178881f 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -71,13 +71,8 @@ -<<<<<<< HEAD - - - - -======= + @@ -85,7 +80,6 @@ ->>>>>>> origin/develop @@ -95,15 +89,12 @@ -<<<<<<< HEAD - -======= + ->>>>>>> origin/develop \ No newline at end of file diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 6e7b83a..06cfe99 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -20,9 +20,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) -<<<<<<< HEAD compile 'com.estimote:sdk:0.9.4@aar' -======= ->>>>>>> origin/develop compile 'com.google.android.gms:play-services-location:8.4.0' } diff --git a/SensingKitLib/src/main/AndroidManifest.xml b/SensingKitLib/src/main/AndroidManifest.xml index eb648a9..acc16a3 100644 --- a/SensingKitLib/src/main/AndroidManifest.xml +++ b/SensingKitLib/src/main/AndroidManifest.xml @@ -4,11 +4,7 @@ -<<<<<<< HEAD -======= - ->>>>>>> origin/develop diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index a33e413..0bd21bc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -99,11 +99,8 @@ public enum SKSensorType { * Relative ambient air humidity in percent */ HUMIDITY, -<<<<<<< HEAD EDDYSTONE_PROXIMITY, IBEACON, -======= ->>>>>>> origin/develop /** * Atmospheric pressure in hPa (millibar) */ From 2d8712e3944c3375bfd7dbdb653e5a85d4008210 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:04:04 +0000 Subject: [PATCH 049/295] Add documentation for iBeacon and Eddystone sensors --- .../sensingkitlib/SKSensorType.java | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 0bd21bc..1c09167 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -29,78 +29,104 @@ public enum SKSensorType { * Measures the device acceleration changes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. */ ACCELEROMETER, + /** * Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z). */ GRAVITY, + /** * Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity. */ LINEAR_ACCELERATION, + /** * Measures the device's rate of rotation around each of the three spatial axes. */ GYROSCOPE, + /** * Measures the orientation of a device by providing the three elements of the device's rotation vector. */ ROTATION, + /** * Measures the ambient geomagnetic field for all three physical axes (x, y, z) in microtesla. */ MAGNETOMETER, + /** * Room temperature in degrees Celcius */ AMBIENT_TEMPERATURE, + /** * Returns 1.0 each time a step is taken */ STEP_DETECTOR, + /** * Number of steps taken by the user since the last reboot while activated */ STEP_COUNTER, + /** * Measures the ambient light level (illumination) in lux. */ LIGHT, + /** * Location sensor determines the current location of the device using a combination of Cellular, Wi-Fi, Bluetooth and GPS sensors. It provides 2D geographical coordinate information (latitude, longitude), as well as the altitude of the device. */ LOCATION, + /** * Motion Activity sensor uses an embedded motion co-processor that senses the user's activity classified as Stationary, Walking, Running, Automotive or Cycling. * Assume that Activity is the same as Motion Activity */ ACTIVITY, + /** * Battery sensor listens to changes in the battery charge state (Charging, Full, Unplugged) as well as in the battery charge level (with 1% precision). */ BATTERY, + /** * Not defined in IOS docs */ SCREEN_STATUS, + /** * Microphone sensor can be used to record audio from the environment (up to 4 hours) by converting sound into electrical signal. * Assume that Microphone is the same as AUDIO RECORDER */ AUDIO_RECORDER, + /** * Maximum level of the audio signal in a buffer */ AUDIO_LEVEL, + /** - * Get data from a bluetooth device + * Scans for other Bluetooth Classic devices around. */ BLUETOOTH, + /** - * Relative ambient air humidity in percent + * Eddystone Proximity sensor estimates the proximity of the current device with other Eddystone beacons in range. */ - HUMIDITY, EDDYSTONE_PROXIMITY, + + /** + * iBeacon Proximity sensor estimates the proximity of the current device with other iBeacons in range. + */ IBEACON, + + /** + * Relative ambient air humidity in percent + */ + HUMIDITY, + /** * Atmospheric pressure in hPa (millibar) */ From 31038a0ab76e3978c3b10b16d72c6522fc8dfa54 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:04:27 +0000 Subject: [PATCH 050/295] Add Eddystone and iBeacon into the sensor list --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4ee7d36..af6bc1c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ The following sensor modules are currently supported in SensingKit-Android, (lis - Audio Recorder - Audio Level - Bluetooth +- Eddystone +- iBeacon - Humidity - Air Pressure From 030205bd27fd27d54c822c41bae5ae03b349e179 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:07:37 +0000 Subject: [PATCH 051/295] Update documentation --- .../sensingkit/sensingkitlib/SKSensorType.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 1c09167..9c38b08 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -56,7 +56,7 @@ public enum SKSensorType { MAGNETOMETER, /** - * Room temperature in degrees Celcius + * Room temperature in degrees Celcius. */ AMBIENT_TEMPERATURE, @@ -66,7 +66,7 @@ public enum SKSensorType { STEP_DETECTOR, /** - * Number of steps taken by the user since the last reboot while activated + * Number of steps taken by the user since the last reboot while activated. */ STEP_COUNTER, @@ -82,7 +82,6 @@ public enum SKSensorType { /** * Motion Activity sensor uses an embedded motion co-processor that senses the user's activity classified as Stationary, Walking, Running, Automotive or Cycling. - * Assume that Activity is the same as Motion Activity */ ACTIVITY, @@ -92,18 +91,17 @@ public enum SKSensorType { BATTERY, /** - * Not defined in IOS docs + * Senses the status of the screen (On / Off). */ SCREEN_STATUS, /** - * Microphone sensor can be used to record audio from the environment (up to 4 hours) by converting sound into electrical signal. - * Assume that Microphone is the same as AUDIO RECORDER + * Microphone sensor can be used to record audio from the environment by converting sound into electrical signal. */ AUDIO_RECORDER, /** - * Maximum level of the audio signal in a buffer + * Maximum level of the audio signal in a buffer. */ AUDIO_LEVEL, @@ -123,12 +121,12 @@ public enum SKSensorType { IBEACON, /** - * Relative ambient air humidity in percent + * Relative ambient air humidity in percent. */ HUMIDITY, /** - * Atmospheric pressure in hPa (millibar) + * Atmospheric pressure in hPa (millibar). */ AIR_PRESSURE } \ No newline at end of file From 43e316cfcb525d53ee2f512163796605cce54e55 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:20:21 +0000 Subject: [PATCH 052/295] Rename Audio Recorder sensor to Microphone --- README.md | 2 +- .../org/sensingkit/sensingkitlib/SKSensorManager.java | 4 ++-- .../org/sensingkit/sensingkitlib/SKSensorType.java | 2 +- .../{SKAudioRecorder.java => SKMicrophone.java} | 10 +++++----- .../sensingkitlib/sensors/SKSensorUtilities.java | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/{SKAudioRecorder.java => SKMicrophone.java} (86%) diff --git a/README.md b/README.md index af6bc1c..efeea89 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The following sensor modules are currently supported in SensingKit-Android, (lis - Activity - Battery - Screen Status -- Audio Recorder +- Microphone - Audio Level - Bluetooth - Eddystone diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 2c88f44..3d9f72d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -207,8 +207,8 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept sensor = new SKScreenStatus(mApplicationContext); break; - case AUDIO_RECORDER: - sensor = new SKAudioRecorder(mApplicationContext); + case MICROPHONE: + sensor = new SKMicrophone(mApplicationContext); break; case AUDIO_LEVEL: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index 9c38b08..f5cf20d 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -98,7 +98,7 @@ public enum SKSensorType { /** * Microphone sensor can be used to record audio from the environment by converting sound into electrical signal. */ - AUDIO_RECORDER, + MICROPHONE, /** * Maximum level of the audio signal in a buffer. diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMicrophone.java similarity index 86% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMicrophone.java index 2fb5319..626f1dc 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAudioRecorder.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMicrophone.java @@ -32,17 +32,17 @@ import java.io.IOException; -public class SKAudioRecorder extends SKAbstractSensor { +public class SKMicrophone extends SKAbstractSensor { @SuppressWarnings("unused") - private static final String TAG = "SKAudioRecorder"; + private static final String TAG = "SKMicrophone"; private static final String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/recording.aac"; private final MediaRecorder recorder; - public SKAudioRecorder(final Context context) throws SKException { - super(context, SKSensorType.AUDIO_RECORDER); + public SKMicrophone(final Context context) throws SKException { + super(context, SKSensorType.MICROPHONE); recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); @@ -67,7 +67,7 @@ public void startSensing() throws SKException { recorder.prepare(); } catch (IOException e) { e.printStackTrace(); - throw new SKException(TAG, "AudioRecorder sensor could not be prepared.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Microphone sensor could not be prepared.", SKExceptionErrorCode.UNKNOWN_ERROR); } recorder.start(); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java index f73f9a6..e84ef04 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java @@ -76,8 +76,8 @@ public static String getSensorInString(SKSensorType sensorType) throws SKExcepti case SCREEN_STATUS: return "Screen Status"; - case AUDIO_RECORDER: - return "Audio Recorder"; + case MICROPHONE: + return "Microphone"; case AUDIO_LEVEL: return "Audio Level"; From 37e72554784dbe8cb77b8a57ffb5af64cfdb5537 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:24:42 +0000 Subject: [PATCH 053/295] Rename Activity sensor to Motion Activity --- README.md | 2 +- .../sensingkitlib/SKSensorManager.java | 4 ++-- .../sensingkit/sensingkitlib/SKSensorType.java | 2 +- ...tivityData.java => SKMotionActivityData.java} | 10 +++++----- .../sensors/SKAbstractNativeSensor.java | 2 +- .../{SKActivity.java => SKMotionActivity.java} | 16 ++++++++-------- .../sensingkitlib/sensors/SKSensorUtilities.java | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/{SKActivityData.java => SKMotionActivityData.java} (91%) rename SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/{SKActivity.java => SKMotionActivity.java} (91%) diff --git a/README.md b/README.md index efeea89..11958e2 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The following sensor modules are currently supported in SensingKit-Android, (lis - Step Counter - Light - Location -- Activity +- Motion Activity - Battery - Screen Status - Microphone diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 3d9f72d..2891416 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -195,8 +195,8 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept sensor = new SKLocation(mApplicationContext); break; - case ACTIVITY: - sensor = new SKActivity(mApplicationContext); + case MOTION_ACTIVITY: + sensor = new SKMotionActivity(mApplicationContext); break; case BATTERY: diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java index f5cf20d..dfb046e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorType.java @@ -83,7 +83,7 @@ public enum SKSensorType { /** * Motion Activity sensor uses an embedded motion co-processor that senses the user's activity classified as Stationary, Walking, Running, Automotive or Cycling. */ - ACTIVITY, + MOTION_ACTIVITY, /** * Battery sensor listens to changes in the battery charge state (Charging, Full, Unplugged) as well as in the battery charge level (with 1% precision). diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMotionActivityData.java similarity index 91% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMotionActivityData.java index 8cada79..db8c1db 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKActivityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKMotionActivityData.java @@ -28,13 +28,13 @@ import java.util.Locale; /** - * An instance of SKActivityData encapsulates measurements related to the Activity sensor. + * An instance of SKMotionActivityData encapsulates measurements related to the Activity sensor. * Activity is classified as Stationary, Walking, Running, Automotive, Cycling, Tilt, or Unknown. */ -public class SKActivityData extends SKAbstractData { +public class SKMotionActivityData extends SKAbstractData { @SuppressWarnings("unused") - private static final String TAG = "SKActivityData"; + private static final String TAG = "SKMotionActivityData"; protected final int activityType; protected final int confidence; @@ -48,9 +48,9 @@ public class SKActivityData extends SKAbstractData { * * @param confidence Confidence percentage for the most probable activity */ - public SKActivityData(long timestamp, int activityType, int confidence) { + public SKMotionActivityData(long timestamp, int activityType, int confidence) { - super(SKSensorType.ACTIVITY, timestamp); + super(SKSensorType.MOTION_ACTIVITY, timestamp); this.activityType = activityType; this.confidence = confidence; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java index bc1eaf7..ef231ae 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java @@ -146,7 +146,7 @@ private static int getSensorType(SKSensorType sensorType) throws SKException{ return Sensor.TYPE_PRESSURE; case LOCATION: - case ACTIVITY: + case MOTION_ACTIVITY: case BATTERY: throw new SKException(TAG, "Not a native SensorModule.", SKExceptionErrorCode.UNKNOWN_ERROR); diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMotionActivity.java similarity index 91% rename from SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java rename to SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMotionActivity.java index 7a35e9f..7de828a 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKActivity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKMotionActivity.java @@ -38,12 +38,12 @@ import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKSensorType; import org.sensingkit.sensingkitlib.data.SKAbstractData; -import org.sensingkit.sensingkitlib.data.SKActivityData; +import org.sensingkit.sensingkitlib.data.SKMotionActivityData; -public class SKActivity extends SKAbstractGoogleServicesSensor { +public class SKMotionActivity extends SKAbstractGoogleServicesSensor { @SuppressWarnings("unused") - private static final String TAG = "SKActivity"; + private static final String TAG = "SKMotionActivity"; private ActivityRecognitionApi mActivityRecognition; private PendingIntent mRecognitionPendingIntent; @@ -53,8 +53,8 @@ public class SKActivity extends SKAbstractGoogleServicesSensor { private int mLastActivityTypeSensed = Integer.MAX_VALUE; private int mLastConfidenceSensed = Integer.MAX_VALUE; - public SKActivity(final Context context) throws SKException { - super(context, SKSensorType.ACTIVITY); + public SKMotionActivity(final Context context) throws SKException { + super(context, SKSensorType.MOTION_ACTIVITY); mClient = new GoogleApiClient.Builder(context) .addApi(ActivityRecognition.API) @@ -80,7 +80,7 @@ public void onReceive(Context context, Intent intent) { int confidence = activity.getConfidence(); // Build the data object - SKAbstractData data = new SKActivityData(result.getTime(), activityType, confidence); + SKAbstractData data = new SKMotionActivityData(result.getTime(), activityType, confidence); // Submit sensor data object submitSensorData(data); @@ -179,8 +179,8 @@ protected boolean shouldPostSensorData(SKAbstractData data) { // Only post when specific values changed - int activityType = ((SKActivityData)data).getActivityType(); - int confidence = ((SKActivityData)data).getConfidence(); + int activityType = ((SKMotionActivityData)data).getActivityType(); + int confidence = ((SKMotionActivityData)data).getConfidence(); // Ignore Temperature and Voltage boolean shouldPost = (mLastActivityTypeSensed != activityType || diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java index e84ef04..fdbed62 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKSensorUtilities.java @@ -67,8 +67,8 @@ public static String getSensorInString(SKSensorType sensorType) throws SKExcepti case LOCATION: return "Location"; - case ACTIVITY: - return "Activity"; + case MOTION_ACTIVITY: + return "Motion Activity"; case BATTERY: return "Battery"; From d8231b272f1aa69b7f76b349711cf44a0e6189a0 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:45:20 +0000 Subject: [PATCH 054/295] Add missing license in headers, mentioning Ming's details. --- .../data/SKEddystoneProximityData.java | 26 +++++++++++++++--- .../sensingkitlib/data/SKiBeaconData.java | 27 ++++++++++++++++--- .../sensors/SKEddystoneProximity.java | 26 +++++++++++++++--- .../sensingkitlib/sensors/SKiBeacon.java | 24 ++++++++++++++--- 4 files changed, 88 insertions(+), 15 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java index adb03d5..b960e00 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKEddystoneProximityData.java @@ -1,13 +1,31 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * Ming-Jiun Huang, ud2601@gmail.com + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + package org.sensingkit.sensingkitlib.data; import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; -/** - * Created by Ming-Jiun Huang on 11/14/15. - */ - public class SKEddystoneProximityData extends SKAbstractData { @SuppressWarnings("unused") diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java index 0a2287d..e364f20 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/data/SKiBeaconData.java @@ -1,13 +1,32 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * Ming-Jiun Huang, ud2601@gmail.com + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + package org.sensingkit.sensingkitlib.data; import org.sensingkit.sensingkitlib.SKSensorType; import java.util.Locale; -/** - * Created by U3D3 on 1/12/16. - */ -public class SKiBeaconData extends SKAbstractData{ +public class SKiBeaconData extends SKAbstractData { @SuppressWarnings("unused") private static final String TAG = "SKiBeaconData"; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java index e459d67..2fd1775 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKEddystoneProximity.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * Ming-Jiun Huang, ud2601@gmail.com + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + package org.sensingkit.sensingkitlib.sensors; import android.annotation.TargetApi; @@ -24,10 +46,6 @@ import java.util.ArrayList; import java.util.List; -/** - * Created by Ming-Jiun Huang on 11/14/15. - */ - public class SKEddystoneProximity extends SKAbstractSensor { @SuppressWarnings("unused") diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java index 37a5505..26d4fb1 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKiBeacon.java @@ -1,7 +1,25 @@ +/* + * Copyright (c) 2015. Queen Mary University of London + * Kleomenis Katevas, k.katevas@qmul.ac.uk + * + * This file is part of SensingKit-Android library. + * For more information, please visit http://www.sensingkit.org + * + * SensingKit-Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SensingKit-Android is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with SensingKit-Android. If not, see . + */ + package org.sensingkit.sensingkitlib.sensors; -/** - * Created by U3D3 on 1/12/16. - */ public class SKiBeacon { } From a4ad13a1eac479dfe6984cb0069c73a62517a00d Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 14:57:48 +0000 Subject: [PATCH 055/295] Update changelog --- CHANGELOG.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f827ee..2ae618a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,22 @@ # Changelog -### Next -- Added support for Air Pressure sensor module -- Added support for Humidity sensor module -- Updated Google Play Services to 8.1.0 -- Added support for Android Studio 1.4.0 +### 0.3.0 (??, 2016) +- Added Documentation using javadoc generator (thanks to Susan Crayne @crayne) +- Added support for Air Pressure sensor +- Added support for Humidity sensor +- Added support for Eddystone sensor (thanks to Ming-Jiun Huang @U3D3) +- Added support for iBeacon sensor +- Added support for Android Studio 1.5.1 - Added support for Android 6.0 SDK (Marshmallow) -- Updated gradle to 1.3.0 +- Renamed Activity sensor to Motion Activity +- Renamed Audio Level sensor to Microphone +- Renamed all sensor modules into sensors +- Updated SensingKit-Android API (thanks to Ming-Jiun Huang @U3D3) +- Updated Google Play Services to 8.4.0 +- Updated gradle to 1.5.0 ### 0.2.0 (July 30, 2015) -- Added support for Bluetooth sensor module +- Added support for Bluetooth sensor - DataInterface method getDataInString() has been renamed to getDataInCSV() - SKDataInterface has been renamed to SKSensorData - Added getSensorModuleType() to SKSensorData From 1b7c7aa661cfb74f73c3be150d2b1cd5aff473bf Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 15:57:11 +0000 Subject: [PATCH 056/295] Update build tools to 23.0.1 --- SensingKitLib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index 06cfe99..fb82cc6 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "22.0.1" + buildToolsVersion '23.0.1' defaultConfig { minSdkVersion 16 From 9e017be0c2de1608689faaf3d8043e8f1161bb2c Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Tue, 12 Jan 2016 15:59:14 +0000 Subject: [PATCH 057/295] Update play-services-location to 8.4.0 in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11958e2..3aada87 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'org.sensingkit:SensingKitLib-release@aar' compile 'com.android.support:appcompat-v7:23.0.0’ - compile 'com.google.android.gms:play-services-location:7.8.0' + compile 'com.google.android.gms:play-services-location:8.4.0' } ``` From 450c709ae65c05b780c70e2a32290ef3d8480bab Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Wed, 13 Jan 2016 13:59:17 +0000 Subject: [PATCH 058/295] Update build tools to 23.0.2 --- SensingKitLib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/build.gradle b/SensingKitLib/build.gradle index fb82cc6..f606f5f 100644 --- a/SensingKitLib/build.gradle +++ b/SensingKitLib/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion '23.0.1' + buildToolsVersion '23.0.2' defaultConfig { minSdkVersion 16 From c4a4ab8e4f5fe76e2ce76706dbef5dde4321027c Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Sat, 16 Jan 2016 18:47:03 +0000 Subject: [PATCH 059/295] Remove ref to module in the exception message. --- .../java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java index 6a5366c..0497b9e 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKBluetooth.java @@ -53,7 +53,7 @@ public SKBluetooth(Context context) throws SKException { mBluetoothDevices = new ArrayList<>(); if (mBluetoothAdapter == null) { - throw new SKException(TAG, "Bluetooth sensor module is not supported from the device.", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Bluetooth sensor is not supported from the device.", SKExceptionErrorCode.UNKNOWN_ERROR); } } From 1240736c37a0ec9ecadc6113cb88eaa5ce2d68e7 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Sat, 16 Jan 2016 21:23:45 +0000 Subject: [PATCH 060/295] Use one exception for all sensors that are not native --- .../sensingkitlib/sensors/SKAbstractNativeSensor.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java index ef231ae..91861ef 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java @@ -145,13 +145,8 @@ private static int getSensorType(SKSensorType sensorType) throws SKException{ case AIR_PRESSURE: return Sensor.TYPE_PRESSURE; - case LOCATION: - case MOTION_ACTIVITY: - case BATTERY: - throw new SKException(TAG, "Not a native SensorModule.", SKExceptionErrorCode.UNKNOWN_ERROR); - default: - throw new SKException(TAG, "Unknown SensorModule", SKExceptionErrorCode.UNKNOWN_ERROR); + throw new SKException(TAG, "Not a native SensorModule.", SKExceptionErrorCode.UNKNOWN_ERROR); } } From 653106be45e51abb17225544029ab468a50f6270 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Sat, 16 Jan 2016 21:29:25 +0000 Subject: [PATCH 061/295] Move sensor support checks in SKSensorManager --- .../sensingkitlib/SKSensorManager.java | 16 ++++++++++++++ .../sensors/SKAbstractNativeSensor.java | 21 +++---------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java index 2891416..f6238ae 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/SKSensorManager.java @@ -22,6 +22,7 @@ package org.sensingkit.sensingkitlib; import android.content.Context; +import android.os.Build; import android.util.Log; import android.util.SparseArray; @@ -180,10 +181,20 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept break; case STEP_DETECTOR: + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + throw new SKException(TAG, "STEP_DETECTOR requires Android KitKat or greater.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + sensor = new SKStepDetector(mApplicationContext); break; case STEP_COUNTER: + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + throw new SKException(TAG, "STEP_COUNTER requires Android KitKat or greater.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + sensor = new SKStepCounter(mApplicationContext); break; @@ -228,6 +239,11 @@ protected SKAbstractSensor createSensor(SKSensorType sensorType) throws SKExcept break; case EDDYSTONE_PROXIMITY: + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + throw new SKException(TAG, "EDDYSTONE_PROXIMITY requires Android Lollipop or greater.", SKExceptionErrorCode.UNKNOWN_ERROR); + } + sensor = new SKEddystoneProximity(mApplicationContext); break; diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java index 91861ef..d24a4bf 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java @@ -27,7 +27,6 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; -import android.os.Build; import org.sensingkit.sensingkitlib.SKException; import org.sensingkit.sensingkitlib.SKExceptionErrorCode; @@ -90,7 +89,7 @@ public void stopSensing() { protected abstract SKAbstractData buildData(SensorEvent event); - @SuppressLint("InlinedApi") // There is a check in STEP_DETECTOR and STEP_COUNTER + @SuppressLint("InlinedApi") // There is a check in SKSensorManager private static int getSensorType(SKSensorType sensorType) throws SKException{ switch (sensorType) { @@ -117,24 +116,10 @@ private static int getSensorType(SKSensorType sensorType) throws SKException{ return Sensor.TYPE_AMBIENT_TEMPERATURE; case STEP_DETECTOR: - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - return Sensor.TYPE_STEP_DETECTOR; - } - else - { - throw new SKException(TAG, "STEP_DETECTOR requires Android KitKat or greater.", SKExceptionErrorCode.UNKNOWN_ERROR); - } + return Sensor.TYPE_STEP_DETECTOR; case STEP_COUNTER: - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - return Sensor.TYPE_STEP_COUNTER; - } - else - { - throw new SKException(TAG, "STEP_COUNTER requires Android KitKat or greater.", SKExceptionErrorCode.UNKNOWN_ERROR); - } + return Sensor.TYPE_STEP_COUNTER; case LIGHT: return Sensor.TYPE_LIGHT; From 8509b0a89ebc3e3022de2eab0d74c471c59daa4b Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Sun, 24 Jan 2016 14:16:51 +0000 Subject: [PATCH 062/295] Change TAG to SKAbstractNativeSensor --- .../sensingkitlib/sensors/SKAbstractNativeSensor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java index d24a4bf..e7b07a8 100644 --- a/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java +++ b/SensingKitLib/src/main/java/org/sensingkit/sensingkitlib/sensors/SKAbstractNativeSensor.java @@ -36,7 +36,7 @@ public abstract class SKAbstractNativeSensor extends SKAbstractSensor { @SuppressWarnings("unused") - private static final String TAG = "SKAbstractNativeSensorModule"; + private static final String TAG = "SKAbstractNativeSensor"; private final SensorManager mSensorManager; private final Sensor mSensor; From 58ee1eaf380b8c60a8fdd041c5406b282dd56e2c Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Fri, 8 Apr 2016 07:41:31 +0100 Subject: [PATCH 063/295] Update gradle for Android Studio 2 --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index a6fcfe1..cb98401 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.android.tools.build:gradle:2.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 18f81f8..1c99709 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Dec 04 21:39:37 GMT 2014 +#Fri Apr 08 07:37:07 BST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip From d3109c6d2858cada8947d137f01abafec366e757 Mon Sep 17 00:00:00 2001 From: Minos Katevas Date: Fri, 21 Oct 2016 12:09:08 +0200 Subject: [PATCH 064/295] Update gradle (2.2.2) and compileSdkVersion (24) --- SensingKitLib/SensingKitLib.iml | 59 +++++++++++++++--------- SensingKitLib/build.gradle | 10 ++-- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/SensingKitLib/SensingKitLib.iml b/SensingKitLib/SensingKitLib.iml index 71c539d..83868d2 100644 --- a/SensingKitLib/SensingKitLib.iml +++ b/SensingKitLib/SensingKitLib.iml @@ -12,10 +12,7 @@