├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── ic_launcher.png │ │ ├── ic_launcher.xcf │ │ ├── drawable │ │ │ ├── ic_not_128.png │ │ │ ├── ic_rec_128.png │ │ │ ├── ic_upload.png │ │ │ ├── ic_act_bik_128.png │ │ │ ├── ic_act_bus_128.png │ │ │ ├── ic_act_car_128.png │ │ │ ├── ic_act_run_128.png │ │ │ ├── ic_act_sbw_128.png │ │ │ ├── ic_act_stl_128.png │ │ │ ├── ic_act_trn_128.png │ │ │ ├── ic_act_wlk_128.png │ │ │ ├── ic_upload_error.png │ │ │ ├── ic_pos_sit_on_128.png │ │ │ ├── ic_pos_std_on_128.png │ │ │ ├── ic_upload_success.png │ │ │ ├── ic_pos_sit_off_128.png │ │ │ ├── ic_pos_std_off_128.png │ │ │ ├── ic_pref_sensors_32.png │ │ │ ├── ic_info_black_24dp.xml │ │ │ ├── ic_sync_black_24dp.xml │ │ │ └── ic_pref_sensors_24dp.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-hdpi │ │ │ └── ic_record_voice_over_white_18dp.png │ │ ├── drawable-mdpi │ │ │ └── ic_record_voice_over_white_18dp.png │ │ ├── drawable-xhdpi │ │ │ └── ic_record_voice_over_white_18dp.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_record_voice_over_white_18dp.png │ │ ├── drawable-xxxhdpi │ │ │ └── ic_record_voice_over_white_18dp.png │ │ ├── values │ │ │ ├── integer.xml │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── arrays.xml │ │ ├── layout │ │ │ ├── bluetooth_device_name.xml │ │ │ ├── custom_icons_list_item.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_about.xml │ │ │ ├── activity_show_stats.xml │ │ │ ├── activity_bluetooth_device_list.xml │ │ │ └── activity_flag_event.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── xml │ │ │ ├── pref_headers.xml │ │ │ ├── pref_general.xml │ │ │ └── pref_data_sync.xml │ │ └── menu │ │ │ └── menu_main.xml │ │ ├── java │ │ └── uk │ │ │ └── ac │ │ │ └── sussex │ │ │ └── wear │ │ │ └── android │ │ │ └── datalogger │ │ │ ├── bt │ │ │ ├── multibluetooth │ │ │ │ ├── bus │ │ │ │ │ ├── BondedDevice.java │ │ │ │ │ ├── ClientConnectionFail.java │ │ │ │ │ ├── ClientConnectionSuccess.java │ │ │ │ │ ├── BluetoothCommunicator.java │ │ │ │ │ ├── ServeurConnectionSuccess.java │ │ │ │ │ └── ServeurConnectionFail.java │ │ │ │ └── bluetooth │ │ │ │ │ └── server │ │ │ │ │ └── BluetoothServer.java │ │ │ └── BluetoothConnectionHelper2.java │ │ │ ├── data │ │ │ ├── CommandBTS.java │ │ │ ├── CommandFUC.java │ │ │ ├── CommandFUS.java │ │ │ ├── CommandBTC.java │ │ │ ├── CommandFLE.java │ │ │ ├── CommandDCE.java │ │ │ ├── CommandBase.java │ │ │ ├── DataCollectionSession.java │ │ │ └── CommandKA.java │ │ │ ├── DataLoggerStatusDelegate.java │ │ │ ├── AboutActivity.java │ │ │ ├── collector │ │ │ ├── AbstractDataCollector.java │ │ │ ├── AudioDataCollector.java │ │ │ └── BatteryDataCollector.java │ │ │ ├── StartAtBootReceiver.java │ │ │ ├── upload │ │ │ ├── HttpStack.java │ │ │ ├── HurlStack.java │ │ │ ├── Placeholders.java │ │ │ ├── UploadStatusDelegate.java │ │ │ ├── NameValue.java │ │ │ ├── HttpConnection.java │ │ │ ├── BroadcastData.java │ │ │ ├── ServerResponse.java │ │ │ ├── UploadServiceBroadcastReceiver.java │ │ │ └── HttpUploadTaskParameters.java │ │ │ ├── db │ │ │ ├── DataLoggerOpenHelper.java │ │ │ ├── DataCollectionSessionTable.java │ │ │ └── LogFileTable.java │ │ │ ├── har │ │ │ └── HARecognizerApiIntentService.java │ │ │ ├── CustomIconsListAdapter.java │ │ │ ├── log │ │ │ ├── HARecognizerApiLogger.java │ │ │ ├── LoggerHelper.java │ │ │ ├── LabelsLogger.java │ │ │ └── CustomLogger.java │ │ │ ├── FlagEventActivity.java │ │ │ └── AppCompatPreferenceActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── img ├── master.png └── slave.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── copyright │ ├── profiles_settings.xml │ └── WearlabMITLicence.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── .gitignore ├── gradle.properties ├── LICENSE ├── PHP_upload_script.txt ├── gradlew.bat └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /img/master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/img/master.png -------------------------------------------------------------------------------- /img/slave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/img/slave.png -------------------------------------------------------------------------------- /app/src/main/res/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/ic_launcher.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/ic_launcher.xcf -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_not_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_not_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rec_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_rec_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_upload.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_bik_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_bik_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_bus_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_bus_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_car_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_car_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_run_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_run_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_sbw_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_sbw_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_stl_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_stl_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_trn_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_trn_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_act_wlk_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_act_wlk_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_upload_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_upload_error.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pos_sit_on_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_pos_sit_on_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pos_std_on_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_pos_std_on_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_upload_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_upload_success.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pos_sit_off_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_pos_sit_off_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pos_std_off_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_pos_std_off_128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pref_sensors_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable/ic_pref_sensors_32.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_record_voice_over_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable-hdpi/ic_record_voice_over_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_record_voice_over_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable-mdpi/ic_record_voice_over_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_record_voice_over_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable-xhdpi/ic_record_voice_over_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_record_voice_over_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable-xxhdpi/ic_record_voice_over_white_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_record_voice_over_white_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STRCWearlab/DataLogger/HEAD/app/src/main/res/drawable-xxxhdpi/ic_record_voice_over_white_18dp.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/integer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 4 | 2 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Mar 28 10:18:14 BST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sync_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #000000 4 | #00afaa 5 | #00272c 6 | #00afaa 7 | #00afaa 8 | #808080 9 | #D3D3D3 10 | #000000 11 | #00afaa 12 | #808080 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/fjordonez/Android/Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pref_sensors_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion '27.0.3' 6 | 7 | defaultConfig { 8 | applicationId "uk.ac.sussex.wear.android.datalogger" 9 | minSdkVersion 19 10 | targetSdkVersion 26 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation fileTree(dir: 'libs', include: ['*.jar']) 24 | testImplementation 'junit:junit:4.12' 25 | implementation 'com.android.support:appcompat-v7:26.1.0' 26 | implementation 'com.android.support:design:26.1.0' 27 | implementation 'com.google.android.gms:play-services-location:12.0.0' 28 | implementation 'com.google.code.gson:gson:2.8.0' 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 23 | 24 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 27 | 64dp 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/bt/multibluetooth/bus/BluetoothCommunicator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.bt.multibluetooth.bus; 24 | 25 | /** 26 | * Created by Rami MARTIN on 13/04/2014. 27 | */ 28 | public class BluetoothCommunicator { 29 | 30 | public String mMessageReceive; 31 | 32 | public BluetoothCommunicator(String messageReceive){ 33 | mMessageReceive = messageReceive; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/DataLoggerStatusDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger; 24 | 25 | 26 | public interface DataLoggerStatusDelegate { 27 | 28 | void onError(final int errorCode); 29 | 30 | void onUploadProgress(final int nbFilesUpload, final int nbRemainingFilesUpload, final String uploadRate, final long pct); 31 | 32 | void onUploadCancelled(); 33 | 34 | void onUploadComplete(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/bt/multibluetooth/bus/ServeurConnectionSuccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.bt.multibluetooth.bus; 24 | 25 | /** 26 | * Created by Rami MARTIN on 13/04/2014. 27 | */ 28 | public class ServeurConnectionSuccess { 29 | 30 | public String mClientAdressConnected; 31 | 32 | public ServeurConnectionSuccess(String clientAdressConnected){ 33 | mClientAdressConnected = clientAdressConnected; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/bt/multibluetooth/bus/ServeurConnectionFail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.bt.multibluetooth.bus; 24 | 25 | /** 26 | * Created by Rami MARTIN on 13/04/2014. 27 | */ 28 | public class ServeurConnectionFail { 29 | 30 | public String mClientAdressConnectionFail; 31 | 32 | public ServeurConnectionFail(String clientAdressConnectionFail){ 33 | mClientAdressConnectionFail = clientAdressConnectionFail; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/data/CommandBTC.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.data; 24 | 25 | public class CommandBTC extends CommandBase { 26 | 27 | String mAddress; 28 | 29 | public CommandBTC(String address) { 30 | mAddress = address; 31 | } 32 | 33 | @Override 34 | public String getMessage() { 35 | return COMMAND_START 36 | + COMMAND_BLUETOOTH_CONNECT + COMMAND_SEPARATOR 37 | + mAddress + PARAMETER_SEPARATOR; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/AboutActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger; 24 | 25 | import android.os.Bundle; 26 | import android.support.annotation.Nullable; 27 | import android.support.v7.app.AppCompatActivity; 28 | 29 | /** 30 | * Created by ThiasTux. 31 | */ 32 | 33 | public class AboutActivity extends AppCompatActivity { 34 | 35 | @Override 36 | protected void onCreate(@Nullable Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_about); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/collector/AbstractDataCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.collector; 24 | 25 | 26 | public abstract class AbstractDataCollector { 27 | 28 | protected long mNanosOffset = 0; 29 | protected String mSensorName; 30 | 31 | public String getSensorName() { 32 | return mSensorName; 33 | } 34 | 35 | public abstract void start(); 36 | public abstract void stop(); 37 | public abstract void haltAndRestartLogging(); 38 | 39 | public abstract void updateNanosOffset(long nanosOffset); 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/data/CommandFLE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.data; 24 | 25 | /** 26 | * Created by mathias on 01/02/17. 27 | */ 28 | public class CommandFLE extends CommandBase { 29 | 30 | String flag; 31 | String notes; 32 | 33 | public CommandFLE(String flag, String notes) { 34 | this.flag = flag; 35 | this.notes = notes; 36 | } 37 | 38 | public String getMessage() { 39 | return COMMAND_START 40 | + COMMAND_FLAG_EVENT + COMMAND_SEPARATOR 41 | + flag + PARAMETER_SEPARATOR 42 | + notes + PARAMETER_SEPARATOR; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/StartAtBootReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger; 24 | 25 | 26 | import android.content.BroadcastReceiver; 27 | import android.content.Context; 28 | import android.content.Intent; 29 | 30 | public class StartAtBootReceiver extends BroadcastReceiver { 31 | @Override 32 | public void onReceive(Context context, Intent intent) { 33 | 34 | if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { 35 | Intent myStarterIntent = new Intent(context, DisplayActivity.class); 36 | myStarterIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 37 | context.startActivity(myStarterIntent); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/upload/HttpStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.upload; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * Defines the methods that has to be implemented by an HTTP stack. 29 | * @author gotev (Aleksandar Gotev) 30 | */ 31 | public interface HttpStack { 32 | 33 | /** 34 | * Creates a new connection for a given URL and HTTP Method. 35 | * @param method HTTP Method 36 | * @param url URL to which to connect to 37 | * @return new connection object 38 | * @throws IOException if an error occurs while creating the connection object 39 | */ 40 | HttpConnection createNewConnection(String method, String url) throws IOException; 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_icons_list_item.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 27 | 28 | 33 | 34 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/xml/pref_headers.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 25 |
29 | 30 |
34 | 35 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/db/DataLoggerOpenHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.db; 24 | 25 | import android.content.Context; 26 | import android.database.sqlite.SQLiteDatabase; 27 | import android.database.sqlite.SQLiteOpenHelper; 28 | 29 | public class DataLoggerOpenHelper extends SQLiteOpenHelper { 30 | 31 | private static final String DATABASE_NAME = "datalogger.db"; 32 | private static final int DATABASE_VERSION = 3; 33 | 34 | 35 | public DataLoggerOpenHelper(Context context) { 36 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 37 | } 38 | 39 | // Method is called during creation of the database 40 | @Override 41 | public void onCreate(SQLiteDatabase db) { 42 | 43 | DataCollectionSessionTable.onCreate(db); 44 | LogFileTable.onCreate(db); 45 | } 46 | 47 | // Method is called during an upgrade of the database, 48 | // e.g. if increase of database version 49 | @Override 50 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 51 | DataCollectionSessionTable.onUpgrade(db, oldVersion, newVersion); 52 | LogFileTable.onUpgrade(db, oldVersion, newVersion); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/upload/HurlStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.upload; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * HttpUrlConnection stack implementation. 29 | * @author gotev (Aleksandar Gotev) 30 | */ 31 | public class HurlStack implements HttpStack { 32 | 33 | private boolean mFollowRedirects; 34 | private boolean mUseCaches; 35 | private int mConnectTimeout; 36 | private int mReadTimeout; 37 | 38 | public HurlStack() { 39 | mFollowRedirects = true; 40 | mUseCaches = false; 41 | mConnectTimeout = 15000; 42 | mReadTimeout = 30000; 43 | } 44 | 45 | public HurlStack(boolean followRedirects, 46 | boolean useCaches, 47 | int connectTimeout, 48 | int readTimeout) { 49 | mFollowRedirects = followRedirects; 50 | mUseCaches = useCaches; 51 | mConnectTimeout = connectTimeout; 52 | mReadTimeout = readTimeout; 53 | } 54 | 55 | @Override 56 | public HttpConnection createNewConnection(String method, String url) throws IOException { 57 | return new HurlStackConnection(method, url, mFollowRedirects, mUseCaches, 58 | mConnectTimeout, mReadTimeout); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 31 | 32 | 36 | 37 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/upload/Placeholders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.upload; 24 | 25 | /** 26 | * Contains all the placeholders that is possible to use in the notification text strings. 27 | * @author Aleksandar Gotev 28 | */ 29 | public class Placeholders { 30 | 31 | /** 32 | * Placeholder to display the total elapsed upload time in minutes and seconds. 33 | * E.g.: 34s, 4m 33s, 45m 21s 34 | */ 35 | public static final String ELAPSED_TIME = "[[ELAPSED_TIME]]"; 36 | 37 | /** 38 | * Placeholder to display the average upload rate. E.g.: 6 Mbit/s, 634 Kbit/s, 232 bit/s 39 | */ 40 | public static final String UPLOAD_RATE = "[[UPLOAD_RATE]]"; 41 | 42 | /** 43 | * Placeholder to display the integer progress percent from 0 to 100. E.g.: 75% 44 | */ 45 | public static final String PROGRESS = "[[PROGRESS]]"; 46 | 47 | /** 48 | * Placeholder to display the number of successfully uploaded files. 49 | * Bear in mind that in case of HTTP/Multipart or Binary uploads which does not support 50 | * resume, if the request gets restarted due to an error, the number of uploaded files will 51 | * be reset to zero. 52 | */ 53 | public static final String UPLOADED_FILES = "[[UPLOADED_FILES]]"; 54 | 55 | /** 56 | * Placeholder to display the total number of files to upload. 57 | */ 58 | public static final String TOTAL_FILES = "[[TOTAL_FILES]]"; 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/uk/ac/sussex/wear/android/datalogger/upload/UploadStatusDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. Mathias Ciliberto, Francisco Javier Ordoñez Morales, 3 | * Hristijan Gjoreski, Daniel Roggen 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 9 | * Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | package uk.ac.sussex.wear.android.datalogger.upload; 24 | 25 | /** 26 | * Defines the methods that has to be implemented by a class who wants to listen for upload status 27 | * events. 28 | * 29 | * @author Aleksandar Gotev 30 | */ 31 | public interface UploadStatusDelegate { 32 | /** 33 | * Called when the upload progress changes. Override this method to add your own logic. 34 | * 35 | * @param uploadInfo upload status information 36 | */ 37 | void onProgress(final UploadInfo uploadInfo); 38 | 39 | /** 40 | * Called when an error happens during the upload. Override this method to add your own logic. 41 | * 42 | * @param uploadInfo upload status information 43 | * @param exception exception that caused the error 44 | */ 45 | void onError(final UploadInfo uploadInfo, final Exception exception); 46 | 47 | /** 48 | * Called when the upload is completed successfully. Override this method to add your own logic. 49 | * 50 | * @param uploadInfo upload status information 51 | * @param serverResponse response got from the server 52 | */ 53 | void onCompleted(final UploadInfo uploadInfo, final ServerResponse serverResponse); 54 | 55 | /** 56 | * Called when the upload is cancelled. Override this method to add your own logic. 57 | * 58 | * @param uploadInfo upload status information 59 | */ 60 | void onCancelled(final UploadInfo uploadInfo); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 27 | 28 | 37 | 38 | 39 | 48 | 49 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_show_stats.xml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 29 | 30 | 36 | 37 | 41 | 42 | 48 | 49 | 50 |