Changes in / [2cf9b0b:1d2acb7]


Ignore:
Location:
src
Files:
7 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • src/daemon/gnuboat

    r2cf9b0b r1d2acb7  
    11#!/usr/bin/python
    2 # -*- coding: utf-8 -*-
    32'''
    43    Copyright (C) 2016 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
    … …  
    2322import time
    2423import threading
    25 import re
    26 import os
    27 import dateutil.parser
    28 import datetime
    29 from pytz import timezone
    30 import pytz
    31 import getopt
    32 import sys
    33 from EPD import EPD
    34 from PIL import Image
    35 from PIL import ImageDraw
    36 from PIL import ImageFont
     24import os.path
    3725
    38 WHITE=1
    39 BLACK=0
    40 marginVertical = 10
    41 marginHorizontal = marginVertical
    42 
    43 # default values for command line arguments
    44 rrdfile = "/var/www/html/webservice/data/log-webservice.rrd"
    45 shutdownfile = "/var/spool/gnuboat/shutdown.request"
    46 logperiod = 1
    47 displayperiod = 5
    48 
    49 shutdownRequested = None
     26rrdFile = "/home/jlan11/public_html/gnuboat/webservice/data/log-webservice.rrd"
     27logPeriod = 1
    5028
    5129# Copied from https://gist.github.com/wolfg1969/4653340
    … …  
    7351   
    7452  def run(self):
    75     global logperiod
    7653    try:
    7754      while self._running:
    7855        self._currentValue = self._session.next()
    79         time.sleep(float(logperiod)/2.0)
     56        time.sleep(float(logPeriod)/2.0)
    8057    except StopIteration:
    8158      pass
    8259
    83 def createDatabase(databaseFile):
     60def createDatabase(databaseFile)
    8461  rrdDataSources = [ 'DS:latitude:GAUGE:15:-90:90',
    8562                     'DS:longitude:GAUGE:15:-180:180',
    … …  
    9774
    9875  if not os.path.isfile(databaseFile):
    99     rrdtool.create(databaseFile,
     76    rrdtool.create(rrdFile,
    10077                   "--start",
    10178                   "N",
    … …  
    10582                   rrdArchives)
    10683
    107 def displayValues(epd, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix):
    108   # requires dejavu package!!!!
    109   fontValues = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 34)
    110   fontTitles = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24)
    111 
    112   # initially set all white background
    113   image = Image.new('1', epd.size, WHITE)
    114   width, height = image.size
    115 
    116   rowHeightTitles = 25
    117   rowHeightValues = float(height - 2 * rowHeightTitles - 3 * marginVertical) / 2.0
    118   columnWidthUnit = 30
    119   columnWidthValues = int(float(width - 3 * marginHorizontal - 2 * columnWidthUnit) / 2.0)
    120 
    121   draw = ImageDraw.Draw(image)
    122   # draw.rectangle((0, 0, width, height), fill=WHITE, outline=WHITE)
    123 
    124   x = marginHorizontal
    125   y = marginVertical
    126   draw.text((x, y), "STW", fill=BLACK, font=fontTitles)
    127   draw.text((x, y + rowHeightTitles), str(speedThroughWater), fill=BLACK, font=fontValues)
    128   draw.text((x + columnWidthValues, y + rowHeightTitles * 1.4), "kts", fill=BLACK, font=fontTitles)
    129 
    130   x = x + marginHorizontal + columnWidthValues + columnWidthUnit
    131   draw.text((x, y), "SOG", fill=BLACK, font=fontTitles)
    132   draw.text((x, y + rowHeightTitles), str(speedOverGround), fill=BLACK, font=fontValues)
    133   draw.text((x + columnWidthValues, y + rowHeightTitles * 1.4), "kts", fill=BLACK, font=fontTitles)
    134 
    135   x = marginHorizontal
    136   y = y + rowHeightTitles + rowHeightValues + marginVertical
    137   draw.text((x, y), "Depth", fill=BLACK, font=fontTitles)
    138   draw.text((x, y + rowHeightTitles), str(waterDepth), fill=BLACK, font=fontValues)
    139   draw.text((x + int(float(columnWidthValues) / 1.5), y + rowHeightTitles * 1.4), "m", fill=BLACK, font=fontTitles)
    140 
    141   x = x + marginHorizontal + columnWidthValues + columnWidthUnit
    142   draw.text((x, y), "Water", fill=BLACK, font=fontTitles)
    143   draw.text((x, y + rowHeightTitles), str(waterTemperature), fill=BLACK, font=fontValues)
    144   draw.text((x + int(float(columnWidthValues) / 1.5), y + rowHeightTitles * 1.4), "C", fill=BLACK, font=fontTitles)
    145 
    146   x = int((x + marginHorizontal + columnWidthValues) * 0.93)
    147   draw.text((x, y), "Fix", fill=BLACK, font=fontTitles)
    148   draw.text((x, y + rowHeightTitles), str(gpsFix), fill=BLACK, font=fontValues)
    149  
    150   epd.display(image)
    151   epd.update()
    152 
    153 def checkShutdownRequest(shutdownFile):
    154   global shutdownRequested
    155   # have look for new shutdown requests
    156   if os.path.isfile(shutdownFile):
    157     with open(shutdownFile, "r") as fileHandler:
    158       shutdownStart = fileHandler.read().strip()
    159     os.remove(shutdownFile)
    160     shutdownRequested = dateutil.parser.parse(shutdownStart)
    161   # check existing shutdown requests
    162   if shutdownRequested is not None:
    163     currentTime = datetime.datetime.now()
    164     currentTime = currentTime.replace(tzinfo=pytz.utc)
    165     if (currentTime - shutdownRequested) > datetime.timedelta(seconds = 0):
    166       os.system("sudo shutdown -h now")
    167 
    168 def usage():
    169   print "Usage of gnuboat daemon:"
    170   print "  gnuboat -r PATH_TO_RRD_DATABAE_FILE -s PATH_TO_SHUTDOWN_REQUEST_FILE [-l [LOG_UPDATE_PERIOD] [-d DISPLAY_UPDATE_PERIOD]"
    171   print ""
    172   print "  -h --help              Display this help"
    173   print "  -r --rrdfile           Path to the rrd database used by the webservice to serve the clients"
    174   print "  -s --shutdownfile      Path to the shutdown request file, used by the webservice to request a shutdown of the system running gnuboat"
    175   print "  -l --logperiod         Time in seconds to update the logs"
    176   print "  -d --displayperiod     Timein seconds to update the display"
    177 
    178 def main(argv):
    179   global rrdfile
    180   global shutdownfile
    181   global logperiod
    182   global displayperiod
    183 
    184   try:                               
    185     opts, args = getopt.getopt(argv, "hr:s:l:d:", ["help", "rrdfile=", "shutdownfile=", "logperiod=", "displayperiod="])
    186   except getopt.GetoptError:           
    187     usage()                         
    188     sys.exit(2)
    189 
    190   for option, argument in opts:
    191     if option == ("-h", "--help"):
    192       usage()
    193       sys.exit()
    194     elif option in ("-r", "--rrdfile"):
    195        rrdfile = argument
    196     elif option in ("-s", "--shutdownfile"):
    197       shutdownfile = argument
    198     elif option in ("-l", "--logperiod"):
    199       logperiod = argument
    200     elif option in ("-d", "--displayperiod"):
    201       displayperiod = argument
    202     else:
    203       assert False, "unhandled option"
    204 
    205   if not os.path.exists(os.path.dirname(rrdfile)):
    206     print "rrd database directory not found %s" % os.path.dirname(rrdfile)
    207     print ""
    208     usage()
    209     sys.exit(2)
    210 
    211   if not os.path.exists(os.path.dirname(shutdownfile)):
    212     print "Shutdown request directory not found %s" % os.path.dirname(shutdownfile)
    213     print ""
    214     usage()
    215     sys.exit(2)
    216 
    217   if logperiod < 1:
    218     print "Log period must be >= 1"
    219     print ""
    220     usage()
    221     sys.exit(2)
    222 
    223   if displayperiod < 1 or displayperiod < logperiod:
    224     print "Display period must be >= 1 and could not be faster than log period"
    225     print ""
    226     usage()
    227     sys.exit(2)
    228 
    229   createDatabase(rrdfile)
    230 
    231   epd = EPD()
    232   epd.clear()
     84if __name__ == '__main__':
     85  createDatabase(rrdFile)
    23386
    23487  gpsp = GpsdPoller()
    23588  try:
    23689    gpsp.start()
     90    print "Collecting data..."
    23791    # gpsp now polls every .2 seconds for new data, storing it in self.current_value
    23892    while True:
    239       # In the main thread, every logPeriod seconds print the current value
    240       time.sleep(logperiod)
     93      # In the main thread, every 5 seconds print the current value
     94      time.sleep(logPeriod)
    24195      latitude = gpsp.latitude()
    24296      longitude = gpsp.longitude()
    … …  
    246100      waterTemperature = random.randrange(15, 25) + 0.5;
    247101      gpsFix = gpsp.gpsFix()
    248      
    249       # update rrd database for the webservice
    250       rrdtool.update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s" % (latitude, longitude, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix))
    251       # update display, if needed
    252       if round(time.time(),0) % displayperiod == 0:
    253         displayValues(epd, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix)
    254       #check for shutdown request
    255       checkShutdownRequest(shutdownfile)
     102      rrdtool.update(rrdFile, "N:%s:%s:%s:%s:%s:%s:%s" % (latitude, longitude, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix))
    256103       
    257104  except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
     105    print "\nKilling Thread..."
    258106    gpsp.stop()
    259107    gpsp.join() # wait for the thread to finish what it's doing
    260 
    261 if __name__ == "__main__":
    262   main(sys.argv[1:])
     108  print "Done.\nExiting."
  • src/puppetcode/environments/test/hieradata/common.yaml

    r2cf9b0b r1d2acb7  
    44  - gnuboat_epd
    55  - gnuboat_gpsd
    6   - gnuboat_gnuboat
    76
    87gnuboat_lighttpd::status: 'running'
    … …  
    1110gnuboat_epd::service::enabled: true
    1211gnuboat_epd::service::display_size: '2.7'
    13 gnuboat_epd::service::exec_start_post: '/usr/bin/gnuboat-splashscreen -i /home/pi/gnuboat/src/icon/gnuboat-170.png'
    14 gnuboat_epd::service::exec_stop_pre: '/usr/bin/gnuboat-splashscreen -i /home/pi/gnuboat/src/icon/gnuboat-170.png'
    1512gnuboat_epd::install::panel: 'v230-g2'
    1613gnuboat_gpsd::service::status: 'running'
  • src/puppetcode/environments/test/modules/gnuboat_epd/manifests/service.pp

    r2cf9b0b r1d2acb7  
    33        Enum['running', 'stopped'] $status = 'running',
    44        Boolean $enabled = true,
    5         String $options = '-o allow_other -o default_permissions',
    6         String $mount_point = '/dev/epd',
    7         String $display_size = '2.7',
    8         String $exec_start_post = '', # Could be set to a script to display a welcome screen, after starting epd-fuse service
    9         String $exec_stop_pre = '', # Could be set to a script to display a good by screen, before stopping epd-fuse service
     5        String $display_size = '2.7'
    106)
    117inherits gnuboat_epd
    … …  
    1814
    1915
    20 #       Only needed by initd script, which is not supported by the debian package right now
    21 #       file{'/etc/default/epd-fuse':
    22 #               ensure => present,
    23 #               owner => 'root',
    24 #               group => 'root',
    25 #               mode => '0600',
    26 #               notify => Service['epd-fuse'],
    27 #               content => epp('gnuboat_epd/epd-fuse.epp',
    28 #               {
    29 #                       'display_size' => $display_size,
    30 #               }),
    31 #       }
    32 
    33         file{'/etc/systemd/system':
    34                 ensure => 'directory',
    35                 owner => 'root',
    36                 group => 'root',
    37                 mode => '0750',
    38         }
    39 
    40         file{'/etc/systemd/system/epd-fuse.service':
     16        file{'/etc/default/epd-fuse':
    4117                ensure => present,
    4218                owner => 'root',
    … …  
    4420                mode => '0600',
    4521                notify => Service['epd-fuse'],
    46                 content => epp('gnuboat_epd/epd-fuse.service.epp',
     22                content => epp('gnuboat_epd/epd-fuse.epp',
    4723                {
    48                         'options' => $options,
    49                         'mount_point' => $mount_point,
    5024                        'display_size' => $display_size,
    51                         'exec_start_post' => $exec_start_post,
    52                         'exec_stop_pre' => $exec_stop_pre,
    5325                }),
    5426        }
  • src/puppetcode/environments/test/modules/gnuboat_epd/templates/epd-fuse.epp

    r2cf9b0b r1d2acb7  
    11# Options to pass to epd_fuse
    2 #EPD_MOUNTPOINT=<%= $mount_point %>
    3 EPD_SIZE=<%= $display_size %>
    4 EPD_OPTS=<%= $options %>
     2#EPD_MOUNTPOINT=/dev/epd
     3EPD_SIZE=<%= display_size %>
     4EPD_OPTS='-o allow_other -o default_permissions'
  • src/puppetcode/environments/test/modules/gnuboat_lighttpd/manifests/init.pp

    r2cf9b0b r1d2acb7  
    22(
    33        String $version = 'latest',
    4         Boolean $enable_php = true,
    54)
    65{
    76        contain gnuboat_lighttpd::install
    8         contain gnuboat_lighttpd::config
    97        contain gnuboat_lighttpd::service
    108
    119        Class['gnuboat_lighttpd::install'] ->
    12         Class['gnuboat_lighttpd::config'] ->
    1310        Class['gnuboat_lighttpd::service']
    1411}
  • src/puppetcode/environments/test/modules/gnuboat_lighttpd/manifests/install.pp

    r2cf9b0b r1d2acb7  
    55                notify => Service['lighttpd'],
    66        }
    7 
    8         if $enable_php {
    9                 package{'php5-cgi':
    10                         ensure => $version,
    11                 }
    12         }
    137}
  • src/webapp/webclient/css/main.css

    r2cf9b0b r1d2acb7  
    1818body {
    1919        margin: 1em;
    20         width: 58.3mm;
    2120}
    2221
    … …  
    3635#display {
    3736        background-color: #E6E6E6;
    38         width: 100%;
     37        width: 58.3mm;
    3938        height: 38.2mm;
    4039        font-size: 12pt;
    … …  
    9594
    9695#map {
    97         width: 100%;
     96        width: 58.3mm;
    9897        height: 76mm;
    9998        border: 1px solid black;
    … …  
    112111form p input {
    113112        border: 1px solid #ACDFAC;
    114         height: 3em;
    115         width: 100%;
     113        height: 2em;
     114        width: 58.3mm;
    116115}
    117116
    118117.formButtons {
    119         text-align: center;
    120         margin-top: 2em;
     118        text-align: right;
     119        margin-right: 5em;
     120        margin-top: 1em;
    121121}
    122122
    123123.button {
    124124        border: 0;
    125         height: 3em;
    126         width: 100%;
     125        height: 2em;
     126        width: 10em;
    127127        background-repeat: no-repeat;
    128128        background-position: 0.5em 0.25em;
    … …  
    133133
    134134}
    135 
    136 #shutdown {
    137         width: 100%;
    138         margin-top: 3em;
    139 }
    140 
    141 #shutdown button {
    142         background-color: #8C1C00;
    143         color: white;
    144         font-weight: bold;
    145         font-size: 24pt;
    146         width: 100%;
    147         height: 3em;
    148 }
  • src/webapp/webclient/javascript/main.js

    r2cf9b0b r1d2acb7  
    102102}
    103103
    104 function shutdown(){
    105         $.getJSON("../webservice/?request=shutdown", function(data){
    106                 var shutdownTime = data["shutdownstart"];
    107                 var shutdownDate = Date.parse(shutdownTime);
    108                 var currentDate = new Date();
    109                 var shutdownHint = "Shutting down in "+ Math.floor((shutdownDate - currentDate)/1000) +"s at "+ shutdownTime.toLocaleString();
    110                 if(shutdownTime == -1){
    111                         shutdownHint = "Failed to initiate shutdown!";
    112                 }
    113                 $("#shutdownMessage").text(shutdownHint);
    114         });
    115 }
    116 
    117104$(document).ready(function() {
    118105        displayDataGet();
    … …  
    120107       
    121108        $.getJSON("../webservice/tileserver.php?/map.json", mapSetup);
    122        
    123         $("#shutdownButton").click(shutdown);
    124109});
  • src/webapp/webclient/root/index.php

    r2cf9b0b r1d2acb7  
    100100                </div>
    101101        </form>
    102         <div id="shutdown">
    103                 <p id="shutdownMessage"/>
    104                 <form>
    105                         <button type="button" id="shutdownButton">SHUTDOWN</button>
    106                 </form>
    107         </div>
    108102<?php
    109103require_once("inc/footer.php");
  • src/webapp/webservice/index.php

    r2cf9b0b r1d2acb7  
    2121$dbFile = $config->databaseFile();
    2222
    23 define("REQUEST_DATA", "data");
    24 define("REQUEST_SHUTDOWN", "shutdown");
    25 
    26 
    2723// configure roundings per value (key) and precision (value)
    2824$configRound = array
    … …  
    3632);
    3733
    38 function addRrdData($interval, $period, &$result, &$lastTime){
    39         global $dbFile;
    40         global $debug;
    41         global $configRound;
    42 
    43         $data = rrd_fetch($dbFile, array( "AVERAGE", "--resolution", $interval, "--start", "-". $period, "--end", "start+". $period));
    44         if($data === false){
    45                 echo json_encode($result);
    46                 $message = "Failure reading rrd database ". $dbFile .": ". rrd_error();
    47                 if($debug > 0)
    48                         echo $message;
    49                 else
    50                         error_log($message);
    51         }
    52 
    53         if($debug > 2){
    54                 echo "<pre>";
    55                 var_dump($data);
    56                 echo "</pre>";
    57         }
    58 
    59         $data = $data["data"];
    60 
    61         // transform them into json format
    62         $i = 0;
    63         $lastTime = -1;
    64         $keys = array_keys($data);
    65         if(count($keys) < 0 ){
    66                 error_log("No keys in fetched rrd data from ". $dbFile);
    67                 echo json_encode("");
    68                 exit;
    69         }
    70         if($debug > 0){
    71                 echo "<p>Variables: ". count($keys) ."; Timeframes: ". count($data[$keys[0]]) ."</p>\n";
    72         }
    73         for($i = 0; $i < count($data[$keys[0]]); $i++){
    74                 $time = array_keys($data[$keys[0]])[$i];
    75                 $allValid = true;
    76                 $tmp = array();
    77                 foreach($keys as $key){
    78                         if($key == "gpsfix"){
    79                                 switch($data[$key][$time]){
    80                                         case 1:
    81                                                 $tmp[$key] = "2D";
    82                                                 break;
    83                                         case 2:
    84                                                 $tmp[$key] = "3D";
    85                                                 break;
    86                                         default:
    87                                                 $tmp[$key] = "-";
    88                                 }
    89                         }
    90                         else{
    91                                 $tmp[$key] = $data[$key][$time];
    92                                 if(!is_numeric($tmp[$key]) || is_nan($tmp[$key])){
    93                                         $allValid = false;
    94                                 }
    95                                 elseif(array_key_exists($key, $configRound) && is_integer($configRound[$key]))
    96                                         $tmp[$key] = round($tmp[$key], $configRound[$key]);
    97                         }
    98                 }
    99                 // only add the timeframe to the track, if the values are valid and we had a gps fix at that time
    100                 if($allValid && $tmp["gpsfix"] != "-"){
    101                         echo "want to add ". $time ."<br/>\n";
    102                         if(!array_key_exists($time, $result["track"])){
    103                                 $result["track"][$time] = $tmp;
    104                         }
    105                         $lastTime = $time;
    106                 }
    107                 else{
    108                         if($debug > 1){
    109                                 echo "Failed <pre>";
    110                                 var_dump($tmp);
    111                                 echo "</pre>\n";
    112                         }
    113                 }
    114         }
    115 
    116         ksort($result["track"]);
    117 }
    118 
    11934$debug = 0;
    12035if(array_key_exists("debug", $_GET))
    12136        $debug = $_GET["debug"];
    12237
    123 $request = REQUEST_DATA;
    124 if(array_key_exists("request", $_GET)){
    125         $request = $_GET["request"];
    126 }
    127 
    12838if($debug == 0)
    12939        header('Content-Type: application/json');
    13040
    131 $result = array();
    132 if($request == REQUEST_SHUTDOWN){
    133         $handle = @fopen("/var/spool/gnuboat/shutdown.request", "w");
    134         if($handle === false){
    135                 $message = "Could not create file to indicate shutdown to the daemon (Timezone: ". date_default_timezone_get() .")";
    136                 if($debug > 0)
    137                         echo $message;
     41$result["lastvalid"] = array();
     42$result["track"] = array();
     43
     44// Fetch entries of the last 12hours
     45$data = rrd_fetch($dbFile, array( "AVERAGE", "--start", "-12h"));
     46if($data === false){
     47        echo json_encode($result);
     48        $message = "Could not open rrd database ". $dbFile;
     49        if($debug > 0)
     50                echo $message;
     51        else
    13852                error_log($message);
    139                 $result["shutdownstart"] = -1;
     53        exit;
     54}
     55
     56if($debug > 2){
     57        echo "<pre>";
     58        var_dump($data);
     59        echo "</pre>";
     60}
     61
     62$data = $data["data"];
     63
     64// transform them into json format
     65$i = 0;
     66$lastTime = -1;
     67$keys = array_keys($data);
     68if(count($keys) < 0 ){
     69        error_log("No keys in fetched rrd data from ". $dbFile);
     70        echo json_encode("");
     71        exit;
     72}
     73for($i = 0; $i < count($data[$keys[0]]); $i++){
     74        $time = array_keys($data[$keys[0]])[$i];
     75        $allValid = true;
     76        $tmp = array();
     77        foreach($keys as $key){
     78                if($key == "gpsfix"){
     79                        switch($data[$key][$time]){
     80                                case 1:
     81                                        $tmp[$key] = "2D";
     82                                        break;
     83                                case 2:
     84                                        $tmp[$key] = "3D";
     85                                        break;
     86                                default:
     87                                        $tmp[$key] = "-";
     88                        }
     89                }
     90                else{
     91                        $tmp[$key] = $data[$key][$time];
     92                        if(!is_numeric($tmp[$key]) || is_nan($tmp[$key])){
     93                                $allValid = false;
     94                        }
     95                        elseif(array_key_exists($key, $configRound) && is_integer($configRound[$key]))
     96                                $tmp[$key] = round($tmp[$key], $configRound[$key]);
     97                }
     98        }
     99        // only add the timeframe to the track, if the values are valid and we had a gps fix at that time
     100        if($allValid && $tmp["gpsfix"] != "-"){
     101                $result["track"][$time] = $tmp;
     102                $lastTime = $time;
    140103        }
    141104        else{
    142                 $shutdownTime = new DateTime('NOW');
    143                 $shutdownTime->modify("+15 seconds");
    144                 fwrite($handle, $shutdownTime->format(DateTime::ISO8601));
    145                 $result["shutdownstart"] = $shutdownTime->format(DateTime::ISO8601);
     105                if($debug > 0){
     106                        echo "Failed <pre>";
     107                        var_dump($tmp);
     108                        echo "</pre>\n";
     109                }
    146110        }
    147111}
    148 elseif($request == REQUEST_DATA){
    149         $result["lastvalid"] = array();
    150         $result["track"] = array();
    151 
    152         if(!file_exists($dbFile)){
    153                 echo json_encode("");
    154                 if($debug > 0)
    155                         echo "Database file ". $dbFile ." does not exist!";
    156                 error_log("Database file ". $dbFile ." does not exist");
    157                 exit;
    158         }
    159         // Fetch entries of the last 30 seconds
    160         addRrdData("5s", "30s", $result, $lastTime);
    161         if($lastTime > -1){
    162                 $result["lastvalid"] = $result["track"][$lastTime];
    163         }
    164         addRrdData("15s", "5minutes", $result, $lastTime);
    165         addRrdData("30s", "12h", $result, $lastTime);
     112if($lastTime > -1){
     113        $result["lastvalid"] = $result["track"][$lastTime];
    166114}
    167115
Note: See TracChangeset for help on using the changeset viewer.