Skip to content

Commit a106f59

Browse files
authored
Merge pull request #151 from OpenSeizureDetector/V4.2.x_latch
V4.2.x latch
2 parents 0ef4ced + 4a910dc commit a106f59

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
OpenSeizureDetector Android App - Change Log
22
============================================
3+
V4.2.3b - fixed latched alarms (Issue #146)
34
V4.2.2 - Added support for PineTime OSD Status reporting.
45
V4.2.1 - Added support for PineTime wathes using the Bluetooth Data Source
56
V4.1.0 - Added experimental support for neural network based seizure detector.

app/release/app-release-4.2.3b.apk

14.4 MB
Binary file not shown.

app/src/main/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
android:versionCode="136"
5-
android:versionName="4.2.2">
4+
android:versionCode="137"
5+
android:versionName="4.2.3b">
66
<!-- android:allowBackup="false" -->
77
<uses-permission android:name="android.permission.BLUETOOTH" />
88
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

app/src/main/java/uk/org/openseizuredetector/SdServer.java

+12-8
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public void onSdDataReceived(SdData sdData) {
675675
mUtil.showToast(getString(R.string.SMSAlarmDisabledNotSendingMsg));
676676
Log.v(TAG, "mSMSAlarm is false - not sending");
677677
}
678-
678+
Log.v(TAG,"calling startLatchTimer()");
679679
startLatchTimer();
680680
}
681681
// Handle fall alarm
@@ -782,7 +782,6 @@ public void onSdDataReceived(SdData sdData) {
782782
}
783783
}
784784

785-
786785
// Fault
787786
if ((sdData.alarmState) == 4 || (sdData.alarmState == 7) || (sdData.mHRFaultStanding) || (sdData.mHrFrozenFaultStanding)) {
788787
sdData.alarmPhrase = "FAULT";
@@ -1007,15 +1006,20 @@ public void stopSmsTimer() {
10071006
private void startLatchTimer() {
10081007
if (mLatchAlarms) {
10091008
if (mLatchAlarmTimer != null) {
1010-
Log.v(TAG, "startLatchTimer -timer already running - cancelling it");
1009+
Log.i(TAG, "startLatchTimer -timer already running - cancelling it");
10111010
mLatchAlarmTimer.cancel();
10121011
mLatchAlarmTimer = null;
10131012
}
1014-
Log.v(TAG, "startLatchTimer() - starting alarm latch release timer to time out in " + mLatchAlarmPeriod + " sec");
1013+
Log.i(TAG, "startLatchTimer() - starting alarm latch release timer to time out in " + mLatchAlarmPeriod + " sec");
10151014
// set timer to timeout after mLatchAlarmPeriod, and Tick() function to be called every second.
1016-
mLatchAlarmTimer =
1017-
new LatchAlarmTimer(mLatchAlarmPeriod * 1000, 1000);
1018-
mLatchAlarmTimer.start();
1015+
// We need to start the timer on the UI thread to get it to work for some reason - I don't know why!
1016+
runOnUiThread(new Runnable() {
1017+
public void run() {
1018+
mLatchAlarmTimer =
1019+
new LatchAlarmTimer(mLatchAlarmPeriod * 1000, 1000);
1020+
mLatchAlarmTimer.start();
1021+
}
1022+
});
10191023
} else {
10201024
Log.v(TAG, "startLatchTimer() - Latch Alarms disabled - not doing anything");
10211025
}
@@ -1457,7 +1461,7 @@ public LatchAlarmTimer(long startTime, long interval) {
14571461
// called after startTime ms.
14581462
@Override
14591463
public void onFinish() {
1460-
Log.v(TAG, "LatchAlarmTimer.onFinish()");
1464+
Log.i(TAG, "LatchAlarmTimer.onFinish()");
14611465
// Do the equivalent of accept alarm push button.
14621466
acceptAlarm();
14631467
}

0 commit comments

Comments
 (0)