BT368i/NMEA/GP/GSA.pm

filter: Statementstmt 18.4% 12 / 65 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 66.6% 2 / 3 totaltotal 19.7% 17 / 86 CC 7 SCAR 31.1
CC
7
Cov
16%
print
42.0
parse
6.0
new
2.0
CRAP 22.4
« BT368i/NMEA/GP/RMC.pm ↑ Summary BT368i/NMEA/GP/GLL.pm »
1 #
2 # Written by Travis Kent Beste
3 # Fri Aug 6 22:48:49 CDT 2010
4  
5 package BT368i::NMEA::GP::GSA;
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 mode => '',
28 fix_type => '',
29 prn_00 => '',
30 prn_01 => '',
31 prn_02 => '',
32 prn_03 => '',
33 prn_04 => '',
34 prn_05 => '',
35 prn_06 => '',
36 prn_07 => '',
37 prn_08 => '',
38 prn_10 => '',
39 prn_11 => '',
40 position_diliution => '',
41 horizontal_diliution => '',
42 vertical_diliution => '',
43 );
44  
45 0 my $self = {
46 %fields,
47 };
48 0 bless $self, $class;
49  
50 0 return $self;
51 }
52  
53 #----------------------------------------#
54 #
55 #----------------------------------------#
56 0 ▶sub print {
Subroutine print: not called CC=6 SCAR=37.4
Pod documented
57 0 my $self = shift;
58  
59 0 ▶ if ($self->{mode} eq 'M') {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'mode'} eq 'M') { } 0 0 0
elsif ($self->{'mode'} eq 'A') { } 0 0 0
60 0 print "mode : manual\n";
61 } elsif ($self->{mode} eq 'A') {
62 0 print "mode : automatic\n";
63 }
64  
65 0 ▶ if ($self->{fix_type} == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->{'fix_type'} == 1) { } 0 0 0
elsif ($self->{'fix_type'} == 2) { } 0 0 0
elsif ($self->{'fix_type'} == 3) { } 0 0 0
66 0 print "fix : no fix\n";
67 } elsif ($self->{fix_type} == 2) {
68 0 print "fix : 2D\n";
69 } elsif ($self->{fix_type} == 3) {
70 0 print "fix : 3D\n";
71 }
72  
73 0 print "prn 00 : " . $self->{prn_00} . "\n";
74 0 print "prn 01 : " . $self->{prn_01} . "\n";
75 0 print "prn 02 : " . $self->{prn_02} . "\n";
76 0 print "prn 03 : " . $self->{prn_03} . "\n";
77 0 print "prn 04 : " . $self->{prn_04} . "\n";
78 0 print "prn 05 : " . $self->{prn_05} . "\n";
79 0 print "prn 06 : " . $self->{prn_06} . "\n";
80 0 print "prn 07 : " . $self->{prn_07} . "\n";
81 0 print "prn 08 : " . $self->{prn_08} . "\n";
82 0 print "prn 09 : " . $self->{prn_09} . "\n";
83 0 print "prn 10 : " . $self->{prn_10} . "\n";
84 0 print "prn 11 : " . $self->{prn_11} . "\n";
85  
86 0 print "position diliution : " . $self->{position_diliution} . "\n";
87 0 print "horizontal diliution : " . $self->{horizontal_diliution} . "\n";
88 0 print "vertical diliution : " . $self->{vertical_diliution} . "\n";
89 }
90  
91 #----------------------------------------#
92 #
93 #----------------------------------------#
94 0 ▶sub parse {
Subroutine parse: not called CC=2 SCAR=17.9
Pod documented
95 0 my $self = shift;
96 0 my $data = shift;
97  
98 # if we're logging, save data to filehandle
99 0 ▶ if ($self->{log_fh}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"log_fh"}) 0 0 0
100 0 print { $self->{log_fh} } $data . "\n";
101 }
102  
103 0 $data =~ s/\*..$//; # remove the last three bytes
104 0 my @args = split(/,/, $data);
105  
106 # 1) Mode, M=Manual, A=Automatic
107 0 $self->{mode} = $args[1];
108  
109 # 2) Fix type, 1=no fix, 2=2D, 3=3D
110 0 $self->{fix_type} = $args[2];
111  
112 # 3) PRN number, 01 to 32, of satellites used in solution (leading zeroes sent)
113 0 $self->{prn_00} = $args[3];
114 0 $self->{prn_01} = $args[4];
115 0 $self->{prn_02} = $args[5];
116 0 $self->{prn_03} = $args[6];
117 0 $self->{prn_04} = $args[7];
118 0 $self->{prn_05} = $args[8];
119 0 $self->{prn_06} = $args[9];
120 0 $self->{prn_07} = $args[10];
121 0 $self->{prn_08} = $args[11];
122 0 $self->{prn_09} = $args[12];
123 0 $self->{prn_10} = $args[13];
124 0 $self->{prn_11} = $args[14];
125  
126 # 4) Position dilution of precision, 1.0 to 99.9
127 0 $self->{position_diliution} = $args[15];
128  
129 # 5) Horizontal dilution of precision, 1.0 to 99.9
130 0 $self->{horizontal_diliution} = $args[16];
131  
132 # 6) Vertical dilution of precision, 1.0 to 99.9
133 0 $self->{vertical_diliution} = $args[17];
134 }
135  
136 1 1;
137  
138 __END__
« BT368i/NMEA/GP/RMC.pm ↑ Summary BT368i/NMEA/GP/GLL.pm »