BT368i/NMEA/GP/GLL.pm

filter: Statementstmt 21.8% 12 / 55 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 66.6% 2 / 3 totaltotal 23.6% 17 / 72 CC 5 SCAR 22.7
CC
5
Cov
19%
print
20.0
parse
6.0
new
2.0
CRAP 9.7
« BT368i/NMEA/GP/GSA.pm ↑ Summary BT368i.pm »
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 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use vars qw( );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @ISA = qw( );
13  
14 1 our $VERSION = sprintf("%d.%02d", q$Revision: 1.00 $ =~ /(\d+)\.(\d+)/);
15  
16 #----------------------------------------#
17 #
18 #----------------------------------------#
19 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
20 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 0 ▶sub print {
Subroutine print: not called CC=4 SCAR=30.0
Pod documented
47 0 my $self = shift;
48  
49 0 print "latitude : " . $self->{latitude} . "\n";
50 0 ▶ if ($self->{latitude_hemisphere} eq 'N') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'latitude_hemisphere'} eq 'N') { } 0 0 0
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 ▶ if ($self->{longitude_hemisphere} eq 'E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'longitude_hemisphere'} eq 'E') { } 0 0 0
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 ▶ if ($self->{data_valid} == 'A') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'data_valid'} == 'A') { } 0 0 0
64 0 print "data valid : valid\n";
65 } else {
66 0 print "data valid : in-valid\n";
67 }
68 }
69  
70 #----------------------------------------#
71 #
72 #----------------------------------------#
73 0 ▶sub parse {
Subroutine parse: not called CC=2 SCAR=17.9
Pod documented
74 0 my $self = shift;
75 0 my $data = shift;
76  
77 # if we're logging, save data to filehandle
78 0 ▶ if ($self->{log_fh}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"log_fh"}) 0 0 0
79 0 print { $self->{log_fh} } $data . "\n";
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 1;
115  
116 __END__
« BT368i/NMEA/GP/GSA.pm ↑ Summary BT368i.pm »