Jelajahi Sumber

further PIU development

* setting up the 'piu_kiosk' to launch chromium
* index fiddling with element positioning for ui
* piu_ui.js fiddling with message structure (still experimental)
clementinecomputing 4 tahun lalu
induk
melakukan
19da5f62d9
3 mengubah file dengan 97 tambahan dan 6 penghapusan
  1. 19 4
      busunit-PIU/html/index.html
  2. 4 2
      busunit-PIU/html/js/piu_ui.js
  3. 74 0
      busunit-PIU/scripts/piu_kiosk

+ 19 - 4
busunit-PIU/html/index.html

@@ -81,21 +81,36 @@
     <!-- <div id='ui_main' style='display:none;'> -->
     <div id='ui_main'>
 
+      <div class='pure-g'> <div class='pue-u'>
+
       <div class='pure-g row'>
         <div class='pure-u-1-12 col'>
-          <!-- <div class='bdisp' style='color:#aaaaaa;'>o k 1 2 3 4</div> <br> -->
         </div>
 
         <div class='pure-u-5-6 col'>
-          <div class='bdisp' style='color:#999a99;' id='ui_message_status' >SEE DRIVER...</div> <br>
-          <img id='ui_main_vidfeed' style='height:50vh;' src='' ></img> <br>
-          <div class='bdisp' id='ui_message_cardinfo'>...</div>
+          <div class='bdisp' style='color:#999a99;' id='ui_message_status' >SEE DRIVER...</div>
         </div>
 
         <div class='pure-u-1-12 col'></div>
+      </div>
 
+      <div class='pure-g row' style='height:55vh;'>
+        <img id='ui_main_vidfeed' style='height:50vh; margin-left: 16px;' src='' ></img>
       </div>
 
+      <div class='pure-g row'>
+        <div class='pure-u-1-12 col'>
+        </div>
+
+        <div class='pure-u-5-6 col'>
+          <div class='bdisp' id='ui_message_cardinfo'>...</div>
+        </div>
+
+        <div class='pure-u-1-12 col'></div>
+      </div>
+
+      </div></div>
+
       <div id="ui_message_datetime" class='datetimebar'>
         2020-04-11 09:50 AM
       </div>

+ 4 - 2
busunit-PIU/html/js/piu_ui.js

@@ -337,11 +337,13 @@ function _ws_process(dat) {
   var argv1 = ( (tok.length > 1) ? tok[1] : "");
   var argv2 = ( (tok.length > 2) ? tok[2] : "");
 
+  var msg_payload = tok.slice(1).join(" ");
+
   if (tok[0] == "passenger_notify") {
-    ui_setmessage("ui_message_cardinfo", argv1);
+    ui_setmessage("ui_message_cardinfo", msg_payload);
   }
   else if (tok[0] == "passenger_message") {
-    ui_setmessage("ui_message_status", argv1);
+    ui_setmessage("ui_message_status", msg_payload);
   }
 
 

+ 74 - 0
busunit-PIU/scripts/piu_kiosk

@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# Copyright (c) 2021 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/>.
+#
+
+# This is the front end interface to the PIU that will run chromium
+# browser (on startup) and ultimately connect to a local web
+# server serving up the passenger facing interface
+#
+
+export BASEDIR=/home/pi
+
+export DISPLAY=:0
+
+export fqADDRESS="http://127.0.0.1:8001"
+
+# turn off screensave/screen blanking
+#
+xset s noblank
+xset s off
+xset -dpms
+
+# hide mouse after 0.5 seconds of idle time
+#
+unclutter -idle 0.05 -root &
+
+# hide mouse completely
+#
+#unclutter -root &
+
+
+# clear out warning bar on chromium
+#
+tmpfn=`mktemp`
+jq '.profile.exited_cleanly = true' $BASEDIR/.config/chromium/Preferences | jq '.profile.exit_type = "Normal"' > $tmpfn
+mv $tmpfn $BASEDIR/.config/chromium/Preferences
+
+# start chromium in kiosk mode
+#
+
+#/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk ./html/index.html
+#
+#  --disable-application-cache \
+/usr/bin/chromium-browser \
+  --noerrdialogs \
+  --disable-infobars \
+  --aggressive-cache-discard \
+  --incognito \
+  --disable-pinch \
+  --overscroll-history-navigation=0 \
+  --kiosk \
+  $fqADDRESS
+
+
+
+# refresh
+#
+#xdotool keydown ctrl+r; xdotool keyup ctrl+r;
+