diff --git a/app/app-release-2.5.1.apk b/app/app-release-2.5.1.apk new file mode 100644 index 0000000..ba4298e Binary files /dev/null and b/app/app-release-2.5.1.apk differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0996df5..8143b75 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="35" + android:versionName="2.5.1"> diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSource.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSource.java index 2fc65b2..42312fa 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSource.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSource.java @@ -85,6 +85,8 @@ public abstract class SdDataSource { public void startPebbleApp() { Log.v(TAG,"startPebbleApp()"); } + public void acceptAlarm() { Log.v(TAG,"acceptAlarm()"); } + /** * Display a Toast message on screen. * @param msg - message to display. diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceNetwork.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceNetwork.java index 23b2ca0..98badba 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceNetwork.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceNetwork.java @@ -155,6 +155,42 @@ public class SdDataSourceNetwork extends SdDataSource { } } + /** + * Retrive the current Seizure Detector Data from the server. + * Uses the DownloadSdDataTask class to download the data in the + * background. The data is processed in DownloadSdDataTask.onPostExecute(). + */ + @Override + public void acceptAlarm() { + Log.v(TAG, "acceptAlarm()"); + new AcceptAlarmTask().execute("http://" + mServerIP + ":8080/acceptalarm"); + } + + private class AcceptAlarmTask extends AsyncTask { + @Override + protected String doInBackground(String... urls) { + // params comes from the execute() call: params[0] is the url. + try { + String result = downloadUrl(urls[0]); + if (result.startsWith("Unable to retrieve web page")) { + Log.v(TAG,"doInBackground() - Error accepting alarm"); + } else { + Log.v(TAG,"doInBackground(): Alarm Accepted"); + } + } catch (IOException e) { + Log.v(TAG,"doInBackground(): IOException - "+e.toString()); + } + return "Done"; + } + // onPostExecute displays the results of the AsyncTask. + @Override + protected void onPostExecute(String s) { + Log.v(TAG,"onPostExecute() - s="+s); + } + } + + + // Given a URL, establishes an HttpUrlConnection and retrieves // the web page content as a InputStream, which it returns as // a string. diff --git a/app/src/main/java/uk/org/openseizuredetector/SdServer.java b/app/src/main/java/uk/org/openseizuredetector/SdServer.java index 8cca4a5..b3f5933 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdServer.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdServer.java @@ -713,6 +713,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei Log.v(TAG, "acceptAlarm()"); mSdData.alarmStanding = false; mSdData.fallAlarmStanding = false; + mSdDataSource.acceptAlarm(); stopLatchTimer(); } diff --git a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java index 9d29b0d..7272800 100644 --- a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java @@ -461,10 +461,11 @@ public class StartupActivity extends Activity { + "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. " + "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk " + "\n\nChanges in this version:" - + "\n- Update to Detection Algorithm: You will need to increase the AlarmRatioThresh setting from the previous " - + "default of around 30 to a value of 50-60 to avoid excessive false alarms" - + "\n- Added GPS Location to SMS Alarms" - + "\n- Added auto-start on boot capability" + + "\n- Added an alarm latch automatic reset timer. This means that if you enable 'Latch Alarms'" + + "\n in the alarms settings then an alarm will stay active for a period set by the Latch Alarm" + + "\n Time Duration setting before it re-sets, even if the watch only detects an alarm condition" + + "\n for a short period. This is to make sure a carer is alerted to even a short duration alarm" + + "\n condition. The alarm can be reset manually by pressing the 'Accept Alarm' button." ); // This makes the links display as links, but they do not respond to clicks for some reason... Linkify.addLinks(s, Linkify.ALL);