overview.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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="timestamp" ></div>
  112. <div id="cputemp" ></div>
  113. <div id="rssi" ></div>
  114. <div>
  115. <span id="uptime" ></span>
  116. <span id="round" ></span>
  117. </div>
  118. </td>
  119. </tr>
  120. </table>
  121. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  122. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  123. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  124. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  125. <script type="text/javascript">
  126. function addZero(i) {
  127. if (i < 10) {
  128. i = "0" + i;
  129. }
  130. return i;
  131. }
  132. $(document).ready(function() {
  133. LoadData();
  134. LoadROIImage();
  135. });
  136. function LoadData(){
  137. loadValue("value", "value", "border-collapse: collapse; width: 100%");
  138. loadValue("raw", "raw", "border-collapse: collapse; width: 100%");
  139. loadValue("prevalue", "prevalue", "border-collapse: collapse; width: 100%");
  140. loadValue("error", "error", "border-collapse: collapse; width: 100%");
  141. loadStatus();
  142. loadCPUTemp();
  143. loadRSSI();
  144. loadUptime();
  145. loadRoundCounter();
  146. }
  147. function LoadROIImage(){
  148. var d = new Date();
  149. var timestamp = d.getTime();
  150. var h = addZero(d.getHours());
  151. var m = addZero(d.getMinutes());
  152. var s = addZero(d.getSeconds());
  153. document.getElementById("img").src = getDomainname() + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
  154. $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
  155. }
  156. function Refresh() {
  157. setTimeout (function() {
  158. LoadData();
  159. LoadROIImage();
  160. Refresh();
  161. }, 300000);
  162. }
  163. function loadStatus() {
  164. url = domainname + '/statusflow';
  165. var xhttp = new XMLHttpRequest();
  166. xhttp.onreadystatechange = function() {
  167. if (this.readyState == 4 && this.status == 200) {
  168. var _rsp = xhttp.responseText;
  169. $('#statusflow').html(_rsp);
  170. }
  171. }
  172. xhttp.open("GET", url, true);
  173. xhttp.send();
  174. }
  175. function loadCPUTemp() {
  176. url = domainname + '/cpu_temperature';
  177. var xhttp = new XMLHttpRequest();
  178. xhttp.onreadystatechange = function() {
  179. if (this.readyState == 4 && this.status == 200) {
  180. var _rsp = xhttp.responseText;
  181. $('#cputemp').html("CPU Temperature: " +_rsp + "°C");
  182. }
  183. }
  184. xhttp.open("GET", url, true);
  185. xhttp.send();
  186. }
  187. function loadRSSI() {
  188. url = domainname + '/rssi';
  189. var xhttp = new XMLHttpRequest();
  190. xhttp.onreadystatechange = function() {
  191. if (this.readyState == 4 && this.status == 200) {
  192. var _rsp = xhttp.responseText;
  193. if (_rsp >= -55) {
  194. $('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
  195. }
  196. else if (_rsp < -55 && _rsp >= -67) {
  197. $('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
  198. }
  199. else if (_rsp < -67 && _rsp >= -78) {
  200. $('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
  201. }
  202. else if (_rsp < -78 && _rsp >= -85) {
  203. $('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
  204. }
  205. else {
  206. $('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
  207. }
  208. }
  209. }
  210. xhttp.open("GET", url, true);
  211. xhttp.send();
  212. }
  213. function loadUptime() {
  214. url = domainname + '/uptime';
  215. var xhttp = new XMLHttpRequest();
  216. xhttp.onreadystatechange = function() {
  217. if (this.readyState == 4 && this.status == 200) {
  218. var _rsp = xhttp.responseText;
  219. $('#uptime').html("Uptime: " + _rsp);
  220. }
  221. }
  222. xhttp.open("GET", url, true);
  223. xhttp.send();
  224. }
  225. function loadRoundCounter() {
  226. url = domainname + '/info?type=Round';
  227. var xhttp = new XMLHttpRequest();
  228. xhttp.onreadystatechange = function() {
  229. if (this.readyState == 4 && this.status == 200) {
  230. var _rsp = xhttp.responseText;
  231. $('#round').html("(Round: " + _rsp + ")");
  232. }
  233. }
  234. xhttp.open("GET", url, true);
  235. xhttp.send();
  236. }
  237. function loadValue(_type, _div, _style) {
  238. url = domainname + '/value?all=true&type=' + _type;
  239. var xhttp = new XMLHttpRequest();
  240. xhttp.onreadystatechange = function() {
  241. if (this.readyState == 4 && this.status == 200) {
  242. var _rsp = xhttp.responseText;
  243. var _split = _rsp.split("\r");
  244. if (typeof _style == undefined) {
  245. out = "<table>";
  246. }
  247. else {
  248. out = "<table style=\"" + _style + "\">";
  249. }
  250. if (_split.length == 1) {
  251. var _zer = ZerlegeZeile(_split[0], "\t")
  252. if (_zer.length > 1) {
  253. out = _zer[1];
  254. }
  255. else {
  256. out = "";
  257. }
  258. }
  259. else {
  260. for (var j = 0; j < _split.length; ++j) {
  261. var _zer = ZerlegeZeile(_split[j], "\t")
  262. if (_zer.length == 1) {
  263. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  264. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\"> </td></tr>";
  265. }
  266. else {
  267. out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
  268. _zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\" >" + _zer[1] + "</td></tr>";
  269. }
  270. }
  271. out = out + "</table>"
  272. }
  273. document.getElementById(_div).innerHTML = out;
  274. }
  275. };
  276. xhttp.open("GET", url, true);
  277. xhttp.send();
  278. }
  279. /*
  280. function setImageMaxWidth() {
  281. loadConfig(domainname);
  282. ParseConfig();
  283. param = getConfigParameters();
  284. if(param["TakeImage"]["CamFrameSize"].value == "QVGA") {
  285. document.getElementById("img").style.maxWidth = "320px";
  286. }
  287. else {
  288. document.getElementById("img").style.maxWidth = "640px";
  289. }
  290. }
  291. */
  292. function init(){
  293. domainname = getDomainname();
  294. // setImageMaxWidth(); // CamFrameSize was replaced by zoom - CamFrameSize is no longer needed/used for zoom
  295. Refresh();
  296. }
  297. init();
  298. </script>
  299. </body>
  300. </html>