Sorted issue with startupActivity showing data recieved when it had not been, and disabled (non-functioning) ip camera settings.

This commit is contained in:
Graham Jones
2016-03-30 20:15:20 +01:00
parent 06f6f8262c
commit 8944cbc6d3
6 changed files with 99 additions and 89 deletions

View File

@@ -28,9 +28,11 @@ import android.os.Parcelable;
import android.os.Parcel;
import android.text.format.Time;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import org.json.JSONObject;
import org.json.JSONArray;
@@ -40,6 +42,7 @@ public class SdData implements Parcelable {
private final static String TAG = "SdData";
/* Analysis settings */
public boolean haveSettings = false; // flag to say if we have received settings or not.
public boolean haveData = false; // flag to say we have received data.
public long alarmFreqMin;
public long alarmFreqMax;
public long nMin;
@@ -51,7 +54,7 @@ public class SdData implements Parcelable {
public long batteryPc;
/* Analysis results */
public Time dataTime;
public Time dataTime = null;
public long alarmState;
public boolean alarmStanding = false;
public boolean fallAlarmStanding = false;
@@ -101,13 +104,13 @@ public class SdData implements Parcelable {
for (int i = 0; i < specArr.length(); i++) {
simpleSpec[i] = specArr.optInt(i);
}
haveData = true;
return true;
} catch (Exception e) {
Log.v(TAG, "fromJSON() - error parsing result");
haveData = false;
return false;
}
}
@@ -174,6 +177,7 @@ public class SdData implements Parcelable {
public SdData createFromParcel(Parcel in) {
return new SdData(in);
}
public SdData[] newArray(int size) {
return new SdData[size];
}

View File

@@ -338,6 +338,7 @@ public class SdDataSourcePebble extends SdDataSource {
mSdData.specPower = data.getUnsignedIntegerAsLong(KEY_SPECPOWER);
mSdData.roiPower = data.getUnsignedIntegerAsLong(KEY_ROIPOWER);
mSdData.alarmPhrase = "Unknown";
mSdData.haveData = true;
mSdDataReceiver.onSdDataReceived(mSdData);
}
@@ -465,6 +466,7 @@ public class SdDataSourcePebble extends SdDataSource {
mSdData.pebbleAppRunning = false;
Log.v(TAG, "getPebbleStatus() - Pebble App Not Running - Attempting to Re-Start");
startWatchApp();
mPebbleStatusTime = tnow; // set status time to now so we do not re-start app repeatedly.
getPebbleSdSettings();
// Only make audible warning beep if we have not received data for more than mFaultTimerPeriod seconds.
if (tdiff > (mDataPeriod+mFaultTimerPeriod) * 1000) {

View File

@@ -95,7 +95,7 @@ public class SdServer extends Service implements SdDataReceiver {
private HandlerThread thread;
private WakeLock mWakeLock = null;
public SdDataSource mSdDataSource;
public SdData mSdData;
public SdData mSdData = null;
public String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
private boolean mLatchAlarms = false;
private boolean mCancelAudible = false;

View File

@@ -73,7 +73,7 @@ public class SdServiceConnection implements ServiceConnection {
public boolean hasSdData() {
if (mSdServer!=null) {
if (mSdServer.mSdData!=null) {
return true;
return mSdServer.mSdData.haveData;
}
}
return false;

View File

@@ -31,7 +31,9 @@
android:defaultValue="true"
android:key="UseIpCamera"
android:summary="Use IP Camera to View Images"
android:title="Enable IP Camera" />
android:title="Enable IP Camera"
android:enabled="False"
/>
</PreferenceScreen>

View File

@@ -25,7 +25,9 @@
<header android:fragment="uk.org.openseizuredetector.PrefActivity$CameraPrefsFragment"
android:icon="@drawable/icon_24x24"
android:title="Camera Settings"
android:summary="IP Camera Preferences" />
android:summary="IP Camera Preferences"
android:enabled="false"
/>
</preference-headers>