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:
@@ -799,6 +799,7 @@ public abstract class SdDataSource {
|
|||||||
* and sets class variables for use by other functions.
|
* and sets class variables for use by other functions.
|
||||||
*/
|
*/
|
||||||
public void getStatus() {
|
public void getStatus() {
|
||||||
|
try {
|
||||||
Time tnow = new Time(Time.getCurrentTimezone());
|
Time tnow = new Time(Time.getCurrentTimezone());
|
||||||
long tdiff;
|
long tdiff;
|
||||||
tnow.setToNow();
|
tnow.setToNow();
|
||||||
@@ -859,12 +860,21 @@ public abstract class SdDataSource {
|
|||||||
if (!mSdData.haveSettings) {
|
if (!mSdData.haveSettings) {
|
||||||
Log.v(TAG, "getStatus() - no settings received yet");
|
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.
|
* faultCheck - determines alarm state based on seizure detector data SdData. Called every second.
|
||||||
*/
|
*/
|
||||||
private void faultCheck() {
|
private void faultCheck() {
|
||||||
|
try {
|
||||||
Time tnow = new Time(Time.getCurrentTimezone());
|
Time tnow = new Time(Time.getCurrentTimezone());
|
||||||
long tdiff;
|
long tdiff;
|
||||||
tnow.setToNow();
|
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() {
|
void nnAnalysis() {
|
||||||
|
|||||||
Reference in New Issue
Block a user