#!/bin/sh # # $Id$ # # Convert a conventional GPSD NMEA log file to a JSON log file. # celerity=0.001 timeout= usage () { echo "usage : `basename ${0}` [-c celerity] [-t timeout] " } while /bin/true do case $1 in -c) celerity=$2 shift 2 ;; -t) timeout=$2 shift 2 ;; --) break ;; -*) usage exit 64 ;; *) break ;; esac done if test $# -ne 2 then echo "You must sepcify an input and an output file." usage exit 64 fi input=$1 output=$2 if test "$timeout" = "" then timeout=$(expr $(stat -c %s $input) / 1048576 + 10),5 fi echo '*****' gpsfake -1 -c $celerity $input '&' gpsfake -1 -c $celerity $input & gpsfake_pid=$! echo '*****' gpsclient -q -t $timeout -l $output gpsclient -q -t $timeout -l $output echo '***** gpsclient finished, killing gpsfake with PID '$gpsfake_pid'...' kill $gpsfake_pid echo '***** Waiting for gpsfake to finish...' wait echo '***** gpsfake finished, leaving.'