line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::GPSD::Satellite; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
870
|
use GPS::OID; |
|
1
|
|
|
|
|
607
|
|
|
1
|
|
|
|
|
413
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION='0.39'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::GPSD::Satellite - Provides an interface for a gps satellite object. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Net::GPSD; |
15
|
|
|
|
|
|
|
my $obj=Net::GPSD->new(); |
16
|
|
|
|
|
|
|
my $i=0; |
17
|
|
|
|
|
|
|
print join("\t", qw{Count PRN ELEV Azim SNR USED}), "\n"; |
18
|
|
|
|
|
|
|
foreach ($obj->getsatellitelist) { |
19
|
|
|
|
|
|
|
print join "\t", ++$i, |
20
|
|
|
|
|
|
|
$_->prn, |
21
|
|
|
|
|
|
|
$_->elev, |
22
|
|
|
|
|
|
|
$_->azim, |
23
|
|
|
|
|
|
|
$_->snr, |
24
|
|
|
|
|
|
|
$_->used; |
25
|
|
|
|
|
|
|
$_->oid; |
26
|
|
|
|
|
|
|
print "\n"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
or to construct a satelite object |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Net::GPSD::Satelite; |
32
|
|
|
|
|
|
|
my $obj=Net::GPSD::Satellite->new(22,80,79,35,1); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
or to create a satelite object |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Net::GPSD::Satelite; |
37
|
|
|
|
|
|
|
my $obj=Net::GPSD::Satellite->new(); |
38
|
|
|
|
|
|
|
$obj->prn(22), |
39
|
|
|
|
|
|
|
$obj->elev(80), |
40
|
|
|
|
|
|
|
$obj->azim(79), |
41
|
|
|
|
|
|
|
$obj->snr(35), |
42
|
|
|
|
|
|
|
$obj->used(1); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 new |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $obj=Net::GPSD::Satellite->new($prn,$elev,$azim,$snr,$used); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new { |
55
|
3
|
|
|
3
|
1
|
2686
|
my $this = shift; |
56
|
3
|
|
33
|
|
|
28
|
my $class = ref($this) || $this; |
57
|
3
|
|
|
|
|
5
|
my $self = {}; |
58
|
3
|
|
|
|
|
9
|
bless $self, $class; |
59
|
3
|
|
|
|
|
9
|
$self->initialize(@_); |
60
|
3
|
|
|
|
|
7
|
return $self; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 METHODS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 initialize |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub initialize { |
70
|
3
|
|
|
3
|
1
|
4
|
my $self = shift(); |
71
|
3
|
|
|
|
|
15
|
$self->{'gpsprn'}=GPS::OID->new(); |
72
|
3
|
100
|
|
|
|
41
|
if (scalar(@_)) { |
73
|
1
|
|
|
|
|
172
|
$self->prn(shift()); |
74
|
1
|
|
|
|
|
6
|
$self->elevation(shift()); |
75
|
1
|
|
|
|
|
3
|
$self->azimuth(shift()); |
76
|
1
|
|
|
|
|
3
|
$self->snr(shift()); |
77
|
1
|
|
|
|
|
3
|
$self->used(shift()); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 prn |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Returns the Satellite PRN number. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$obj->prn(22); |
86
|
|
|
|
|
|
|
my $prn=$obj->prn; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub prn { |
91
|
5
|
|
|
5
|
1
|
40
|
my $self=shift(); |
92
|
5
|
100
|
|
|
|
10
|
if (@_) { |
93
|
2
|
|
|
|
|
4
|
$self->{'prn'}=shift(); |
94
|
2
|
50
|
|
|
|
174
|
if (int($self->{'prn'})) { #PRN != 0 ? |
95
|
2
|
|
|
|
|
8
|
$self->{'oid'}=$self->{'gpsprn'}->oid_prn($self->{'prn'}); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} #sets value |
98
|
5
|
|
|
|
|
3467
|
return $self->{'prn'}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 oid |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns the Satellite Object ID from the GPS::OID package. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
$obj->oid(22216); |
106
|
|
|
|
|
|
|
my $oid=$obj->oid; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub oid { |
111
|
4
|
|
|
4
|
1
|
7
|
my $self=shift(); |
112
|
4
|
100
|
|
|
|
8
|
if (@_) { |
113
|
1
|
|
|
|
|
3
|
$self->{'oid'}=shift(); |
114
|
1
|
|
|
|
|
5
|
$self->{'prn'}=$self->{'gpsprn'}->prn_oid($self->{'oid'}); |
115
|
|
|
|
|
|
|
} #sets value |
116
|
4
|
|
|
|
|
19
|
return $self->{'oid'}; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 elevation, elev |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns the satellite elevation, 0 to 90 degrees. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$obj->elev(80); |
124
|
|
|
|
|
|
|
my $elev=$obj->elev; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
*elev=\&elevation; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub elevation { |
131
|
2
|
|
|
2
|
1
|
3
|
my $self = shift(); |
132
|
2
|
100
|
|
|
|
6
|
if (@_) { $self->{'elevation'} = shift() } #sets value |
|
1
|
|
|
|
|
3
|
|
133
|
2
|
|
|
|
|
5
|
return $self->{'elevation'}; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 azimuth, azim |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns the satellite azimuth, 0 to 359 degrees. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
$obj->azim(79); |
141
|
|
|
|
|
|
|
my $azim=$obj->azim; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
*azim=\&azimuth; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub azimuth { |
148
|
2
|
|
|
2
|
1
|
3
|
my $self = shift(); |
149
|
2
|
100
|
|
|
|
6
|
if (@_) { $self->{'azimuth'} = shift() } #sets value |
|
1
|
|
|
|
|
3
|
|
150
|
2
|
|
|
|
|
4
|
return $self->{'azimuth'}; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 snr |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns the Signal to Noise ratio (C/No) 00 to 99 dB, null when not tracking. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
$obj->snr(35); |
158
|
|
|
|
|
|
|
my $snr=$obj->snr; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub snr { |
163
|
2
|
|
|
2
|
1
|
3
|
my $self = shift(); |
164
|
2
|
100
|
|
|
|
5
|
if (@_) { $self->{'snr'} = shift() } #sets value |
|
1
|
|
|
|
|
2
|
|
165
|
2
|
|
|
|
|
6
|
return $self->{'snr'}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 used |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Returns a 1 or 0 according to if the satellite was or was not used in the last fix. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
$obj->used(1); |
173
|
|
|
|
|
|
|
my $used=$obj->used; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub used { |
178
|
2
|
|
|
2
|
1
|
3
|
my $self = shift(); |
179
|
2
|
100
|
|
|
|
5
|
if (@_) { $self->{'used'} = shift() } #sets value |
|
1
|
|
|
|
|
2
|
|
180
|
2
|
|
|
|
|
7
|
return $self->{'used'}; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 q2u |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub q2u { |
188
|
0
|
|
|
0
|
1
|
|
my $a=shift(); |
189
|
0
|
0
|
|
|
|
|
return $a eq '?' ? undef() : $a; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 LIMITATIONS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 BUGS |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Email author and submit to RT. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 SUPPORT |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
DavisNetworks.com supports all Perl applications including this package. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 AUTHOR |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Michael R. Davis, qw/gpsd michaelrdavis com/ |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 LICENSE |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Copyright (c) 2006 Michael R. Davis (mrdvt92) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 SEE ALSO |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
1; |