line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Written by Travis Kent Beste |
3
|
|
|
|
|
|
|
# Sat Aug 7 10:18:09 CDT 2010 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package BT368i::NMEA::GP::GLL; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
63
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
48
|
|
8
|
1
|
|
|
1
|
|
6
|
use vars qw( ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
89
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1049
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw( ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = sprintf("%d.%02d", q$Revision: 1.00 $ =~ /(\d+)\.(\d+)/); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#----------------------------------------# |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#----------------------------------------# |
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
21
|
0
|
|
|
|
|
|
my %args = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my %fields = ( |
24
|
|
|
|
|
|
|
log_fh => '', |
25
|
|
|
|
|
|
|
log_filename => '', |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
latitude => '', |
28
|
|
|
|
|
|
|
latitude_hemisphere => '', |
29
|
|
|
|
|
|
|
longitude => '', |
30
|
|
|
|
|
|
|
longitude_hemisphere => '', |
31
|
|
|
|
|
|
|
utc_time => '', |
32
|
|
|
|
|
|
|
data_valid => '', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $self = { |
36
|
|
|
|
|
|
|
%fields, |
37
|
|
|
|
|
|
|
}; |
38
|
0
|
|
|
|
|
|
bless $self, $class; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#----------------------------------------# |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
#----------------------------------------# |
46
|
|
|
|
|
|
|
sub print { |
47
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
print "latitude : " . $self->{latitude} . "\n"; |
50
|
0
|
0
|
|
|
|
|
if ($self->{latitude_hemisphere} eq 'N') { |
51
|
0
|
|
|
|
|
|
print "latitude_hemisphere : NORTH\n"; |
52
|
|
|
|
|
|
|
} else { |
53
|
0
|
|
|
|
|
|
print "latitude_hemisphere : SOUTH\n"; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
print "longitude : " . $self->{longitude} . "\n"; |
56
|
0
|
0
|
|
|
|
|
if ($self->{longitude_hemisphere} eq 'E') { |
57
|
0
|
|
|
|
|
|
print "longitude_hemisphere : EAST\n"; |
58
|
|
|
|
|
|
|
} else { |
59
|
0
|
|
|
|
|
|
print "longitude_hemisphere : WEST\n"; |
60
|
|
|
|
|
|
|
} |
61
|
0
|
|
|
|
|
|
print "longitude_hemisphere : " . $self->{longitude_hemisphere} . "\n"; |
62
|
0
|
|
|
|
|
|
print "utc_time : " . $self->{utc_time} . "\n"; |
63
|
0
|
0
|
|
|
|
|
if ($self->{data_valid} == 'A') { |
64
|
0
|
|
|
|
|
|
print "data valid : valid\n"; |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
|
print "data valid : in-valid\n"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#----------------------------------------# |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
#----------------------------------------# |
73
|
|
|
|
|
|
|
sub parse { |
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
75
|
0
|
|
|
|
|
|
my $data = shift; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# if we're logging, save data to filehandle |
78
|
0
|
0
|
|
|
|
|
if ($self->{log_fh}) { |
79
|
0
|
|
|
|
|
|
print { $self->{log_fh} } $data . "\n"; |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$data =~ s/\*..$//; # remove the last three bytes (checksum) |
83
|
0
|
|
|
|
|
|
my @args = split(/,/, $data); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# 1) Latitude, ddmm.mm format |
86
|
0
|
|
|
|
|
|
$self->{latitude} = $args[1]; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# 2) Latitude hemisphere, N or S |
89
|
0
|
|
|
|
|
|
$self->{latitude_hemisphere} = $args[2]; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# 3) Longitude, dddmm.mm format |
92
|
0
|
|
|
|
|
|
$self->{longitude} = $args[3]; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# 4) Longitude hemisphere, E or W |
95
|
0
|
|
|
|
|
|
$self->{longitude_hemisphere} = $args[4]; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# 5) UTC time of position fix, hhmmss format |
98
|
0
|
|
|
|
|
|
my @utc_time = split(//, $args[5]); |
99
|
0
|
|
|
|
|
|
my $hh = $utc_time[0]; |
100
|
0
|
|
|
|
|
|
$hh .= $utc_time[1]; |
101
|
0
|
|
|
|
|
|
my $mm = $utc_time[2]; |
102
|
0
|
|
|
|
|
|
$mm .= $utc_time[3]; |
103
|
0
|
|
|
|
|
|
my $ss = $utc_time[4]; |
104
|
0
|
|
|
|
|
|
$ss .= $utc_time[5]; |
105
|
0
|
|
|
|
|
|
my $ms = $utc_time[7]; |
106
|
0
|
|
|
|
|
|
$ms .= $utc_time[8]; |
107
|
0
|
|
|
|
|
|
$ms .= $utc_time[9]; |
108
|
0
|
|
|
|
|
|
$self->{utc_time} = $hh . ':' . $mm . ':' . $ss . '.' . $ms; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# 6) Data valid, A=Valid |
111
|
0
|
|
|
|
|
|
$self->{data_valid} = $args[6]; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |