diff --git a/CHANGELOG.md b/CHANGELOG.md index 97fc68d..4ccfbf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ OpenSeizureDetector Android App - Change Log ============================================ + V3.1.0 - 07apr2019 + - Added fall detection algorithm to Garmin/Fitbit data source. + + V3.0.4 - Fixed issues with install watch app, and stopping server resulting in crashes + + V3.0.3- Fixed problem with crash on phone boot if Auto Start on Boot option selected + V3.0.2 - 27feb2019 - Corrected issue with app not re-starting properly when run-time permissions changed (e.g. send_sms permission) diff --git a/app/release/app-release-3.1.0.apk b/app/release/app-release-3.1.0.apk new file mode 100644 index 0000000..6e79d67 Binary files /dev/null and b/app/release/app-release-3.1.0.apk differ diff --git a/app/release/output.json b/app/release/output.json index 249dfaf..25d4d21 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":53,"versionName":"3.0.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":54,"versionName":"3.1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4e191d3..aeed2ae 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceGarmin.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceGarmin.java index 7d43df6..3e628f7 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceGarmin.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceGarmin.java @@ -482,6 +482,8 @@ public class SdDataSourceGarmin extends SdDataSource { simpleSpec[ifreq] = simpleSpec[ifreq] / (binMax-binMin); } + checkFall(); + // Populate the mSdData structure to communicate with the main SdServer service. mDataStatusTime.setToNow(); mSdData.specPower = (long)specPower / ACCEL_SCALE_FACTOR; @@ -507,6 +509,44 @@ public class SdDataSourceGarmin extends SdDataSource { } + /**************************************************************** + * Simple threshold analysis to chech for fall. + * Called from clock_tick_handler() + */ + public void checkFall() { + int i,j; + double minAcc, maxAcc; + + long fallWindowSamp = (mFallWindow*mSdData.mSampleFreq)/1000; // Convert ms to samples. + Log.v(TAG, "check_fall() - fallWindowSamp=" +fallWindowSamp); + // Move window through sample buffer, checking for fall. + mSdData.fallAlarmStanding = false; + if (mFallActive) { + for (i = 0; i < mSdData.mNsamp - fallWindowSamp; i++) { // i = window start point + // Find max and min acceleration within window. + minAcc = mSdData.rawData[i]; + maxAcc = mSdData.rawData[i]; + for (j = 0; j < fallWindowSamp; j++) { // j = position within window + if (mSdData.rawData[i + j] < minAcc) minAcc = mSdData.rawData[i + j]; + if (mSdData.rawData[i + j] > maxAcc) maxAcc = mSdData.rawData[i + j]; + } + if ((minAcc < mFallThreshMin) && (maxAcc > mFallThreshMax)) { + Log.d(TAG, "check_fall() - minAcc=" + minAcc + ", maxAcc=" + maxAcc); + Log.d(TAG, "check_fall() - ****FALL DETECTED****"); + mSdData.fallAlarmStanding = true; + return; + } + } + } else { + Log.v(TAG,"check_fall - mFallActive is false - doing nothing"); + } + //if (debug) APP_LOG(APP_LOG_LEVEL_DEBUG,"check_fall() - minAcc=%d, maxAcc=%d", + // minAcc,maxAcc); + + } + + + /** * Checks the status of the connection to the watch, * and sets class variables for use by other functions. diff --git a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java index dd6d3e6..36aec74 100644 --- a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java @@ -501,12 +501,7 @@ public class StartupActivity extends Activity { + "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. " + "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk " + "\n\nChanges in this version:" - + "\n- V3.0.4 - Fixed issues with install watch app, and stopping server resulting in crashes" - + "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected" - + "\n- Upgraded to be compatible with Android Version 9" - + "\n- Added support a Garmin based seizure detector with Heart Rate alarm " - + "\n Fixed problem with app not restarting properly when settings were changed" - + "\n- Explicitly asks for SMS permission, and displays warning in notification if SMS alarms are active" + + "\n- V3.1.0 - Added fall detection algorithm into Garmin/Fitbit Data Source " + "\n ." ); // This makes the links display as links, but they do not respond to clicks for some reason... @@ -537,13 +532,7 @@ public class StartupActivity extends Activity { + "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. " + "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk " + "\n\nChanges in this version:" - + "\n- V3.0.4 - Fixed issues with install watch app, and stopping server resulting in crashes" - + "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected" - + "\n- Upgraded to be compatible with Android Version 9" - + "\n- Added support for a Garmin based seizure detector with Heart Rate alarm " - + "\n- Fixed problem with app not restarting properly when settings were changed" - + "\n- Explicitly asks for SMS permission, and displays warning in notification if SMS alarms are active" - + "\n " + + "\n- V3.1.0 - Added fall detection algorithm into Garmin/Fitbit Data Source " + "\n " + "\n " ); diff --git a/app/src/main/res/xml/pebble_datasource_prefs.xml b/app/src/main/res/xml/pebble_datasource_prefs.xml index df5dbe7..2af8ebc 100644 --- a/app/src/main/res/xml/pebble_datasource_prefs.xml +++ b/app/src/main/res/xml/pebble_datasource_prefs.xml @@ -48,29 +48,6 @@ /> - - - - - - - + + + + + + +