|
|
@@ -1,6 +1,24 @@
|
|
|
-
|
|
|
-var _ADDRESS = "192.168.0.110";
|
|
|
-//var _URL = "http://localhost";
|
|
|
+/*
|
|
|
+ * Copyright (c) 2019 Clementine Computing LLC.
|
|
|
+ *
|
|
|
+ * This file is part of PopuFare.
|
|
|
+ *
|
|
|
+ * PopuFare is free software: you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU Affero General Public License as published by
|
|
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
|
+ * (at your option) any later version.
|
|
|
+ *
|
|
|
+ * PopuFare is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ * GNU Affero General Public License for more details.
|
|
|
+ *
|
|
|
+ * You should have received a copy of the GNU Affero General Public License
|
|
|
+ * along with PopuFare. If not, see <https://www.gnu.org/licenses/>.
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+var _ADDRESS = "localhost";
|
|
|
var _URL = "http://" + _ADDRESS;
|
|
|
var _PORT = 60535;
|
|
|
|
|
|
@@ -9,6 +27,8 @@ var _fqADDRESS = _ADDRESS + ":" + _PORT;
|
|
|
var BG_COLOR = "#f7f7f7";
|
|
|
var TEXT_COLOR = "#444444";
|
|
|
|
|
|
+var DIU_UI_VERSION = "0.1.0";
|
|
|
+var DIU_UI_VERSION_DATE = "2019-09-04 15:24:11";
|
|
|
|
|
|
var g_ctx = {
|
|
|
|
|
|
@@ -31,25 +51,6 @@ var g_ctx = {
|
|
|
|
|
|
"diu_status" : {},
|
|
|
|
|
|
- /*
|
|
|
- "rule" : {
|
|
|
- "adult":"CASH-ADULT",
|
|
|
- "youth":"CASH-YOUTH",
|
|
|
- "half":"CASH-HALF",
|
|
|
- "bike":"MISC-BIKE",
|
|
|
- "wheelchair":"MISC-WHEELCHAIR",
|
|
|
- "transfer":"MISC-TRANSFER",
|
|
|
- "interline":"MISC-INTERLINE",
|
|
|
- "event":"MISC-EVENT",
|
|
|
- "schoola":"OVR-SCHOOLA",
|
|
|
- "schoolb":"OVR-SCHOOLB",
|
|
|
- "schoolc":"OVR-SCHOOLC",
|
|
|
- "orga":"OVR-ORGA",
|
|
|
- "orgb":"OVR-ORGB",
|
|
|
- "orgc":"OVR-ORGC",
|
|
|
- },
|
|
|
- */
|
|
|
-
|
|
|
"x": ""
|
|
|
};
|
|
|
|
|
|
@@ -478,27 +479,56 @@ function _bulkaccept_input(inp) {
|
|
|
//-------------
|
|
|
//-------------
|
|
|
|
|
|
+
|
|
|
+// space pad
|
|
|
+// default 10
|
|
|
+//
|
|
|
+function _sp(str, align, pad) {
|
|
|
+ align = ((typeof align=="undefined") ? "left" : align);
|
|
|
+ pad = ((typeof pad==="undefined") ? 10 : pad);
|
|
|
+
|
|
|
+ var n = 0;
|
|
|
+ n = pad - str.length;
|
|
|
+
|
|
|
+ if (align == "left") {
|
|
|
+ for (var i=0; i<n; i++) { str += " "; }
|
|
|
+ }
|
|
|
+ else if (align == "center") {
|
|
|
+ var rem = n%2;
|
|
|
+ var n2 = Math.floor(n/2);
|
|
|
+ var pfx = "", sfx = "";
|
|
|
+ for (var i=0; i<n2; i++) { pfx += " "; }
|
|
|
+ for (var i=0; i<(n2+rem); i++) { sfx += " "; }
|
|
|
+ str = pfx + str + sfx;
|
|
|
+ }
|
|
|
+ else if (align == "right") {
|
|
|
+ var pfx = "";
|
|
|
+ for (var i=0; i<n; i++) { pfx += " "; }
|
|
|
+ str = prx + str;
|
|
|
+ }
|
|
|
+
|
|
|
+ return str;
|
|
|
+}
|
|
|
+
|
|
|
function _cb_status(inp) {
|
|
|
- //console.log("_cb_status>>\n", inp);
|
|
|
|
|
|
var tok = inp.split(" ");
|
|
|
if (tok.length < 2) { return; }
|
|
|
if (tok[0]!="ok") { return; }
|
|
|
|
|
|
- var valtok = tok[1].split("\n");
|
|
|
+ valtok = tok.slice(1).join(" ").split("\n");
|
|
|
if (valtok[0]!="msg=status") { return; }
|
|
|
|
|
|
g_ctx.diu_status = {};
|
|
|
var fields = valtok[1].split("|");
|
|
|
for (var ii=0; ii<fields.length; ii++) {
|
|
|
var kv = fields[ii].split("=");
|
|
|
- g_ctx.diu_status[kv[0]] = kv[1];
|
|
|
+ if (kv.length!=2) { continue; }
|
|
|
+ g_ctx.diu_status[kv[0].trim()] = kv[1].trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- //for (var x in fv) { console.log(x, ";;;", fv[x]); }
|
|
|
-
|
|
|
var m = g_ctx.diu_status;
|
|
|
if (g_ctx.current_ui === "ui_login") {
|
|
|
var ele = document.getElementById("ui_login_status");
|
|
|
@@ -507,9 +537,15 @@ function _cb_status(inp) {
|
|
|
str += "Last Token Read (" + m["last_token"] + ")\n";
|
|
|
str += "GPS: " + m["gps"] + "\n";
|
|
|
str += "\n";
|
|
|
+ // 012345678012345678901234567890
|
|
|
str += "Package Version Installed\n";
|
|
|
+ //str += "-----------------------------\n";
|
|
|
+ str += _sp("ui") + _sp(DIU_UI_VERSION) + _sp(DIU_UI_VERSION_DATE) + "\n";
|
|
|
str += "\n";
|
|
|
- str += "\n";
|
|
|
+
|
|
|
+ if ("IMEI" in m) { str += "IMEI = " + m["IMEI"] + "\n"; }
|
|
|
+ if ("IMSI" in m) { str += "IMSI = " + m["IMSI"] + "\n"; }
|
|
|
+ if ("ETH0" in m) { str += "ETH0 = " + m["ETH0"] + "\n"; }
|
|
|
|
|
|
ele.innerHTML = str;
|
|
|
}
|