Put the fault detection functions (getStatus and faultCheck) in try...catch blocks. Fixes #135

Should reduce the chances of a silent crash
They should give a fault 'pip' instead of crashing.
Not easy to test though becasue crashes are so rare...
Use git diff -w to show the real changes, otherwise this looks like a huge change.
This commit is contained in:
Graham Jones
2024-01-27 21:14:48 +00:00
parent 4c164894a7
commit b2a5fef2ff

View File

@@ -799,6 +799,7 @@ public abstract class SdDataSource {
* and sets class variables for use by other functions.
*/
public void getStatus() {
try {
Time tnow = new Time(Time.getCurrentTimezone());
long tdiff;
tnow.setToNow();
@@ -859,12 +860,21 @@ public abstract class SdDataSource {
if (!mSdData.haveSettings) {
Log.v(TAG, "getStatus() - no settings received yet");
}
} catch(Exception e) {
Log.e(TAG,"getStatus - Exception: "+e.toString());
Log.e(TAG,e.getMessage());
mSdData.watchAppRunning = false;
mSdData.roiPower = -1;
mSdData.specPower = -1;
mSdDataReceiver.onSdDataFault(mSdData);
}
}
/**
* faultCheck - determines alarm state based on seizure detector data SdData. Called every second.
*/
private void faultCheck() {
try {
Time tnow = new Time(Time.getCurrentTimezone());
long tdiff;
tnow.setToNow();
@@ -893,6 +903,15 @@ public abstract class SdDataSource {
}
}
}
} catch(Exception e) {
Log.e(TAG,"faultCheck - Exception: "+e.toString());
Log.e(TAG,e.getMessage());
mSdData.watchAppRunning = false;
mSdData.roiPower = -1;
mSdData.specPower = -1;
mSdDataReceiver.onSdDataFault(mSdData);
}
}
void nnAnalysis() {