/[maps]/lib/NMEA.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/NMEA.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

NMEA.pm revision 14 by dpavlin, Mon Dec 3 14:25:40 2007 UTC lib/NMEA.pm revision 26 by dpavlin, Fri Dec 7 03:03:42 2007 UTC
# Line 16  sub hhmm { Line 16  sub hhmm {
16  }  }
17    
18  my $got_it;  my $got_it;
19    my $stats;
20    
21  sub line {  sub line {
22          my $self = shift;          my $self = shift;
# Line 25  sub line { Line 26  sub line {
26                  chomp;                  chomp;
27                  my @a = split(/,/,$_);                  my @a = split(/,/,$_);
28    
29  #               next unless $#a == 12;                  return unless $#a == 12;
30    
31                  warn "## [$#a] ", join(' ',  #               warn "## [$#a] ", join(' ', map { "$_:$a[$_]" } ( 0 .. $#a )), " from $_\n";
                         map { "$_:$a[$_]" }  
                         ( 0 .. $#a )  
                 ), " from $_\n";  
32    
33                  # is valid?                  # is valid?
34                  return unless $a[2] eq 'A';                  return unless $a[2] eq 'A';
# Line 42  sub line { Line 40  sub line {
40                  / );                  / );
41    
42                  $hash->{lat} = hhmm( ( $hash->{lat_ns} eq 'S' ? -1 : 1 ) * $hash->{lat_hhmm} ) || return;                  $hash->{lat} = hhmm( ( $hash->{lat_ns} eq 'S' ? -1 : 1 ) * $hash->{lat_hhmm} ) || return;
43                  $hash->{lon} = hhmm( ( $hash->{lon_ns} eq 'W' ? -1 : 1 ) * $hash->{lon_hhmm} ) || return;                  $hash->{lon} = hhmm( ( $hash->{lon_ew} eq 'W' ? -1 : 1 ) * $hash->{lon_hhmm} ) || return;
44    
45                  return if ( $got_it->{ $hash->{lat} . ' ' . $hash->{lon} }++ );                  return if ( $got_it->{ $hash->{lat} . ' ' . $hash->{lon} }++ );
46    
47                  warn "##>>>> ",dump( $hash );  #               warn "##>>>> ",dump( $hash );
48                  return $hash;                  return $hash;
49          }          }
50    

Legend:
Removed from v.14  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26