overview.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <!DOCTYPE html>
  2. <html lang="en" xml:lang="en">
  3. <head>
  4. <title>Overview</title>
  5. <meta charset="UTF-8" />
  6. <style>
  7. .tg {
  8. border-collapse:collapse;
  9. border-spacing:0;
  10. width:100%;
  11. min-width:600px;
  12. height:100%;
  13. color:darkslategray;
  14. }
  15. .tg th{
  16. min-width:325px;
  17. width:325px;
  18. height:20px;
  19. font-size:18px;
  20. text-align:left;
  21. font-weight:bold;
  22. padding:5px 10px 5px 10px;
  23. overflow:hidden;
  24. word-break:normal;
  25. background-color:lightgrey;
  26. }
  27. .tg td{
  28. font-size:15px;
  29. padding:5px 10px 5px 10px;
  30. overflow:hidden;
  31. word-break:normal;
  32. }
  33. .tg .tg-1{
  34. font-size:15px;
  35. vertical-align: top;
  36. font-family:Arial, Helvetica, sans-serif !important;
  37. }
  38. .tg .tg-2{
  39. height:52px;
  40. font-size:15px;
  41. padding:3px 0px 3px 10px;
  42. vertical-align:middle;
  43. font-family:Arial, Helvetica, sans-serif !important;
  44. }
  45. .tg .tg-3{
  46. height:45px;
  47. font-size:15px;
  48. padding:3px 10px 3px 10px;
  49. vertical-align:middle;
  50. font-family:Arial, Helvetica, sans-serif !important;
  51. }
  52. .tg .tg-4{
  53. height:fit-content;
  54. font-size:15px;
  55. padding:5px 10px 5px 10px;
  56. vertical-align:text-top;
  57. font-family:Arial, Helvetica, sans-serif !important;
  58. }
  59. </style>
  60. </head>
  61. <body style="font-family: arial">
  62. <table class="tg">
  63. <tr>
  64. <th class="th">Value</th>
  65. <td class="tg-1" rowspan="13">
  66. <img style="padding-left: 5px; padding-top: 0px; max-width:100%; width:100%; height:auto;" id="img" src="">
  67. </td>
  68. </tr>
  69. <tr>
  70. <td class="tg-2">
  71. <div id="value"></div>
  72. </td>
  73. </tr>
  74. <tr>
  75. <th class="th">Previous Value</th>
  76. </tr>
  77. <tr>
  78. <td class="tg-2">
  79. <div id="prevalue"></div>
  80. </td>
  81. </tr>
  82. <tr>
  83. <th class="th">Raw Value</th>
  84. </tr>
  85. <tr>
  86. <td class="tg-2">
  87. <div id="raw"></div>
  88. </td>
  89. </tr>
  90. <tr>
  91. <th class="th">Value Status</th>
  92. </tr>
  93. <tr>
  94. <td class="tg-2">
  95. <div id="error"></div>
  96. </td>
  97. </tr>
  98. <tr>
  99. <th class="th">Process State</th>
  100. </tr>
  101. <tr>
  102. <td class="tg-3">
  103. <div id="statusflow" ></div>
  104. </td>
  105. </tr>
  106. <tr>
  107. <th class="th">System Info</th>
  108. </tr>
  109. <tr>
  110. <td class="tg-4">
  111. <div id="sntp_date" ></div>
  112. <div id="timestamp" ></div>
  113. <div id="cputemp" ></div>
  114. <div id="rssi" ></div>
  115. <div>
  116. <span id="uptime" ></span>
  117. <span id="round" ></span>
  118. </div>
  119. </td>
  120. </tr>
  121. </table>
  122. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  123. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  124. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  125. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  126. <script type="text/javascript">
  127. function addZero(i) {
  128. if (i < 10) {
  129. i = "0" + i;
  130. }
  131. return i;
  132. }
  133. $(document).ready(function() {
  134. LoadData();
  135. LoadROIImage();
  136. });
  137. function LoadData(){
  138. loadValue("value", "value", "border-collapse: collapse; width: 100%");
  139. loadValue("raw", "raw", "border-collapse: collapse; width: 100%");
  140. loadValue("prevalue", "prevalue", "border-collapse: collapse; width: 100%");
  141. loadValue("error", "error", "border-collapse: collapse; width: 100%");
  142. loadStatus();
  143. loadSntpDate();
  144. loadCPUTemp();
  145. loadRSSI();
  146. loadUptime();
  147. loadRoundCounter();
  148. }
  149. function LoadROIImage(){
  150. var d = new Date();
  151. var timestamp = d.getTime();
  152. var h = addZero(d.getHours());
  153. var m = addZero(d.getMinutes());
  154. var s = addZero(d.getSeconds());
  155. document.getElementById("img").src = getDomainname() + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
  156. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  157. }
  158. function Refresh() {
  159. setTimeout (function() {
  160. LoadData();
  161. LoadROIImage();
  162. Refresh();
  163. }, 300000);
  164. }
  165. function loadStatus() {
  166. url = domainname + '/statusflow';
  167. var xhttp = new XMLHttpRequest();
  168. xhttp.onreadystatechange = function() {
  169. if (this.readyState == 4 && this.status == 200) {
  170. var _rsp = xhttp.responseText;
  171. $('#statusflow').html(_rsp);
  172. }
  173. }
  174. xhttp.open("GET", url, true);
  175. xhttp.send();
  176. }
  177. function loadCPUTemp() {
  178. url = domainname + '/cpu_temperature';
  179. var xhttp = new XMLHttpRequest();
  180. xhttp.onreadystatechange = function() {
  181. if (this.readyState == 4 && this.status == 200) {
  182. var _rsp = xhttp.responseText;
  183. $('#cputemp').html("CPU Temperature: " +_rsp + "°C");
  184. }
  185. }
  186. xhttp.open("GET", url, true);
  187. xhttp.send();
  188. }
  189. function loadRSSI() {
  190. url = domainname + '/rssi';
  191. var xhttp = new XMLHttpRequest();
  192. xhttp.onreadystatechange = function() {
  193. if (this.readyState == 4 && this.status == 200) {
  194. var _rsp = xhttp.responseText;
  195. if (_rsp >= -55) {
  196. $('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
  197. }
  198. else if (_rsp < -55 && _rsp >= -67) {
  199. $('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
  200. }
  201. else if (_rsp < -67 && _rsp >= -78) {
  202. $('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
  203. }
  204. else if (_rsp < -78 && _rsp >= -85) {
  205. $('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
  206. }
  207. else {
  208. $('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
  209. }
  210. }
  211. }
  212. xhttp.open("GET", url, true);
  213. xhttp.send();
  214. }
  215. function loadSntpDate() {
  216. url = domainname + '/date';
  217. var xhttp = new XMLHttpRequest();
  218. xhttp.onreadystatechange = function () {
  219. if (this.readyState == 4 && this.status == 200) {
  220. var _rsp = xhttp.responseText;
  221. $('#sntp_date').html("Date/Time on device: " + _rsp);
  222. }
  223. }
  224. xhttp.open("GET", url, true);
  225. xhttp.send();
  226. }
  227. function loadUptime() {
  228. url = domainname + '/uptime';
  229. var xhttp = new XMLHttpRequest();
  230. xhttp.onreadystatechange = function() {
  231. if (this.readyState == 4 && this.status == 200) {
  232. var _rsp = xhttp.responseText;
  233. $('#uptime').html("Uptime: " + _rsp);
  234. }
  235. }
  236. xhttp.open("GET", url, true);
  237. xhttp.send();
  238. }
  239. function loadRoundCounter() {
  240. url = domainname + '/info?type=Round';
  241. var xhttp = new XMLHttpRequest();
  242. xhttp.onreadystatechange = function() {
  243. if (this.readyState == 4 && this.status == 200) {
  244. var _rsp = xhttp.responseText;
  245. $('#round').html("(Round: " + _rsp + ")");
  246. }
  247. }
  248. xhttp.open("GET", url, true);
  249. xhttp.send();
  250. }
  251. function loadValue(_type, _div, _style) {
  252. url = domainname + '/value?all=true&type=' + _type;
  253. var xhttp = new XMLHttpRequest();
  254. xhttp.onreadystatechange = function() {
  255. if (this.readyState == 4 && this.status == 200) {
  256. var _rsp = xhttp.responseText;
  257. var _split = _rsp.split("\r");
  258. if (typeof _style == undefined) {
  259. out = "<table>";
  260. }
  261. else {
  262. out = "<table style=\"" + _style + "\">";
  263. }
  264. if (_split.length == 1) {
  265. var _zer = ZerlegeZeile(_split[0], "\t")
  266. if (_zer.length > 1) {
  267. out = _zer[1];
  268. }
  269. else {
  270. out = "";
  271. }
  272. }
  273. else {
  274. for (var j = 0; j < _split.length; ++j) {
  275. var _zer = ZerlegeZeile(_split[j], "\t")
  276. if (_zer.length == 1) {
  277. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  278. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\"> </td></tr>";
  279. }
  280. else {
  281. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  282. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\" >" + _zer[1] + "</td></tr>";
  283. }
  284. }
  285. out = out + "</table>"
  286. }
  287. document.getElementById(_div).innerHTML = out;
  288. }
  289. };
  290. xhttp.open("GET", url, true);
  291. xhttp.send();
  292. }
  293. /*
  294. function setImageMaxWidth() {
  295. loadConfig(domainname);
  296. ParseConfig();
  297. param = getConfigParameters();
  298. if(param["TakeImage"]["CamFrameSize"].value == "QVGA") {
  299. document.getElementById("img").style.maxWidth = "320px";
  300. }
  301. else {
  302. document.getElementById("img").style.maxWidth = "640px";
  303. }
  304. }
  305. */
  306. function init(){
  307. domainname = getDomainname();
  308. // setImageMaxWidth(); // CamFrameSize was replaced by zoom - CamFrameSize is no longer needed/used for zoom
  309. Refresh();
  310. }
  311. init();
  312. </script>
  313. </body>
  314. </html>