V3.1.0 - Added simple fall detection algorithm to Garmin/Pebble data source

This commit is contained in:
Graham Jones
2019-04-07 20:48:40 +01:00
parent 33a11f0e73
commit b29d346c9d
8 changed files with 75 additions and 39 deletions

Binary file not shown.

View File

@@ -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":{}}]
[{"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":{}}]

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="uk.org.openseizuredetector"
android:versionCode="53"
android:versionName="3.0.4"
android:versionCode="54"
android:versionName="3.1.0"
>
<!--android:allowBackup="false"-->

View File

@@ -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.

View File

@@ -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 "
);

View File

@@ -48,29 +48,6 @@
/>
</PreferenceCategory>
<PreferenceCategory android:title="Fall Detector Settings">
<CheckBoxPreference
android:defaultValue="false"
android:key="FallActive"
android:summary=""
android:title="Activate Fall Detection Function" />
<EditTextPreference
android:defaultValue="200"
android:key="FallThreshMin"
android:summary=""
android:title="Fall Detection Lower Threshold (milli-g)" />
<EditTextPreference
android:defaultValue="1200"
android:key="FallThreshMax"
android:summary=""
android:title="Fall Detection Upper Threshold (milli-g)" />
<EditTextPreference
android:defaultValue="1500"
android:key="FallWindow"
android:summary=""
android:title="Fall Detection Window (milli-seconds)" />
</PreferenceCategory>
<PreferenceCategory
android:title="Watch Communications Settings">
<ListPreference

View File

@@ -60,6 +60,29 @@
android:title="Heart Rate Max Threshold (bpm)" />
</PreferenceCategory>
<PreferenceCategory android:title="Fall Detector Settings">
<CheckBoxPreference
android:defaultValue="false"
android:key="FallActive"
android:summary=""
android:title="Activate Fall Detection Function" />
<EditTextPreference
android:defaultValue="200"
android:key="FallThreshMin"
android:summary=""
android:title="Fall Detection Lower Threshold (milli-g)" />
<EditTextPreference
android:defaultValue="1200"
android:key="FallThreshMax"
android:summary=""
android:title="Fall Detection Upper Threshold (milli-g)" />
<EditTextPreference
android:defaultValue="1500"
android:key="FallWindow"
android:summary=""
android:title="Fall Detection Window (milli-seconds)" />
</PreferenceCategory>
</PreferenceScreen>