Sorted issue with startupActivity showing data recieved when it had not been, and disabled (non-functioning) ip camera settings.
This commit is contained in:
@@ -28,9 +28,11 @@ import android.os.Parcelable;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.text.format.Time;
|
import android.text.format.Time;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
||||||
@@ -40,6 +42,7 @@ public class SdData implements Parcelable {
|
|||||||
private final static String TAG = "SdData";
|
private final static String TAG = "SdData";
|
||||||
/* Analysis settings */
|
/* Analysis settings */
|
||||||
public boolean haveSettings = false; // flag to say if we have received settings or not.
|
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 alarmFreqMin;
|
||||||
public long alarmFreqMax;
|
public long alarmFreqMax;
|
||||||
public long nMin;
|
public long nMin;
|
||||||
@@ -51,7 +54,7 @@ public class SdData implements Parcelable {
|
|||||||
public long batteryPc;
|
public long batteryPc;
|
||||||
|
|
||||||
/* Analysis results */
|
/* Analysis results */
|
||||||
public Time dataTime;
|
public Time dataTime = null;
|
||||||
public long alarmState;
|
public long alarmState;
|
||||||
public boolean alarmStanding = false;
|
public boolean alarmStanding = false;
|
||||||
public boolean fallAlarmStanding = false;
|
public boolean fallAlarmStanding = false;
|
||||||
@@ -101,13 +104,13 @@ public class SdData implements Parcelable {
|
|||||||
for (int i = 0; i < specArr.length(); i++) {
|
for (int i = 0; i < specArr.length(); i++) {
|
||||||
simpleSpec[i] = specArr.optInt(i);
|
simpleSpec[i] = specArr.optInt(i);
|
||||||
}
|
}
|
||||||
|
haveData = true;
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "fromJSON() - error parsing result");
|
Log.v(TAG, "fromJSON() - error parsing result");
|
||||||
|
haveData = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -174,6 +177,7 @@ public class SdData implements Parcelable {
|
|||||||
public SdData createFromParcel(Parcel in) {
|
public SdData createFromParcel(Parcel in) {
|
||||||
return new SdData(in);
|
return new SdData(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SdData[] newArray(int size) {
|
public SdData[] newArray(int size) {
|
||||||
return new SdData[size];
|
return new SdData[size];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ public class SdDataSourcePebble extends SdDataSource {
|
|||||||
mSdData.specPower = data.getUnsignedIntegerAsLong(KEY_SPECPOWER);
|
mSdData.specPower = data.getUnsignedIntegerAsLong(KEY_SPECPOWER);
|
||||||
mSdData.roiPower = data.getUnsignedIntegerAsLong(KEY_ROIPOWER);
|
mSdData.roiPower = data.getUnsignedIntegerAsLong(KEY_ROIPOWER);
|
||||||
mSdData.alarmPhrase = "Unknown";
|
mSdData.alarmPhrase = "Unknown";
|
||||||
|
mSdData.haveData = true;
|
||||||
mSdDataReceiver.onSdDataReceived(mSdData);
|
mSdDataReceiver.onSdDataReceived(mSdData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,6 +466,7 @@ public class SdDataSourcePebble extends SdDataSource {
|
|||||||
mSdData.pebbleAppRunning = false;
|
mSdData.pebbleAppRunning = false;
|
||||||
Log.v(TAG, "getPebbleStatus() - Pebble App Not Running - Attempting to Re-Start");
|
Log.v(TAG, "getPebbleStatus() - Pebble App Not Running - Attempting to Re-Start");
|
||||||
startWatchApp();
|
startWatchApp();
|
||||||
|
mPebbleStatusTime = tnow; // set status time to now so we do not re-start app repeatedly.
|
||||||
getPebbleSdSettings();
|
getPebbleSdSettings();
|
||||||
// Only make audible warning beep if we have not received data for more than mFaultTimerPeriod seconds.
|
// Only make audible warning beep if we have not received data for more than mFaultTimerPeriod seconds.
|
||||||
if (tdiff > (mDataPeriod+mFaultTimerPeriod) * 1000) {
|
if (tdiff > (mDataPeriod+mFaultTimerPeriod) * 1000) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
private HandlerThread thread;
|
private HandlerThread thread;
|
||||||
private WakeLock mWakeLock = null;
|
private WakeLock mWakeLock = null;
|
||||||
public SdDataSource mSdDataSource;
|
public SdDataSource mSdDataSource;
|
||||||
public SdData mSdData;
|
public SdData mSdData = null;
|
||||||
public String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
|
public String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
|
||||||
private boolean mLatchAlarms = false;
|
private boolean mLatchAlarms = false;
|
||||||
private boolean mCancelAudible = false;
|
private boolean mCancelAudible = false;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class SdServiceConnection implements ServiceConnection {
|
|||||||
public boolean hasSdData() {
|
public boolean hasSdData() {
|
||||||
if (mSdServer!=null) {
|
if (mSdServer!=null) {
|
||||||
if (mSdServer.mSdData!=null) {
|
if (mSdServer.mSdData!=null) {
|
||||||
return true;
|
return mSdServer.mSdData.haveData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -31,7 +31,9 @@
|
|||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="UseIpCamera"
|
android:key="UseIpCamera"
|
||||||
android:summary="Use IP Camera to View Images"
|
android:summary="Use IP Camera to View Images"
|
||||||
android:title="Enable IP Camera" />
|
android:title="Enable IP Camera"
|
||||||
|
android:enabled="False"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
<header android:fragment="uk.org.openseizuredetector.PrefActivity$CameraPrefsFragment"
|
<header android:fragment="uk.org.openseizuredetector.PrefActivity$CameraPrefsFragment"
|
||||||
android:icon="@drawable/icon_24x24"
|
android:icon="@drawable/icon_24x24"
|
||||||
android:title="Camera Settings"
|
android:title="Camera Settings"
|
||||||
android:summary="IP Camera Preferences" />
|
android:summary="IP Camera Preferences"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</preference-headers>
|
</preference-headers>
|
||||||
Reference in New Issue
Block a user