|
|
@@ -27,8 +27,8 @@ var _fqADDRESS = _ADDRESS + ":" + _PORT;
|
|
|
var BG_COLOR = "#f7f7f7";
|
|
|
var TEXT_COLOR = "#444444";
|
|
|
|
|
|
-var DIU_UI_VERSION = "0.1.5";
|
|
|
-var DIU_UI_VERSION_DATE = "2019-11-27 13:09:00";
|
|
|
+var DIU_UI_VERSION = "0.1.7";
|
|
|
+var DIU_UI_VERSION_DATE = "2019-12-10";
|
|
|
|
|
|
var g_snd = {
|
|
|
"reject_fare" : "",
|
|
|
@@ -251,9 +251,20 @@ function _slider_change(name) {
|
|
|
if (name == "configuration.volume") {
|
|
|
var val = document.getElementById("ui_configuration_volume").value;
|
|
|
_process_volume(val);
|
|
|
+
|
|
|
+ ivol = Math.floor(val*100.0);
|
|
|
+ _api_request("volume", {"volume":ivol},
|
|
|
+ function(inp) { console.log("volume api set ok:", inp); },
|
|
|
+ function(inp) { console.log("volume api set fail:", inp); });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function _volume_test() {
|
|
|
+ _api_request("say", {"message":"testing 1, 2, 3"},
|
|
|
+ function(inp) { console.log("volume test ok:", inp); },
|
|
|
+ function(inp) { console.log("volume test fail:", inp); });
|
|
|
+}
|
|
|
+
|
|
|
//------------
|
|
|
|
|
|
function _clear_ui_driver() {
|
|
|
@@ -582,7 +593,7 @@ function _sp(str, align, pad) {
|
|
|
else if (align == "right") {
|
|
|
var pfx = "";
|
|
|
for (var i=0; i<n; i++) { pfx += " "; }
|
|
|
- str = prx + str;
|
|
|
+ str = pfx + str;
|
|
|
}
|
|
|
|
|
|
return str;
|
|
|
@@ -624,8 +635,19 @@ function _cb_status(inp) {
|
|
|
html_a.push("Last Token Read (" + m["last_token"] + ")");
|
|
|
html_a.push("GPS: " + has_gps + gps_str + "");
|
|
|
html_a.push(" ");
|
|
|
- html_a.push("Package Version Installed");
|
|
|
- html_a.push(_sp("ui") + _sp(DIU_UI_VERSION) + _sp(DIU_UI_VERSION_DATE) + "");
|
|
|
+
|
|
|
+ // some site specific fiddling to display package information
|
|
|
+ //
|
|
|
+ html_a.push(_sp("Package") + _sp("Version", "left", 18) + _sp("Installed", "right", 12));
|
|
|
+ html_a.push(_sp("ui") + _sp(DIU_UI_VERSION, "left", 18) + _sp(DIU_UI_VERSION_DATE, "right", 12) + "");
|
|
|
+
|
|
|
+ for (var _ii=0; _ii<3; _ii++) {
|
|
|
+ var key = "pkg" + _ii;
|
|
|
+ if (key in g_ctx.diu_status) {
|
|
|
+ var aval = g_ctx.diu_status[key].split(" ");
|
|
|
+ html_a.push(_sp(aval[0]) + _sp(aval[1], "left", 18) + _sp(aval[2], "right", 12));
|
|
|
+ }
|
|
|
+ }
|
|
|
html_a.push(" ");
|
|
|
|
|
|
if ("IMEI" in m) { html_a.push("IMEI = " + m["IMEI"] + ""); }
|
|
|
@@ -637,9 +659,6 @@ function _cb_status(inp) {
|
|
|
html_a[ii] = html_a[ii].replace(/ /g, ' ');
|
|
|
}
|
|
|
|
|
|
- //span_str = "<div style='float:left; width: 100%; margin: 0 auto; display:block; text-align:left; background: #770000; color:#008800;'>";
|
|
|
- //span_str = "<div style='float:left; width: 100%; text-align:left; background: #770000; color:#008800;'>";
|
|
|
- //var div_hdr = "<div style='float:left; width: 100%; text-align:left; '>";
|
|
|
var div_hdr = "<div class='textrow'>";
|
|
|
var str = div_hdr + html_a.join("</div><br>" + div_hdr ) + "</div>";
|
|
|
|
|
|
@@ -968,14 +987,12 @@ function _configuration() {
|
|
|
}
|
|
|
|
|
|
function _reset() {
|
|
|
-
|
|
|
_switch_ui('ui_login');
|
|
|
g_ctx.driver_login_state = "driver";
|
|
|
_clear_ui_driver();
|
|
|
_clear_ui_paddle();
|
|
|
|
|
|
location.reload(true);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function _reboot() {
|
|
|
@@ -986,24 +1003,38 @@ function _reboot() {
|
|
|
}
|
|
|
|
|
|
function _custom0() {
|
|
|
- _switch_ui('ui_login');
|
|
|
- g_ctx.driver_login_state = "driver";
|
|
|
- _clear_ui_driver();
|
|
|
- _clear_ui_paddle();
|
|
|
+ _api_request("interfaceupdown", {"interface":"eth0", "state":"up"}, function(inp) { console.log("custom0 ok:", inp); }, function(inp) { console.log("custom0 error:", inp); });
|
|
|
}
|
|
|
|
|
|
function _custom1() {
|
|
|
- _switch_ui('ui_login');
|
|
|
- g_ctx.driver_login_state = "driver";
|
|
|
- _clear_ui_driver();
|
|
|
- _clear_ui_paddle();
|
|
|
+ _api_request("interfaceupdown", {"interface":"eth0", "state":"down"}, function(inp) { console.log("custom1 ok:", inp); }, function(inp) { console.log("custom1 error:", inp); });
|
|
|
+}
|
|
|
+
|
|
|
+function _update_diagnostic_window(_msg) {
|
|
|
+ var ele = document.getElementById("ui_diagnostic_view");
|
|
|
+ ele.innerHTML = _msg;
|
|
|
}
|
|
|
|
|
|
function _custom2() {
|
|
|
- _switch_ui('ui_login');
|
|
|
- g_ctx.driver_login_state = "driver";
|
|
|
- _clear_ui_driver();
|
|
|
- _clear_ui_paddle();
|
|
|
+ _api_request("interfaceinfo", {"interface":"eth0"}, _update_diagnostic_window, function(inp) { console.log("custom2 error:", inp); });
|
|
|
+}
|
|
|
+
|
|
|
+function _custom3() {
|
|
|
+ _api_request("say", {"message":"speech test"}, function(inp) { console.log("custom3 ok:", inp); }, function(inp) { console.log("custom3 error:", inp); });
|
|
|
+}
|
|
|
+
|
|
|
+function _custom4() {
|
|
|
+ //_switch_ui('ui_login');
|
|
|
+ //g_ctx.driver_login_state = "driver";
|
|
|
+ //_clear_ui_driver();
|
|
|
+ //_clear_ui_paddle();
|
|
|
+}
|
|
|
+
|
|
|
+function _custom5() {
|
|
|
+ //_switch_ui('ui_login');
|
|
|
+ //g_ctx.driver_login_state = "driver";
|
|
|
+ //_clear_ui_driver();
|
|
|
+ //_clear_ui_paddle();
|
|
|
}
|
|
|
|
|
|
//------------
|
|
|
@@ -1025,9 +1056,14 @@ function init() {
|
|
|
document.getElementById('ui_diagnostic_custom1').onclick = _custom1;
|
|
|
document.getElementById('ui_diagnostic_custom2').onclick = _custom2;
|
|
|
|
|
|
+ document.getElementById('ui_diagnostic_custom3').onclick = _custom3;
|
|
|
+ document.getElementById('ui_diagnostic_custom4').onclick = _custom4;
|
|
|
+ document.getElementById('ui_diagnostic_custom5').onclick = _custom5;
|
|
|
+
|
|
|
// configuration
|
|
|
//
|
|
|
document.getElementById('ui_configuration_back').onclick = _mainscreen;
|
|
|
+ document.getElementById('ui_configuration_volumetest').onclick = _volume_test;
|
|
|
|
|
|
|
|
|
// login
|