diff --git a/.gitignore b/.gitignore index fb0b4c0..128a207 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build .gradle .idea app/build +app/app.iml diff --git a/app/app-release-2.0.1.apk b/app/app-release-2.0.1.apk new file mode 100644 index 0000000..5a617df Binary files /dev/null and b/app/app-release-2.0.1.apk differ diff --git a/app/app.iml b/app/app.iml deleted file mode 100644 index 8abf01f..0000000 --- a/app/app.iml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b6b7ff7..95e7e5c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="20" + android:versionName="2.0.1" > diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePebble.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePebble.java index c07dd82..ee498ce 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePebble.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourcePebble.java @@ -115,7 +115,8 @@ public class SdDataSourcePebble extends SdDataSource { startPebbleServer(); // Start timer to check status of pebble regularly. mPebbleStatusTime = new Time(Time.getCurrentTimezone()); - //getPebbleStatus(); + // use a timer to check the status of the pebble app on the same frequency + // as we get app data. if (mStatusTimer == null) { Log.v(TAG, "onCreate(): starting status timer"); mStatusTimer = new Timer(); @@ -124,7 +125,7 @@ public class SdDataSourcePebble extends SdDataSource { public void run() { getPebbleStatus(); } - }, 0, 1000); + }, 0, mDataPeriod * 1000); } else { Log.v(TAG, "onCreate(): status timer already running."); } @@ -322,6 +323,7 @@ public class SdDataSourcePebble extends SdDataSource { Log.v(TAG, "Received message from Pebble - data type=" + data.getUnsignedIntegerAsLong(KEY_DATA_TYPE)); // If we ha ve a message, the app must be running + Log.v(TAG,"Setting mPebbleAppRunningCheck to true"); mPebbleAppRunningCheck = true; PebbleKit.sendAckToPebble(context, transactionId); //Log.v(TAG,"Message is: "+data.toJsonString()); @@ -448,14 +450,15 @@ public class SdDataSourcePebble extends SdDataSource { * If the watch app is not running, it attempts to re-start it. */ public void getPebbleStatus() { - Log.v(TAG, "getPebbleStatus()"); Time tnow = new Time(Time.getCurrentTimezone()); long tdiff; tnow.setToNow(); // get time since the last data was received from the Pebble watch. tdiff = (tnow.toMillis(false) - mPebbleStatusTime.toMillis(false)); + Log.v(TAG, "getPebbleStatus() - mPebbleAppRunningCheck="+mPebbleAppRunningCheck+" tdiff="+tdiff); // Check we are actually connected to the pebble. mSdData.pebbleConnected = PebbleKit.isWatchConnected(mContext); + if (!mSdData.pebbleConnected) mPebbleAppRunningCheck = false; // And is the pebble_sd app running? // set mPebbleAppRunningCheck has been false for more than 10 seconds // the app is not talking to us @@ -466,7 +469,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. + //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) {