Added the facility to accept an alarm from the web interface ("/acceptalarm" url), and added button to web interface page.
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
</div>
|
||||
<div id="settingsDiv">
|
||||
<h2>Seizure Detector Settings</h2>
|
||||
<button id="acceptButton">Accept Alarm</button>
|
||||
<button id="muteButton">Mute Alarm</button>
|
||||
<div id="sdSettings">
|
||||
SD Settings
|
||||
|
||||
@@ -162,7 +162,11 @@ toggleMute = function() {
|
||||
sd_muted = 1;
|
||||
$("#muteButton").text("Un-mute Audible Alarm");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
acceptAlarm = function() {
|
||||
$.ajax({url:"/acceptalarm"});
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
sd_muted = 0;
|
||||
@@ -173,4 +177,5 @@ $(document).ready(function() {
|
||||
setInterval("get_settings();",10000);
|
||||
setInterval("get_spectrum();",5000);
|
||||
$("#muteButton").click(toggleMute);
|
||||
$("#acceptButton").click(acceptAlarm);
|
||||
});
|
||||
|
||||
@@ -755,7 +755,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
Log.v(TAG, "startWebServer()");
|
||||
mUtil.writeToSysLogFile("SdServer.Start Web Server.");
|
||||
if (webServer == null) {
|
||||
webServer = new SdWebServer(getApplicationContext(), mUtil.getDataStorageDir(), mSdData);
|
||||
webServer = new SdWebServer(getApplicationContext(), mUtil.getDataStorageDir(), mSdData, this);
|
||||
try {
|
||||
webServer.start();
|
||||
} catch (IOException ioe) {
|
||||
|
||||
@@ -25,14 +25,16 @@ import fi.iki.elonen.NanoHTTPD;
|
||||
public class SdWebServer extends NanoHTTPD {
|
||||
private String TAG = "WebServer";
|
||||
private SdData mSdData;
|
||||
private SdServer mSdServer;
|
||||
private Context mContext;
|
||||
private File mDataStorageDir = null;
|
||||
|
||||
public SdWebServer(Context context, File storageDir, SdData sdData) {
|
||||
public SdWebServer(Context context, File storageDir, SdData sdData, SdServer sdServer) {
|
||||
// Set the port to listen on (8080)
|
||||
super(8080);
|
||||
mSdData = sdData;
|
||||
mContext = context;
|
||||
mSdServer = sdServer;
|
||||
mDataStorageDir = storageDir;
|
||||
}
|
||||
|
||||
@@ -110,6 +112,12 @@ public class SdWebServer extends NanoHTTPD {
|
||||
}
|
||||
break;
|
||||
|
||||
case "/acceptalarm":
|
||||
Log.v(TAG, "WebServer.serve() - Accepting alarm");
|
||||
mSdServer.acceptAlarm();
|
||||
answer = "Alarm Accepted";
|
||||
break;
|
||||
|
||||
default:
|
||||
if (uri.startsWith("/index.html") ||
|
||||
uri.startsWith("/logfiles.html") ||
|
||||
|
||||
Reference in New Issue
Block a user