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