From: Jeremy Tan Date: Mon, 2 Sep 2013 05:18:21 +0000 (+0800) Subject: Merge branch 'master' of https://github.com/szmoore/MCTX3420.git X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=82550459439f4083243d9126a6e3be6325d9102d;hp=db50df50f4711142dba8f7aa83751fccc52b1e0d;p=matches%2FMCTX3420.git Merge branch 'master' of https://github.com/szmoore/MCTX3420.git --- diff --git a/server/run.sh b/server/run.sh index 7b3d24a..a776cbd 100755 --- a/server/run.sh +++ b/server/run.sh @@ -2,5 +2,5 @@ # Use this to quickly test run the server in valgrind #spawn-fcgi -p9005 -n ./valgrind.sh # Use this to run the server normally -spawn-fcgi -p9005 -n ./server & -./stream +./stream & +spawn-fcgi -p9005 -n ./server diff --git a/web/gui.js b/web/gui.js index 911325b..da4e0d0 100644 --- a/web/gui.js +++ b/web/gui.js @@ -10,6 +10,7 @@ $(document).ready(function() g_sensors = [] g_numSensors = 2 g_storeTime = [] + g_key = null $.fn.pruneSensorData = function(id) { @@ -78,10 +79,19 @@ $(document).ready(function() $.plot("#sensor"+String(id)+"_plot", [g_sensors[id]]) } + $.fn.setPressure = function() + { + var value = Number($("#control0_value").val()) + $.ajax({url : "/api/control", data : {action : "set", value : String(value), id : 0, key : g_key}, success : function(json) {alert(json.description)}}) + } + $.fn.LoadGUI = function() { //TODO: Get rid of g_numSensors; query the server for sensors? + $.ajax({url : "/api/control", data : {action : "start", force : "true"}, success : function(json) {g_key = String(json.key)}, async : false}) + console.log("Key is " + g_key) + // Load the plots plotsHTML = "" for (var i = 0; i < g_numSensors; ++i) @@ -101,6 +111,12 @@ $(document).ready(function() } $("#plots").html(plotsHTML) + controlHTML = "

Controls

\n" + controlHTML += "

Pressure: " + controlHTML += "

" + + $("#controls").html(controlHTML) + } @@ -111,7 +127,7 @@ $(document).ready(function() for (var i = 0; i < g_numSensors; ++i) { - $.ajax({url : "/api/sensors", data : {id : i}, success : function(data) {$(this).updateSensor(data);}}) + // $.ajax({url : "/api/sensors", data : {id : i}, success : function(data) {$(this).updateSensor(data);}}) } });