rs92,rs41,imet1ab,dfm,m10: output -> nmea, viking-gpsd

pull/13/head
Zilog80 2016-11-05 10:35:41 +01:00
rodzic a6aebc6dd7
commit 083bf60be5
1 zmienionych plików z 31 dodań i 9 usunięć

Wyświetl plik

@ -3,7 +3,21 @@ use strict;
use warnings; use warnings;
my $filename = $ARGV[0]; my $filename = undef;
my $date = undef;
while (@ARGV) {
if ($ARGV[0] eq "--date") {
shift @ARGV;
if (defined $ARGV[0]) {
$date = shift @ARGV;
}
}
else {
$filename = shift @ARGV;
}
}
my $fpi; my $fpi;
if (defined $filename) { if (defined $filename) {
@ -13,7 +27,6 @@ else {
$fpi = *STDIN; $fpi = *STDIN;
} }
my $fpo = *STDOUT; my $fpo = *STDOUT;
@ -25,10 +38,18 @@ my $NS; my $EW;
my $cs; my $cs;
my $str; my $str;
my $date = 271016; ## (d)dmmyy ohne fuehrende 0 (wenn log kein Datum enthaelt)
my $speed = 0.00; my $speed = 0.00;
my $course = 0.00; my $course = 0.00;
if (defined $date && $date =~ /(\d?\d\d\d\d\d)/) {
$date = $1;
}
else {
$date = 21116; ## (d)dmmyy ohne fuehrende 0 (wenn pos-log kein Datum enthaelt)
}
my $geoid = 50.0; ## GPS ueber Ellipsoid; Geoid-Hoehe in Europa ca 40-50m
while ($line = <$fpi>) { while ($line = <$fpi>) {
if ($line =~ /(\d\d):(\d\d):(\d\d\.?\d?\d?\d?).*\ +lat:\ *(-?\d*)(\.\d*)\ +lon:\ *(-?\d*)(\.\d*)\ +alt:\ *(-?\d*\.\d*).*/) { if ($line =~ /(\d\d):(\d\d):(\d\d\.?\d?\d?\d?).*\ +lat:\ *(-?\d*)(\.\d*)\ +lon:\ *(-?\d*)(\.\d*)\ +alt:\ *(-?\d*\.\d*).*/) {
@ -52,13 +73,12 @@ print STDERR $line;
$course = $2; $course = $2;
} }
$str = sprintf ("GPRMC,%010.3f,A,%08.3f,$NS,%09.3f,$EW,%.2f,%.2f,%06d,,", $hms, $lat, $lon, $speed, $course, $date); $str = sprintf("GPRMC,%010.3f,A,%08.3f,$NS,%09.3f,$EW,%.2f,%.2f,%06d,,", $hms, $lat, $lon, $speed, $course, $date);
$cs = 0; $cs = 0;
$cs ^= $_ for unpack 'C*', $str; $cs ^= $_ for unpack 'C*', $str;
printf $fpo "\$$str*%02X\n", $cs; printf $fpo "\$$str*%02X\n", $cs;
## GPS ueber Ellipsoid; Geoid-Hoehe nicht beruecksichtigt $str = sprintf("GPGGA,%010.3f,%08.3f,$NS,%09.3f,$EW,1,04,0.0,%.3f,M,%.1f,M,,", $hms, $lat, $lon, $alt-$geoid, $geoid);
$str = sprintf ("GPGGA,%010.3f,%08.3f,$NS,%09.3f,$EW,1,04,0.0,%.3f,M,0.0,M,,", $hms, $lat, $lon, $alt);
$cs = 0; $cs = 0;
$cs ^= $_ for unpack 'C*', $str; $cs ^= $_ for unpack 'C*', $str;
printf $fpo "\$$str*%02X\n", $cs; printf $fpo "\$$str*%02X\n", $cs;
@ -70,13 +90,14 @@ close $fpi;
close $fpo; close $fpo;
############################################################################################################################################# #############################################################################################################################
## ##
## term-1$ socat -d -d pty,raw,echo=0 pty,raw,b4800,echo=0 #[default baudrate 38400] ## term-1$ socat -d -d pty,raw,echo=0 pty,raw,b4800,echo=0 #[default baudrate 38400]
## N PTY is /dev/pts/12 ## N PTY is /dev/pts/12
## N PTY is /dev/pts/15 ## N PTY is /dev/pts/15
## ##
## term-2$ sox -t oss /dev/dsp -t wav - lowpass 3600 2>/dev/null | ./rs92ecc --ecc --crc --vel2 -e brdc3010.16n | ./pos2nmea.pl > /dev/pts/12 ## term-2$ sox -t oss /dev/dsp -t wav - lowpass 3600 2>/dev/null | ./rs92ecc --ecc --crc --vel2 -e brdc3010.16n | \
## ./pos2nmea.pl --date 31116 > /dev/pts/12
## ##
## term-3$ gpsd -D2 -b -n -N /dev/pts/15 ## term-3$ gpsd -D2 -b -n -N /dev/pts/15
## ##
@ -84,5 +105,6 @@ close $fpo;
## ##
## Viking: GPS-layer, Realtime Tracking Mode, gpsd-port: 2947 ## Viking: GPS-layer, Realtime Tracking Mode, gpsd-port: 2947
## ##
############################################################################################################################################# #############################################################################################################################