浏览代码

wip

* sound for button presses
* cosmetic code changes for paddlemgr.c
* restrict to stop changes for route_announce
clementinecomputing 6 年之前
父节点
当前提交
055396e0fd

二进制
busunit/DIUv2/html/assets/459992_florianreichelt_beep_short.wav


+ 106 - 106
busunit/DIUv2/html/index-ORG.html

@@ -24,7 +24,7 @@
       <div class='pure-g col'>
 
         <div class='pure-u-1-3 row'> </div>
-        <div class='pure-u-1-2 row'> <button class='bdropinp bkeyw' id='ui_login_login'>Login</button> </div>
+        <div class='pure-u-1-2 row'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_login_login'>Login</button> </div>
 
       </div>
 
@@ -62,17 +62,17 @@ Package    Version        Installed
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_mainscreen'>Main Screen</button> </div>
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_reset'>Reset</button> </div>
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_reboot'>Reboot</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_mainscreen'>Main Screen</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_reset'>Reset</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_reboot'>Reboot</button> </div>
 
       </div>
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_custom0'>Custom 0</button> </div>
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_custom1'>Custom 1</button> </div>
-        <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw' id='ui_diagnostic_custom2'>Custom 2</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_custom0'>Custom 0</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_custom1'>Custom 1</button> </div>
+        <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_diagnostic_custom2'>Custom 2</button> </div>
 
       </div>
 
@@ -106,14 +106,14 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_1'>1</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_2'>2</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_3'>3</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_1'>1</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_2'>2</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_3'>3</button> </div>
 
-        <div class='pure-u-1-6 col'> <p><button class='bdisp' style='display:block;' id='ui_driver_drivertext'>Driver</button></p> </div>
+        <div class='pure-u-1-6 col'> <p><button onmousedown='_beep();' class='bdisp' style='display:block;' id='ui_driver_drivertext'>Driver</button></p> </div>
 
         <div class='pure-u-1-6 col'> 
-          <button class="bdrop bfieldinp" id='ui_driver_driver' style='display:block;'></button>
+          <button onmousedown='_beep();' class="bdrop bfieldinp" id='ui_driver_driver' style='display:block;'></button>
         </div>
 
       </div>
@@ -122,16 +122,16 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_4'>4</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_5'>5</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_6'>6</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_4'>4</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_5'>5</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_6'>6</button> </div>
 
         <div class='pure-u-1-6 col' style='text-align:center;'>
-          <p><button class='bdisp' style='display:none;' id='ui_driver_pin_text'>Pin</button></p>
+          <p><button onmousedown='_beep();' class='bdisp' style='display:none;' id='ui_driver_pin_text'>Pin</button></p>
         </div>
 
         <div class='pure-u-1-6 col'> 
-          <button class="bdrop bfieldinp" id='ui_driver_pin' style='display:none;'></button>
+          <button onmousedown='_beep();' class="bdrop bfieldinp" id='ui_driver_pin' style='display:none;'></button>
         </div>
 
       </div>
@@ -140,12 +140,12 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_7'>7</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_8'>8</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_9'>9</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_7'>7</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_8'>8</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_9'>9</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_driver_ok'>Ok</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_driver_ok'>Ok</button> </div>
 
       </div>
 
@@ -153,12 +153,12 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_clr'>Clr</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_0'>0</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_driver_bksp'>Bksp</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_clr'>Clr</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_0'>0</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_driver_bksp'>Bksp</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_driver_cancel'>Cancel</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_driver_cancel'>Cancel</button> </div>
 
       </div>
 
@@ -200,7 +200,7 @@ Diagnostic window...
       <div style='width:100%; height:100%;'>
 
         <div class='pure-g row' style='width:100%; height:100%;' >
-          <div class='pure-u-1-6 col' style=' position:absolute; top:20%; margin-left:25%; '> <button class='bdropinp bkeyHuge' id='ui_driverincorrect_btn'>Incorrect Login</button> </div>
+          <div class='pure-u-1-6 col' style=' position:absolute; top:20%; margin-left:25%; '> <button onmousedown='_beep();' class='bdropinp bkeyHuge' id='ui_driverincorrect_btn'>Incorrect Login</button> </div>
         </div>
 
       </div>
@@ -220,16 +220,16 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_1'>1</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_2'>2</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_3'>3</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_1'>1</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_2'>2</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_3'>3</button> </div>
 
         <div class='pure-u-1-6 col'>
-          <p><button class='bdisp' id='ui_paddle_paddle_text' style='display:block;'>Paddle</button></p>
+          <p><button onmousedown='_beep();' class='bdisp' id='ui_paddle_paddle_text' style='display:block;'>Paddle</button></p>
         </div>
 
         <div class='pure-u-1-6 col'> 
-          <button class="bdrop bfieldinp" id='ui_paddle_paddle' style='display:block;'></button>
+          <button onmousedown='_beep();' class="bdrop bfieldinp" id='ui_paddle_paddle' style='display:block;'></button>
         </div>
 
 
@@ -238,21 +238,21 @@ Diagnostic window...
       <br>
 
       <div class='pure-g row'>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_4'>4</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_5'>5</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_6'>6</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_4'>4</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_5'>5</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_6'>6</button> </div>
       </div>
 
       <br>
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_7'>7</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_8'>8</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_9'>9</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_7'>7</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_8'>8</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_9'>9</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_paddle_ok'>Ok</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_paddle_ok'>Ok</button> </div>
 
       </div>
 
@@ -260,12 +260,12 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_clr'>Clr</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_0'>0</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_paddle_bksp'>Bksp</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_clr'>Clr</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_0'>0</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_paddle_bksp'>Bksp</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_paddle_cancel'>Cancel</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_paddle_cancel'>Cancel</button> </div>
 
       </div>
 
@@ -305,7 +305,7 @@ Diagnostic window...
       <!--
       <br>
       <div class='pure-g row'>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_paddleunknown_btn'>Unknown Paddle</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_paddleunknown_btn'>Unknown Paddle</button> </div>
       </div>
       -->
 
@@ -313,7 +313,7 @@ Diagnostic window...
 
         <div class='pure-g row' style='width:100%; height:100%;' >
           <div class='pure-u-1-6 col' style=' position:absolute; top:20%; margin-left:25%; '>
-            <button class='bdropinp bkeyHuge' id='ui_paddleunknown_btn'>Unknown Paddle </button>
+            <button onmousedown='_beep();' class='bdropinp bkeyHuge' id='ui_paddleunknown_btn'>Unknown Paddle </button>
           </div>
         </div>
 
@@ -349,12 +349,12 @@ Diagnostic window...
 ...
 </textarea>
 
-        <!-- <div class='pure-u-1-2 col'> <button class='bstatus' id='ui_main_status'>status...</button> </div> -->
+        <!-- <div class='pure-u-1-2 col'> <button onmousedown='_beep();' class='bstatus' id='ui_main_status'>status...</button> </div> -->
 
       </div>
 
-      <div class='pure-u-1-6 col'> <button class='bdropinp bkey btnprv' id='ui_main_prv'>PRV</button> </div>
-      <div class='pure-u-1-6 col'> <button class='bdropinp bkey btnnxt' id='ui_main_nxt'>NXT</button> </div>
+      <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey btnprv' id='ui_main_prv'>PRV</button> </div>
+      <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey btnnxt' id='ui_main_nxt'>NXT</button> </div>
 
       <div class='pure-g row'></div>
       <!-- <div class='pure-g row'></div> -->
@@ -362,19 +362,19 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_adult'>Adult $</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_youth'>Youth $</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_half'>Half $</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_main_bulk'>Bulk $</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_adult'>Adult $</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_youth'>Youth $</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_half'>Half $</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_main_bulk'>Bulk $</button> </div>
 
       </div>
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_bike'>Bike</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_wheelchair'>Wheel Chair</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym mny' id='ui_main_transfer'>X-fer</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_main_menu'>Menu</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_bike'>Bike</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_wheelchair'>Wheel Chair</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym mny' id='ui_main_transfer'>X-fer</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_main_menu'>Menu</button> </div>
 
       </div>
 
@@ -395,10 +395,10 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym highlight' id='ui_bulk_misc'>$ + Misc</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_bulk_passes'>Passes</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_bulk_menu'>Main Menu</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdisp' style='font-size:30px;'>BULK</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym highlight' id='ui_bulk_misc'>$ + Misc</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_bulk_passes'>Passes</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_bulk_menu'>Main Menu</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdisp' style='font-size:30px;'>BULK</button> </div>
 
       </div>
 
@@ -409,18 +409,18 @@ Diagnostic window...
       <div id='ui_bulk_misc_tab' style='display:block;'>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_adult'>Adult $</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_youth'>Youth $</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_half'>Half $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_adult'>Adult $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_youth'>Youth $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_half'>Half $</button> </div>
         </div>
 
         <div class='pure-g row'></div>
 
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_event'>Event</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_transfer'>X-fer</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_interline'>InterLine</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_event'>Event</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_transfer'>X-fer</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_interline'>InterLine</button> </div>
         </div>
 
       </div>
@@ -428,17 +428,17 @@ Diagnostic window...
       <div id='ui_bulk_passes_tab' style='display:none;'>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_schoola'>SchoolA ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_schoolb'>SchoolB ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_schoolc'>SchoolC ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_schoola'>SchoolA ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_schoolb'>SchoolB ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_schoolc'>SchoolC ID</button> </div>
         </div>
 
         <div class='pure-g row'></div>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_orga'>Org A ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_orgb'>Org B ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_bulk_orgc'>Org C ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_orga'>Org A ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_orgb'>Org B ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_bulk_orgc'>Org C ID</button> </div>
         </div>
 
       </div>
@@ -462,14 +462,14 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_1'>1</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_2'>2</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_3'>3</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_1'>1</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_2'>2</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_3'>3</button> </div>
 
 
         <div class='pure-u-1-6 col'> </div>
         <div class='pure-u-1-6 col'> 
-          <button class="bdropinp bkeyw" id='ui_bulkaccept_faretype' style='display:block;'>...</button>
+          <button onmousedown='_beep();' class="bdropinp bkeyw" id='ui_bulkaccept_faretype' style='display:block;'>...</button>
 
 
         </div>
@@ -480,14 +480,14 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_4'>4</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_5'>5</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_6'>6</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_4'>4</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_5'>5</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_6'>6</button> </div>
 
 
-        <div class='pure-u-1-6 col'> <p><button class='bdisp' style='display:block;' id='ui_driver_drivertext'>#</button></p> </div>
+        <div class='pure-u-1-6 col'> <p><button onmousedown='_beep();' class='bdisp' style='display:block;' id='ui_driver_drivertext'>#</button></p> </div>
         <div class='pure-u-1-6 col'> 
-          <button class="bdropinp bkeyw" id='ui_bulkaccept_count' style='display:block;'></button>
+          <button onmousedown='_beep();' class="bdropinp bkeyw" id='ui_bulkaccept_count' style='display:block;'></button>
         </div>
 
       </div>
@@ -496,12 +496,12 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_7'>7</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_8'>8</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_9'>9</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_7'>7</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_8'>8</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_9'>9</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_bulkaccept_ok'>Ok</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_bulkaccept_ok'>Ok</button> </div>
 
       </div>
 
@@ -509,12 +509,12 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_clr'>Clr</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_0'>0</button> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkey ltyellow' id='ui_bulkaccept_bksp'>Bksp</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_clr'>Clr</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_0'>0</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkey ltyellow' id='ui_bulkaccept_bksp'>Bksp</button> </div>
 
         <div class='pure-u-1-6 col'> </div>
-        <div class='pure-u-1-6 col'> <button class='bdropinp bkeyw' id='ui_bulkaccept_cancel'>Cancel</button> </div>
+        <div class='pure-u-1-6 col'> <button onmousedown='_beep();' class='bdropinp bkeyw' id='ui_bulkaccept_cancel'>Cancel</button> </div>
 
       </div>
 
@@ -536,10 +536,10 @@ Diagnostic window...
 
       <div class='pure-g row'>
 
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym highlight' id='ui_fareoverride_misc'>$ + Misc</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_fareoverride_passes'>Passes</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym' id='ui_fareoverride_menu'>Main Menu</button> </div>
-        <div class='pure-u-1-4 col'> <button class='bdropinp bkeym logout' id='ui_fareoverride_logout' style='float:center;'>Logout</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym highlight' id='ui_fareoverride_misc'>$ + Misc</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_fareoverride_passes'>Passes</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym' id='ui_fareoverride_menu'>Main Menu</button> </div>
+        <div class='pure-u-1-4 col'> <button onmousedown='_beep();' class='bdropinp bkeym logout' id='ui_fareoverride_logout' style='float:center;'>Logout</button> </div>
 
       </div>
 
@@ -550,23 +550,23 @@ Diagnostic window...
       <div id='ui_fareoverride_misc_tab' style='display:block;'>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_adult'>Adult $</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_youth'>Youth $</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_half'>Half $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_adult'>Adult $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_youth'>Youth $</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_half'>Half $</button> </div>
         </div>
 
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_bike'>Bike</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_wheelchair'>Wheel Chair</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_transfer'>X-fer</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_bike'>Bike</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_wheelchair'>Wheel Chair</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_transfer'>X-fer</button> </div>
         </div>
 
 
         <div class='pure-g row'>
           <div class='pure-u-1-3 col'> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_event'>Event</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_interline'>Interline</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_event'>Event</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_interline'>Interline</button> </div>
         </div>
 
       </div>
@@ -574,17 +574,17 @@ Diagnostic window...
       <div id='ui_fareoverride_passes_tab' style='display:none;'>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_schoola'>SchoolA ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_schoolb'>SchoolB ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_schoolc'>SchoolC ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_schoola'>SchoolA ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_schoolb'>SchoolB ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_schoolc'>SchoolC ID</button> </div>
         </div>
 
         <div class='pure-g row'></div>
 
         <div class='pure-g row'>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_orga'>OrgA ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_orgb'>OrgB ID</button> </div>
-          <div class='pure-u-1-3 col'> <button class='bdropinp bkeyw mny' id='ui_fareoverride_orgc'>OrgC</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_orga'>OrgA ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_orgb'>OrgB ID</button> </div>
+          <div class='pure-u-1-3 col'> <button onmousedown='_beep();' class='bdropinp bkeyw mny' id='ui_fareoverride_orgc'>OrgC</button> </div>
         </div>
 
       </div>

+ 17 - 5
busunit/DIUv2/html/js/diu_ui-ORG.js

@@ -2,17 +2,17 @@
  * 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/>.
  *
@@ -30,6 +30,15 @@ var TEXT_COLOR = "#444444";
 var DIU_UI_VERSION = "0.1.0";
 var DIU_UI_VERSION_DATE = "2019-09-04 15:24:11";
 
+var g_snd = {
+  "button_press" : ""
+};
+
+function _beep() {
+  g_snd.button_press.currentTime=0;
+  g_snd.button_press.play();
+}
+
 var g_ctx = {
 
   "driver_login_state" : "driver",
@@ -351,9 +360,9 @@ function _verify_paddle() {
 }
 
 function _verify_paddle_ack()    { console.log("got ack for push paddle message\n"); }
-
 function _verify_paddle_ok()    { _switch_ui("ui_main"); }
 function _verify_paddle_fail()  { _switch_ui("ui_paddleunknown"); }
+
 function _paddle_unknown(inp)   {
   _clear_ui_paddle();
   _switch_ui("ui_paddle");
@@ -631,7 +640,7 @@ function _main_message_add(msg, bg_color, text_color) {
 function _ws_process(dat) {
 
   var tok = dat.split(" ");
-  
+
   if (tok.length < 2) { return; }
 
   if (tok[0] == "paddle") {
@@ -660,6 +669,7 @@ function _ws_process(dat) {
 
 function _init_websocket() {
   var sock = new WebSocket("ws://" + _fqADDRESS);
+
   sock.onopen = function(e) { console.log("open", e); }
   sock.onmessage = function(e) { _ws_process(e.data); }
   sock.onclose = function(e) { console.log("close", e); }
@@ -1064,6 +1074,8 @@ function init() {
   ele.onmousedown = ui_pattern_mousedown;
   ele.onmouseup = ui_pattern_mouseup;
 
+  g_snd.button_press = new Audio("assets/459992_florianreichelt_beep_short.wav");
+
 }
 
 init();

+ 341 - 337
busunit/paddlemgr/paddlemgr.c

@@ -2,17 +2,17 @@
  * 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/>.
  *
@@ -42,16 +42,16 @@
 
 typedef struct stop_struct	//structure for loading stop definitions
 {
-  int hour;		//scheduled arrival time 
+  int hour;		//scheduled arrival time
   int min;
-  
+
   double lat;		//coordinates
   double lon;	
-  
+
   int route;		//route	
   int trip;		//trip number
   int stop;		//stop
-  
+
   char name[STOP_NAME_LEN];	//human readable stop name
 
 } stop;
@@ -68,424 +68,428 @@ stop 	current_paddle[MAX_PADDLE_SIZE] = {{0}};	//Data block to hold loaded paddl
 
 int load_paddle(int paddlenum)
 {
-    char buffer[LINE_BUFFER_SIZE];
-    char buffer2[LINE_BUFFER_SIZE];
-    FILE *f;
-    
-    int i, eol;
-    int n;
-    
-    sprintf(buffer, "%s%d.paddle", CONFIG_FILE_PATH, paddlenum);
-    
-    f = fopen(buffer, "rb");
-    
-    if(!f)
-    {
-        printf("Paddle not found: %s\n", buffer);
-        return -1;
-    }
+  char buffer[LINE_BUFFER_SIZE];
+  char buffer2[LINE_BUFFER_SIZE];
+  FILE *f;
+
+  int i, eol;
+  int n;
 
-    current_paddle_num = paddlenum;
-    current_paddle_idx = 0;
-    current_paddle_len = 0;
-    n = 0;
+  sprintf(buffer, "%s%d.paddle", CONFIG_FILE_PATH, paddlenum);
 
-    //For each line in the input file
-    while( fgets(buffer, LINE_BUFFER_SIZE, f) )
+  f = fopen(buffer, "rb");
+
+  if(!f)
+  {
+    printf("Paddle not found: %s\n", buffer);
+    return -1;
+  }
+
+  current_paddle_num = paddlenum;
+  current_paddle_idx = 0;
+  current_paddle_len = 0;
+  n = 0;
+
+  //For each line in the input file
+  while( fgets(buffer, LINE_BUFFER_SIZE, f) )
+  {
+    if(current_paddle_idx >= MAX_PADDLE_SIZE)
     {
-        if(current_paddle_idx >= MAX_PADDLE_SIZE)
-        {
-            fprintf(stderr, "Paddle %d has overflowed its maximum size of %d stops and has been truncated!\n", current_paddle_num, MAX_PADDLE_SIZE);
-            break;
-        }
-    
-        strip_crlf(buffer);	//get rid of any trailing CR/LF characters
-    
-        n++;
-        
-        i = eol = 0;
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        
-        //Skip any blank or comment lines
-        if(eol || buffer2[0] == '#') { continue; }
-        
-        //Clear this row
-        memset(current_paddle + current_paddle_len, 0, sizeof(stop));
-        
-        current_paddle[current_paddle_len].hour = strtol(buffer2, NULL, 10);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].min = strtol(buffer2, NULL, 10);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].lat = strtod(buffer2, NULL);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].lon = strtod(buffer2, NULL);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].route = strtol(buffer2, NULL, 10);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].trip = strtol(buffer2, NULL, 10);
-        
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
-        current_paddle[current_paddle_len].stop = strtol(buffer2, NULL, 10);
-
-        i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
-        strncpy(current_paddle[current_paddle_len].name, buffer2, STOP_NAME_LEN - 1);
-        
-        current_paddle_len++;
+      fprintf(stderr, "Paddle %d has overflowed its maximum size of %d stops and has been truncated!\n", current_paddle_num, MAX_PADDLE_SIZE);
+      break;
     }
-    fclose(f);
 
-    return paddlenum;
+    strip_crlf(buffer);	//get rid of any trailing CR/LF characters
+
+    n++;
+
+    i = eol = 0;
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+
+    //Skip any blank or comment lines
+    if(eol || buffer2[0] == '#') { continue; }
+
+    //Clear this row
+    memset(current_paddle + current_paddle_len, 0, sizeof(stop));
+
+    current_paddle[current_paddle_len].hour = strtol(buffer2, NULL, 10);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].min = strtol(buffer2, NULL, 10);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].lat = strtod(buffer2, NULL);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].lon = strtod(buffer2, NULL);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].route = strtol(buffer2, NULL, 10);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].trip = strtol(buffer2, NULL, 10);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    if(eol) { printf("Line %d too short in paddle %d: \"%s\"\n", n, paddlenum, buffer); continue; }
+    current_paddle[current_paddle_len].stop = strtol(buffer2, NULL, 10);
+
+    i += get_field(buffer2, buffer + i, LINE_BUFFER_SIZE, &eol);
+    strncpy(current_paddle[current_paddle_len].name, buffer2, STOP_NAME_LEN - 1);
+
+    current_paddle_len++;
+  }
+  fclose(f);
+
+  return paddlenum;
 }
 
 int clear_paddle()
 {
-    current_paddle_num = 0;
-    current_paddle_idx = 0;
-    current_paddle_len = 0;
-    
-    return 0;
+  current_paddle_num = 0;
+  current_paddle_idx = 0;
+  current_paddle_len = 0;
+
+  return 0;
 }
 
 int where_the_hell_are_we()
 {
-    int i;
-    int found_stop = current_paddle_idx;	//by default, we will report that we are still at our last known stop
-    
-    struct tm temp;
-    time_t now;
-    time_t sched;
-    
-    now = time(NULL);
-    
-    if(current_paddle_num == 0)
-    {
-        return -1;
-    }
+  int i;
+  int found_stop = current_paddle_idx;	//by default, we will report that we are still at our last known stop
+
+  struct tm temp;
+  time_t now;
+  time_t sched;
+
+  now = time(NULL);
 
-    #ifdef ROLLOVER_FORWARD_ONLY
-        //If we are in rollover-forward mode, we will not actively re-select any previous stops, nor the current one.
-        //This allows two stops to have the same location but different route numbers for places where the route changes at a stop.
-        i = current_paddle_idx;
-    #else
-        i = 0;
-    #endif
+  if(current_paddle_num == 0)
+  {
+    return -1;
+  }
 
+  #ifdef ROLLOVER_FORWARD_ONLY
+    //If we are in rollover-forward mode, we will not actively re-select any previous stops, nor the current one.
+    //This allows two stops to have the same location but different route numbers for places where the route changes at a stop.
+    i = current_paddle_idx;
+  #else
+    i = 0;
+  #endif
 
-    for( /*see ifdef block above*/; i < current_paddle_len; i++)
+
+  for( /*see ifdef block above*/; i < current_paddle_len; i++)
+  {
+    localtime_r(&now,&temp);		//populate our time structure based on now
+                        //so the date will be correct
+
+    temp.tm_hour = current_paddle[i].hour;	//Set the expected arrival time
+    temp.tm_min = current_paddle[i].min;	//Set the expected arrival time
+
+    sched = mktime( &temp );		//and convert it back to a scheduled arrival time in UTC unix timestamp format
+
+    if( (abs(now - sched) <= ROLLOVER_TIME_WINDOW) &&	//First we do the time check, because that's cheap integer math
+      (GPS_Dist(gps_stat.lat, gps_stat.lon, current_paddle[i].lat, current_paddle[i].lon) <= ROLLOVER_DISTANCE)	//The GPS distance last because that's expensive trig
+      )
     {
-        localtime_r(&now,&temp);		//populate our time structure based on now
-                                                //so the date will be correct
-        
-        temp.tm_hour = current_paddle[i].hour;	//Set the expected arrival time
-        temp.tm_min = current_paddle[i].min;	//Set the expected arrival time
-        
-        sched = mktime( &temp );		//and convert it back to a scheduled arrival time in UTC unix timestamp format
-        
-        if( (abs(now - sched) <= ROLLOVER_TIME_WINDOW) &&	//First we do the time check, because that's cheap integer math
-            (GPS_Dist(gps_stat.lat, gps_stat.lon, current_paddle[i].lat, current_paddle[i].lon) <= ROLLOVER_DISTANCE)	//The GPS distance last because that's expensive trig
-          )
-        {
-            found_stop = i;			//update our found_stop index to the matching stop
-            
-            #ifndef ROLLOVER_TO_FURTHEST_STOP
-            
-                break;				//if ROLLOVER_TO_FURTHEST_STOP is NOT defined, we break as soon as 
-                                                //we've found ANY matching stop (even the one we started at)
-            #endif
-        }
+      found_stop = i;			//update our found_stop index to the matching stop
+
+      #ifndef ROLLOVER_TO_FURTHEST_STOP
+
+        break;				//if ROLLOVER_TO_FURTHEST_STOP is NOT defined, we break as soon as
+                        //we've found ANY matching stop (even the one we started at)
+      #endif
     }
+  }
 
-    return found_stop;				//Return found_stop
+  return found_stop;				//Return found_stop
 }
 
 int send_status_update()
 {
-    struct message_record outgoing_msg;
-    stop_status current = {0};
-    
-    if(commhub_fd < 0)
-    {
-        return -1;
-    }
-    
-    current.paddle = current_paddle_num;
-    
-    if(current_paddle_num)
-    {
-        current.route = current_paddle[current_paddle_idx].route;
-        current.trip = current_paddle[current_paddle_idx].trip;
-        current.stop = current_paddle[current_paddle_idx].stop;
+  struct message_record outgoing_msg;
+  stop_status current = {0};
 
-        current.lat = current_paddle[current_paddle_idx].lat;
-        current.lon = current_paddle[current_paddle_idx].lon;
+  if(commhub_fd < 0)
+  {
+    return -1;
+  }
 
-        strncpy(current.stopname, current_paddle[current_paddle_idx].name, STOP_NAME_LEN - 1);
-    }
-    
-    prepare_message(&outgoing_msg, MAILBOX_STOP_STATUS, &current, sizeof(current));
-    return send_message(commhub_fd, &outgoing_msg);    
+  current.paddle = current_paddle_num;
+
+  if(current_paddle_num)
+  {
+    current.route = current_paddle[current_paddle_idx].route;
+    current.trip = current_paddle[current_paddle_idx].trip;
+    current.stop = current_paddle[current_paddle_idx].stop;
+
+    current.lat = current_paddle[current_paddle_idx].lat;
+    current.lon = current_paddle[current_paddle_idx].lon;
+
+    strncpy(current.stopname, current_paddle[current_paddle_idx].name, STOP_NAME_LEN - 1);
+  }
+
+  prepare_message(&outgoing_msg, MAILBOX_STOP_STATUS, &current, sizeof(current));
+  return send_message(commhub_fd, &outgoing_msg);
 }
 
 //This function sends an update to the driver and to the diagnostic log saying we're doing a stop rollover
 int send_driver_update()
 {
-    struct message_record outgoing_msg;
-    
-    if(commhub_fd < 0)
-    {
-        return -1;
-    }
+  struct message_record outgoing_msg;
 
-    if(current_paddle_num)
-    {
-        format_log_message(&outgoing_msg, LOGLEVEL_DEBUG, "%02d:%02d %s", current_paddle[current_paddle_idx].hour, current_paddle[current_paddle_idx].min, current_paddle[current_paddle_idx].name);
-        send_message(commhub_fd, &outgoing_msg);
-    
-        format_driver_message(&outgoing_msg, LOGLEVEL_EVENT, "%02d:%02d %s", current_paddle[current_paddle_idx].hour, current_paddle[current_paddle_idx].min, current_paddle[current_paddle_idx].name);
-        return send_message(commhub_fd, &outgoing_msg);    
-    }
-    
-    return -1;    
+  if(commhub_fd < 0)
+  {
+    return -1;
+  }
+
+  if(current_paddle_num)
+  {
+    format_log_message(&outgoing_msg, LOGLEVEL_DEBUG, "%02d:%02d %s", current_paddle[current_paddle_idx].hour, current_paddle[current_paddle_idx].min, current_paddle[current_paddle_idx].name);
+    send_message(commhub_fd, &outgoing_msg);
+
+    format_driver_message(&outgoing_msg, LOGLEVEL_EVENT, "%02d:%02d %s", current_paddle[current_paddle_idx].hour, current_paddle[current_paddle_idx].min, current_paddle[current_paddle_idx].name);
+    return send_message(commhub_fd, &outgoing_msg);
+  }
+
+  return -1;
 }
 
 int send_vault_drop()
 {
-    struct message_record outgoing_msg;
-    
-    if(commhub_fd < 0)
-    {
-        return -1;
-    }
+  struct message_record outgoing_msg;
+
+  if(commhub_fd < 0)
+  {
+    return -1;
+  }
 
-    prepare_message(&outgoing_msg, MAILBOX_VAULT_DROP, "", 0);
-    return send_message(commhub_fd, &outgoing_msg);    
+  prepare_message(&outgoing_msg, MAILBOX_VAULT_DROP, "", 0);
+  return send_message(commhub_fd, &outgoing_msg);
 }
 
 
 
 message_callback_return handle_status_req(struct message_record *msg, void *param)
 {
-    send_status_update();
-    return MESSAGE_HANDLED_CONT;
+  send_status_update();
+  return MESSAGE_HANDLED_CONT;
 }
 
 message_callback_return handle_gps_update(struct message_record *msg, void *param)
 {
-    int tempidx;
-    
-    //The system callback will have already handled this message and put it into the correct data structure
-    
-    //If either we have no current paddle, or no real GPS data, ignore this message
-    if( (!current_paddle_num) || (!gps_stat.gps_good) )
-    {
-        return MESSAGE_HANDLED_CONT;
-    }
-    
-    tempidx = where_the_hell_are_we();
-    
-    if(tempidx < 0)
-    {
-        return MESSAGE_HANDLED_CONT;
-    }
-    
-    if(tempidx != current_paddle_idx)
-    {
-        current_paddle_idx = tempidx;
-        send_status_update();
-        send_driver_update();
-        send_vault_drop();
-    }
-    
+  int tempidx;
+
+  //The system callback will have already handled this message and put it into the correct data structure
+
+  //If either we have no current paddle, or no real GPS data, ignore this message
+  if( (!current_paddle_num) || (!gps_stat.gps_good) )
+  {
+    return MESSAGE_HANDLED_CONT;
+  }
+
+  tempidx = where_the_hell_are_we();
+
+  if(tempidx < 0)
+  {
     return MESSAGE_HANDLED_CONT;
+  }
+
+  if(tempidx != current_paddle_idx)
+  {
+    current_paddle_idx = tempidx;
+    send_status_update();
+    send_driver_update();
+    send_vault_drop();
+  }
+
+  return MESSAGE_HANDLED_CONT;
 }
 
 message_callback_return handle_next_req(struct message_record *msg, void *param)
 {
-    if(current_paddle_idx < (current_paddle_len - 1))
-    {
-        current_paddle_idx++;  
-        send_driver_update();
-    }
-
-    send_status_update();
-    return MESSAGE_HANDLED_CONT;
+  if(current_paddle_idx < (current_paddle_len - 1))
+  {
+    current_paddle_idx++;
+    send_driver_update();
+  }
+
+  send_status_update();
+  return MESSAGE_HANDLED_CONT;
 }
 
 message_callback_return handle_prev_req(struct message_record *msg, void *param)
 {
-    if(current_paddle_idx > 0)
-    {
-        current_paddle_idx--;  
-        send_driver_update();
-    }
-
-    send_status_update();
-    return MESSAGE_HANDLED_CONT;
+  if(current_paddle_idx > 0)
+  {
+    current_paddle_idx--;
+    send_driver_update();
+  }
+
+  send_status_update();
+  return MESSAGE_HANDLED_CONT;
 }
 
 message_callback_return handle_set_paddle_req(struct message_record *msg, void *param)
 {
-    struct message_record outgoing_msg;
-    set_paddle_req *req = (set_paddle_req *)msg->payload;
+  struct message_record outgoing_msg;
+  set_paddle_req *req = (set_paddle_req *)msg->payload;
 
-    clear_paddle();
-    req->result = load_paddle(req->request);  
+  clear_paddle();
+  req->result = load_paddle(req->request);
 
-    if(req->result > 0)
-    {
-        send_driver_update();
-    }
+  if(req->result > 0)
+  {
+    send_driver_update();
+  }
 
-    prepare_message(&outgoing_msg, MAILBOX_PADDLE_ACK, req, sizeof(set_paddle_req));
-    send_message(commhub_fd, &outgoing_msg);    
+  prepare_message(&outgoing_msg, MAILBOX_PADDLE_ACK, req, sizeof(set_paddle_req));
+  send_message(commhub_fd, &outgoing_msg);
 
-    send_status_update();
-    return MESSAGE_HANDLED_CONT;
+  send_status_update();
+  return MESSAGE_HANDLED_CONT;
 }
 
 
 void maintain_ipc_hub_connect(char *progname)
 {
-    struct message_record outgoing_msg;
+  struct message_record outgoing_msg;
+
+  if(commhub_fd < 0)	//if we have no connection to the communication hub
+  {
+    commhub_fd = connect_to_message_server(progname);	//try and get one
 
-    if(commhub_fd < 0)	//if we have no connection to the communication hub
+//    printf("commhub_fd = %d\n", commhub_fd);
+
+    if(commhub_fd >= 0)	//if it worked
     {
-        commhub_fd = connect_to_message_server(progname);	//try and get one
-            
-//        printf("commhub_fd = %d\n", commhub_fd);
-            
-        if(commhub_fd >= 0)	//if it worked
-        {
-            //Subscribe to the command mailboxes we act on
-            prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_SET_PADDLE, strlen(MAILBOX_SET_PADDLE));
-            send_message(commhub_fd,&outgoing_msg);  
-                
-            prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_NEXT_STOP, strlen(MAILBOX_NEXT_STOP));
-            send_message(commhub_fd,&outgoing_msg);  
-                
-            prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_PREV_STOP, strlen(MAILBOX_PREV_STOP));
-            send_message(commhub_fd,&outgoing_msg);  
-                
-            //Subscribe to the relevant status management mailboxes
-            subscribe_to_default_messages(commhub_fd);
-                            
-            //Request updated status information...
-            prepare_message(&outgoing_msg, MAILBOX_STATUS_REQUEST, "", 0);		
-            send_message(commhub_fd,&outgoing_msg);
-        }
+      //Subscribe to the command mailboxes we act on
+      prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_SET_PADDLE, strlen(MAILBOX_SET_PADDLE));
+      send_message(commhub_fd,&outgoing_msg);
+
+      prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_NEXT_STOP, strlen(MAILBOX_NEXT_STOP));
+      send_message(commhub_fd,&outgoing_msg);
+
+      prepare_message(&outgoing_msg, MAILBOX_SUBSCRIBE, MAILBOX_PREV_STOP, strlen(MAILBOX_PREV_STOP));
+      send_message(commhub_fd,&outgoing_msg);
+
+      //Subscribe to the relevant status management mailboxes
+      subscribe_to_default_messages(commhub_fd);
+
+      //Request updated status information...
+      prepare_message(&outgoing_msg, MAILBOX_STATUS_REQUEST, "", 0);		
+      send_message(commhub_fd,&outgoing_msg);
     }
+  }
 }
 
 
 int main(int argc, char **argv)
 {
-    struct pollfd fds[2];
-    int nfds = 0;
-    int poll_return = 0;
-    int read_return = 0;
+  struct pollfd fds[2];
+  int nfds = 0;
+  int poll_return = 0;
+  int read_return = 0;
+
+  int i;
+
+  struct message_record incoming_msg;
+
+  configure_signal_handlers(argv[0]);
+  maintain_ipc_hub_connect(argv[0]);
+
+  //Register our default keep-up-with-system status callbacks
+  register_system_status_callbacks();
+
+  //Add our module-specific callbacks
+  register_dispatch_callback(MAILBOX_GPS_STATUS, CALLBACK_USER(1), handle_gps_update, NULL);
+  register_dispatch_callback(MAILBOX_STATUS_REQUEST, CALLBACK_USER(2), handle_status_req, NULL);
+  register_dispatch_callback(MAILBOX_SET_PADDLE, CALLBACK_USER(3), handle_set_paddle_req, NULL);
+  register_dispatch_callback(MAILBOX_NEXT_STOP, CALLBACK_USER(4), handle_next_req, NULL);
+  register_dispatch_callback(MAILBOX_PREV_STOP, CALLBACK_USER(5), handle_prev_req, NULL);
 
-    int i;
+  while( exit_request_status == EXIT_REQUEST_NONE ) {
 
-    struct message_record incoming_msg;
+    RESET_WATCHDOG();
+
+    //DEBUG
+    printf("[%lli] paddlemgr: heartbeat\n", get_usec_time());
+    //DEBUG
 
-    configure_signal_handlers(argv[0]);
     maintain_ipc_hub_connect(argv[0]);
-    
-    //Register our default keep-up-with-system status callbacks
-    register_system_status_callbacks();
-    
-    //Add our module-specific callbacks
-    register_dispatch_callback(MAILBOX_GPS_STATUS, CALLBACK_USER(1), handle_gps_update, NULL);
-    register_dispatch_callback(MAILBOX_STATUS_REQUEST, CALLBACK_USER(2), handle_status_req, NULL);
-    register_dispatch_callback(MAILBOX_SET_PADDLE, CALLBACK_USER(3), handle_set_paddle_req, NULL);
-    register_dispatch_callback(MAILBOX_NEXT_STOP, CALLBACK_USER(4), handle_next_req, NULL);
-    register_dispatch_callback(MAILBOX_PREV_STOP, CALLBACK_USER(5), handle_prev_req, NULL);
-    
-    while( exit_request_status == EXIT_REQUEST_NONE )
+
+    nfds=0;
+
+    if(commhub_fd >= 0)
     {
-        RESET_WATCHDOG();
-    
-        maintain_ipc_hub_connect(argv[0]);
-        
-        nfds=0;
-        
-        if(commhub_fd >= 0)
-        {
-            fds[nfds].fd = commhub_fd;
-            fds[nfds].events = POLLIN;
-            nfds++;
-        }
-        
-        if(nfds > 0)
-        {
-            poll_return = poll(fds, nfds, POLL_TIMEOUT);
-        }
-        else
-        {
-            usleep(POLL_TIMEOUT * 1000);
-            poll_return = 0;
-        }
+      fds[nfds].fd = commhub_fd;
+      fds[nfds].events = POLLIN;
+      nfds++;
+    }
+
+    if(nfds > 0)
+    {
+      poll_return = poll(fds, nfds, POLL_TIMEOUT);
+    }
+    else
+    {
+      usleep(POLL_TIMEOUT * 1000);
+      poll_return = 0;
+    }
+
+    if(poll_return <= 0)
+    {
+      continue;
+    }
+
+    //----  If we got a message
 
-        if(poll_return <= 0)
+    for(i=0; i < nfds; i++)
+    {
+      if( fds[i].fd == commhub_fd )
+      {	
+        //If we've lost connection, break this loop and poll all over again
+        if(fds[i].revents & (POLLERR | POLLHUP | POLLNVAL))	
         {
-            continue;
+          close(commhub_fd);
+          commhub_fd = -1;
+          break;
         }
-        
-        //----  If we got a message
-        
-        for(i=0; i < nfds; i++)
+
+        if(fds[i].revents & POLLIN)
         {
-            if( fds[i].fd == commhub_fd )
-            {	
-                //If we've lost connection, break this loop and poll all over again
-                if(fds[i].revents & (POLLERR | POLLHUP | POLLNVAL))	
-                {
-                    close(commhub_fd);
-                    commhub_fd = -1;
-                    break;
-                }
-                
-                if(fds[i].revents & POLLIN)
-                {
-                    read_return = get_message(commhub_fd, &incoming_msg);
-                
-                    if( read_return < 0 )
-                    {
-                        close(commhub_fd);
-                        commhub_fd = -1;
-                        break;
-                    }
-                
-                    process_message(&incoming_msg);	//This passes the received message through the callback list
-                    
-                }
-                
-            }
-            
+          read_return = get_message(commhub_fd, &incoming_msg);
+
+          if( read_return < 0 )
+          {
+            close(commhub_fd);
+            commhub_fd = -1;
+            break;
+          }
+
+          process_message(&incoming_msg);	//This passes the received message through the callback list
+
         }
-    
-    }
-    
-    if(commhub_fd >= 0)
-    {
-        close(commhub_fd);
+
+      }
+
     }
 
-    printf("Goodbye.\n");
-    
-    return 0;    
+  }
+
+  if(commhub_fd >= 0)
+  {
+    close(commhub_fd);
+  }
+
+  printf("Goodbye.\n");
+
+  return 0;
 }
 
 

+ 1 - 1
busunit/scripts/route_announce_minder.sh

@@ -5,7 +5,7 @@ pfx="stdbuf -i0 -o0 -e0"
 amixer cset numid=3 1
 
 $pfx /home/bus/bin/debug_client -m DRIVER_NOTIFY | \
-  $pfx grep -P '|\d+:\d+ ' | \
+  $pfx grep -P '\|\d+:\d+ ' | \
   $pfx cut -f2 -d'|' | \
   $pfx cut -f2- -d' ' | \
   $pfx tr -d '"' | \