line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::GPSD::Point; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
640
|
use Geo::Functions qw{knots_mps mps_knots}; |
|
1
|
|
|
|
|
1922
|
|
|
1
|
|
|
|
|
1353
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION='0.39'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::GPSD::Point - Provides an object interface for a gps point. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Net::GPSD; |
15
|
|
|
|
|
|
|
$obj=Net::GPSD->new(host=>"localhost", |
16
|
|
|
|
|
|
|
port=>"2947"); |
17
|
|
|
|
|
|
|
my $point=$obj->get; #$point is a Net::GPSD::Point object |
18
|
|
|
|
|
|
|
print $point->latlon. "\n"; #use a "." here to force latlon to a scalar |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
or to use Net::GPSD::Point objects in you own code. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Net::GPSD::Point; |
23
|
|
|
|
|
|
|
my $point=Net::GPSD::Point->new(); |
24
|
|
|
|
|
|
|
$point->lat(39.5432524); |
25
|
|
|
|
|
|
|
$point->lon(-77.243532); |
26
|
|
|
|
|
|
|
print $point->latlon. "\n"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $point=Net::GPSD::Point->new(); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
4
|
|
|
4
|
1
|
13
|
my $this = shift; |
40
|
4
|
|
33
|
|
|
23
|
my $class = ref($this) || $this; |
41
|
4
|
|
|
|
|
5
|
my $self = {}; |
42
|
4
|
|
|
|
|
11
|
bless $self, $class; |
43
|
4
|
|
|
|
|
12
|
$self->initialize(@_); |
44
|
4
|
|
|
|
|
9
|
return $self; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 initialize |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub initialize { |
54
|
4
|
|
|
4
|
1
|
5
|
my $self = shift(); |
55
|
4
|
|
|
|
|
3
|
my $data = shift(); |
56
|
4
|
|
|
|
|
15
|
foreach (keys %$data) { |
57
|
9
|
|
|
|
|
10
|
$self->{$_}=[@{$data->{$_}}]; #there has got to be a better way to do this... |
|
9
|
|
|
|
|
31
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 fix |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns true if mode is fixed (logic based on the gpsd M[0] or O[14]) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $fix=$point->fix; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub fix { |
70
|
1
|
|
|
1
|
1
|
5
|
my $self = shift(); |
71
|
1
|
50
|
|
|
|
3
|
return defined($self->status) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
72
|
|
|
|
|
|
|
? ($self->status > 0 ? 1 : 0) |
73
|
|
|
|
|
|
|
: (defined($self->mode) |
74
|
|
|
|
|
|
|
? ($self->mode > 1 ? 1 : 0) |
75
|
|
|
|
|
|
|
: 0); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 status |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns DGPS status. (maps to gpsd S command first data element) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $status=$point->status; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub status { |
87
|
3
|
|
|
3
|
1
|
4
|
my $self = shift(); |
88
|
3
|
50
|
|
|
|
13
|
if (@_) { $self->{'S'}->[0] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
89
|
3
|
|
|
|
|
7
|
return q2u $self->{'S'}->[0]; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 datetime |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns datetime. (maps to gpsd D command first data element) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $datetime=$point->datetime; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub datetime { |
101
|
1
|
|
|
1
|
1
|
3
|
my $self = shift(); |
102
|
1
|
50
|
|
|
|
4
|
if (@_) { $self->{'D'}->[0] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
103
|
1
|
|
|
|
|
2
|
return q2u $self->{'D'}->[0]; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 tag |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns a tag identifying the last sentence received. (maps to gpsd O command first data element) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $tag=$point->tag; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub tag { |
115
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
116
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'O'}->[0] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
117
|
1
|
|
|
|
|
2
|
return q2u $self->{'O'}->[0]; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 time |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns seconds since the Unix epoch, UTC. May have a fractional part. (maps to gpsd O command second data element) |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $time=$point->time; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub time { |
129
|
8
|
|
|
8
|
1
|
45
|
my $self = shift(); |
130
|
8
|
100
|
|
|
|
18
|
if (@_) { $self->{'O'}->[1] = shift() } #sets value |
|
1
|
|
|
|
|
3
|
|
131
|
8
|
|
|
|
|
13
|
return q2u $self->{'O'}->[1]; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 errortime |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns estimated timestamp error (%f, seconds, 95% confidence). (maps to gpsd O command third data element) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
my $errortime=$point->errortime; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub errortime { |
143
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
144
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'O'}->[2] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
145
|
1
|
|
|
|
|
7
|
return q2u $self->{'O'}->[2]; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 latitude aka lat |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Returns Latitude as in the P report (%f, degrees). (maps to gpsd O command fourth data element) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $lat=$point->lat; |
153
|
|
|
|
|
|
|
my $lat=$point->latitude; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub latitude { |
158
|
12
|
|
|
12
|
1
|
14
|
my $self = shift(); |
159
|
12
|
100
|
|
|
|
25
|
if (@_) { $self->{'O'}->[3] = shift() } #sets value |
|
1
|
|
|
|
|
2
|
|
160
|
12
|
|
|
|
|
22
|
return q2u $self->{'O'}->[3]; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub lat { |
164
|
8
|
|
|
8
|
1
|
11
|
my $self = shift(); |
165
|
8
|
|
|
|
|
17
|
return $self->latitude(@_); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 longitude aka lon |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Returns Longitude as in the P report (%f, degrees). (maps to gpsd O command fifth data element) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $lon=$point->lon; |
173
|
|
|
|
|
|
|
my $lon=$point->longitude; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub longitude { |
178
|
12
|
|
|
12
|
1
|
17
|
my $self = shift(); |
179
|
12
|
100
|
|
|
|
22
|
if (@_) { $self->{'O'}->[4] = shift() } #sets value |
|
1
|
|
|
|
|
3
|
|
180
|
12
|
|
|
|
|
20
|
return q2u $self->{'O'}->[4]; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub lon { |
184
|
8
|
|
|
8
|
1
|
79
|
my $self = shift(); |
185
|
8
|
|
|
|
|
14
|
return $self->longitude(@_); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 latlon |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Returns Latitude, Longitude as an array in array context and as a space joined string in scalar context |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
my @latlon=$point->latlon; |
193
|
|
|
|
|
|
|
my $latlon=$point->latlon; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=cut |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub latlon { |
198
|
3
|
|
|
3
|
1
|
5
|
my $self = shift(); |
199
|
3
|
|
|
|
|
6
|
my @latlon=($self->latitude, $self->longitude); |
200
|
3
|
100
|
|
|
|
22
|
return wantarray ? @latlon : join(" ", @latlon); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 altitude aka alt |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Returns the current altitude, meters above mean sea level. (maps to gpsd O command sixth data element) |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
my $alt=$point->alt; |
208
|
|
|
|
|
|
|
my $alt=$point->altitude; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub altitude { |
213
|
2
|
|
|
2
|
1
|
3
|
my $self = shift(); |
214
|
2
|
50
|
|
|
|
6
|
if (@_) { $self->{'O'}->[5] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
215
|
2
|
|
|
|
|
5
|
return q2u $self->{'O'}->[5]; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub alt { |
219
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
220
|
1
|
|
|
|
|
4
|
return $self->altitude(@_); |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 errorhorizontal |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Returns Horizontal error estimate as in the E report (%f, meters). (maps to gpsd O command seventh data element) |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $errorhorizontal=$point->errorhorizontal; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub errorhorizontal { |
232
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
233
|
1
|
50
|
|
|
|
8
|
if (@_) { $self->{'O'}->[6] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
234
|
1
|
|
|
|
|
3
|
return q2u $self->{'O'}->[6]; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 errorvertical |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns Vertical error estimate as in the E report (%f, meters). (maps to gpsd O command eighth data element) |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
my $errorvertical=$point->errorvertical; |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub errorvertical { |
246
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
247
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'O'}->[7] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
248
|
1
|
|
|
|
|
2
|
return q2u $self->{'O'}->[7]; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 heading |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Returns Track as in the T report (%f, degrees). (maps to gpsd O command ninth data element) |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
my $heading=$point->heading; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=cut |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub heading { |
260
|
3
|
|
|
3
|
1
|
4
|
my $self = shift(); |
261
|
3
|
100
|
|
|
|
7
|
if (@_) { $self->{'O'}->[8] = shift() } #sets value |
|
1
|
|
|
|
|
3
|
|
262
|
3
|
|
|
|
|
9
|
return q2u $self->{'O'}->[8]; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 speed |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Returns speed (%f, meters/sec). Note: older versions of the O command reported this field in knots. (maps to gpsd O command tenth data element) |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
my $speed=$point->speed; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=cut |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub speed { |
274
|
2
|
|
|
2
|
1
|
55
|
my $self = shift(); |
275
|
2
|
50
|
|
|
|
7
|
if (@_) { $self->{'O'}->[9] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
276
|
2
|
|
|
|
|
4
|
return q2u $self->{'O'}->[9]; |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head2 speed_knots |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Returns speed in knots |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
my $speed=$point->speed_knots; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub speed_knots { |
288
|
0
|
|
|
0
|
1
|
0
|
my $self = shift(); |
289
|
0
|
0
|
|
|
|
0
|
if (@_) { $self->{'O'}->[9] = mps_knots(shift()) } #sets value |
|
0
|
|
|
|
|
0
|
|
290
|
0
|
0
|
|
|
|
0
|
return defined($self->speed) ? knots_mps($self->speed) : undef(); |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 climb |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Returns Vertical velocity as in the U report (%f, meters/sec). (maps to gpsd O command 11th data element) |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
my $climb=$point->climb; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=cut |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
sub climb { |
302
|
1
|
|
|
1
|
1
|
41
|
my $self = shift(); |
303
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'O'}->[10] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
304
|
1
|
|
|
|
|
13
|
return q2u $self->{'O'}->[10]; |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 errorheading |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
Returns Error estimate for course (%f, degrees, 95% confidence). (maps to gpsd O command 12th data element) |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
my $errorheading=$point->errorheading; |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub errorheading { |
316
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
317
|
1
|
50
|
|
|
|
4
|
if (@_) { $self->{'O'}->[11] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
318
|
1
|
|
|
|
|
2
|
return q2u $self->{'O'}->[11]; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head2 errorspeed |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Returns Error estimate for speed (%f, meters/sec, 95% confidence). Note: older versions of the O command reported this field in knots. (maps to gpsd O command 13th data element) |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
my $errorspeed=$point->errorspeed; |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub errorspeed { |
330
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
331
|
1
|
50
|
|
|
|
4
|
if (@_) { $self->{'O'}->[12] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
332
|
1
|
|
|
|
|
2
|
return q2u $self->{'O'}->[12]; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=head2 errorclimb |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
Returns Estimated error for climb/sink (%f, meters/sec, 95% confidence). (maps to gpsd O command 14th data element) |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
my $errorclimb=$point->errorclimb; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=cut |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
sub errorclimb { |
344
|
1
|
|
|
1
|
1
|
1
|
my $self = shift(); |
345
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'O'}->[13] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
346
|
1
|
|
|
|
|
3
|
return q2u $self->{'O'}->[13]; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head2 mode |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Returns The NMEA mode. 0=no mode value yet seen, 1=no fix, 2=2D (no altitude), 3=3D (with altitude). (maps to gpsd M command first data element) |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
my $mode=$point->mode; |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=cut |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
sub mode { |
358
|
1
|
|
|
1
|
1
|
2
|
my $self = shift(); |
359
|
1
|
50
|
|
|
|
3
|
if (@_) { $self->{'M'}->[0] = $self->{'O'}->[14] = shift() } #sets value |
|
0
|
|
|
|
|
0
|
|
360
|
1
|
50
|
|
|
|
5
|
return q2u(defined($self->{'O'}->[14]) ? $self->{'O'}->[14] : $self->{'M'}->[0]); |
361
|
|
|
|
|
|
|
} |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head2 q2u |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=cut |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
sub q2u { |
368
|
52
|
|
|
52
|
1
|
51
|
my $a=shift(); |
369
|
52
|
50
|
|
|
|
315
|
return defined($a) ? ($a eq '?' ? undef() : $a) : undef(); |
|
|
50
|
|
|
|
|
|
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
1; |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
__END__ |