diff --git a/css/style.css b/css/style.css index 3a482c8..1e27acd 100644 --- a/css/style.css +++ b/css/style.css @@ -215,7 +215,7 @@ button#refresh-beer-chart span.ui-icon{ clear:left; font-size: 16px; font-weight: normal; - font-style: normal; + font-style: normal; font-family: '5x8LCDHD44780UA02Regular'; color: #FFFF00; white-space: pre; @@ -226,6 +226,30 @@ button#refresh-beer-chart span.ui-icon{ padding-right: 1px; } +#maintenance-panel ul.ui-tabs-nav li{ + margin: 2px; + width: 180px; + text-align: center; +} + +#maintenance-panel ul.ui-tabs-nav li a{ + width: inherit; + padding-left: 0; +} + +#maintenance-panel ul.ui-tabs-nav li:nth-child(6n) { + clear: left; +} + +.console-box{ + width: inherit; + height: 200px; + margin: 10px 40px; + border: solid 1px; + padding: 10px; +} + + #maintenance-panel #beer-selector{ margin-bottom: 20px; } @@ -469,4 +493,4 @@ button#refresh-beer-chart span.ui-icon{ margin-top: 20px; margin-bottom: 20px; width: inherit; -} \ No newline at end of file +} diff --git a/js/main.js b/js/main.js index f027719..0e11622 100644 --- a/js/main.js +++ b/js/main.js @@ -221,3 +221,4 @@ $(document).ready(function(){ receiveControlVariables(); checkScriptStatus(); //will call refreshLcd and alternate between the two }); + diff --git a/js/maintenance-panel.js b/js/maintenance-panel.js index 7c72640..e56ea9b 100644 --- a/js/maintenance-panel.js +++ b/js/maintenance-panel.js @@ -93,4 +93,66 @@ $(document).ready(function(){ $(".cv.update-from-arduino").button({ icons: {primary: "ui-icon-refresh" } }) .click(reloadControlVariablesFromArduino); -}); \ No newline at end of file + + initDeviceConfiguration(); +}); + +function initDeviceConfiguration(){ + "use strict"; + $(".refresh-device-list").button({icons: {primary: "ui-icon-refresh" } }) + .click(refreshDeviceList); + $(".get-device-list").button({icons: {primary: "ui-icon-arrowthickstop-1-s" } }) + .click(getDeviceList); +} + +function getDeviceList(){ + "use strict"; + $.post('socketmessage.php', {messageType: "getDeviceList", message: ""}, function(response){ + try + { + response = response.replace(/\s/g, ''); //strip all whitespace, including newline. + var deviceList = JSON.parse(response); + $("#device-console span").html(parseDeviceList(deviceList)); + } + catch(e) + { + $("#device-console span").html("Cannot parse JSON:" + e); + } + }); +} + +function refreshDeviceList(){ + "use strict"; + var parameters = ""; + if ($('#read-values').is(":checked")){ + parameters += "v:1"; + } + if ($('#only-unassigned').is(":checked")){ + parameters += "u:1"; + } + + $.post('socketmessage.php', {messageType: "refreshDeviceList", message: parameters}); +} + + +function parseDeviceList(deviceList){ + // temporary test function, just print devices to a string + // "use strict"; + + var output = ""; + //output += JSON.stringify(deviceList); + + for (var i = 0; i < deviceList.length; i++) { + var device = deviceList[i]; + + output += "Device " + i.toString() + ", "; + output += "function " + device.f.toString() + ", "; + output += "type " + device.h.toString() + ", "; + if((typeof device.v !== "undefined") ){ + output += "value " + device.v.toString(); + } + + output += '
'; + } + return output; +} diff --git a/maintenance-panel.php b/maintenance-panel.php index 802efb6..b3f5735 100644 --- a/maintenance-panel.php +++ b/maintenance-panel.php @@ -18,14 +18,16 @@ ?>
@@ -327,6 +329,20 @@
+
+
+
+ Script output will appear here +
+ + + + + +
+
+ + "; diff --git a/socketmessage.php b/socketmessage.php index a3f7bde..f9f1ef1 100644 --- a/socketmessage.php +++ b/socketmessage.php @@ -27,8 +27,6 @@ else { die('ERROR: Unable to open required file (config.php)'); } -?> -