GPSD3/Return/TPV.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 21 / 21 Podpod 100% 17 / 17 totaltotal 100% 74 / 74 CC 2 SCAR 0.9
CC
2
Cov
100%
point
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« GPSD3/Return/WATCH.pm ↑ Summary GPSD3/Return/ERROR.pm »
1 package Net::GPSD3::Return::TPV;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use base qw{Net::GPSD3::Return::Unknown::Timestamp};
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use GPS::Point;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION='0.12';
8  
9 =head1 NAME
10  
11 Net::GPSD3::Return::TPV - Net::GPSD3 Return TPV Object
12  
13 =head1 SYNOPSIS
14  
15 printf "Time: %s, Lat: %s, Lon: %s\n", $object->time, $object->lat, $object->lon;
16  
17 =head1 DESCRIPTION
18  
19 Provides a Perl object interface to the Time-Velocity-Position (TVP) object returned by the GPSD daemon.
20  
21 Example JSON objects:
22  
23 =head3 Protocol 3.1 Versions
24  
25 {
26 "class":"TPV",
27 "tag":"MID2",
28 "device":"/dev/ttyUSB0",
29 "time":1253593085.470,
30 "ept":0.005,
31 "lat":38.88945123,
32 "lon":-77.03522143,
33 "track":171.7249,
34 "speed":0.467,
35 "mode":2
36 }
37  
38 {
39 "class":"TPV",
40 "tag":"MID2",
41 "device":"/dev/ttyUSB0",
42 "time":1253593667.430,
43 "ept":0.005,
44 "lat":38.88945123,
45 "lon":-77.03522143,
46 "alt":146.911,
47 "track":180.0000,
48 "speed":0.194,
49 "climb":-0.157,
50 "mode":3
51 }
52  
53 =head3 Protocol 3.4 Version
54  
55 {
56 "class":"TPV",
57 "tag":"0x0106",
58 "device":"/dev/cuaU0",
59 "time":"2011-03-20T06:51:59.12Z",
60 "ept":0.005,
61 "lat":37.371427205,
62 "lon":-122.015179890,
63 "alt":25.789,
64 "epx":1.926,
65 "epy":1.808,
66 "epv":6.497,
67 "track":0.0000,
68 "speed":0.000,
69 "climb":0.000,
70 "eps":3.85,
71 "mode":3
72 }
73  
74 =head1 METHODS PROPERTIES
75  
76 =head2 class
77  
78 Returns the object class
79  
80 =head2 string
81  
82 Returns the JSON string
83  
84 =head2 parent
85  
86 Return the parent Net::GPSD object
87  
88 =head2 device
89  
90 Name of originating device.
91  
92 =cut
93  
94 1 ▶sub device {shift->{"device"}};
Subroutine device: called CC=1 SCAR=0.0
Pod documented
95  
96 =head2 tag
97  
98 Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence type.
99  
100 =cut
101  
102 2 ▶sub tag {shift->{"tag"}};
Subroutine tag: called CC=1 SCAR=0.0
Pod documented
103  
104 =head2 mode
105  
106 NMEA mode: %d, 0=no mode value yet seen, 1=no fix, 2=2D, 3=3D.
107  
108 =cut
109  
110 2 ▶sub mode {shift->{"mode"}};
Subroutine mode: called CC=1 SCAR=0.0
Pod documented
111  
112 =head2 time
113  
114 Seconds since the Unix epoch, UTC. The value may have a fractional part of up to .01sec precision.
115  
116 Note: In 2.96 (protocol 3.4) the TPV->time format changed from unix epoch to W3C, but this method hides that from the user.
117  
118 =head2 timestamp
119  
120 W3C formated timestamp value either directly from the protocol >= 3.4 or calculated < 3.4. The value may have a fractional part of up to .01sec precision.
121  
122 Note: I expect that in protocol 3.5 the value will be passed directly as TPV->timestamp
123  
124 =head2 datetime
125  
126 Returns a L<DateTime> object
127  
128 =head2 lat
129  
130 Latitude in degrees: +/- signifies West/East
131  
132 =cut
133  
134 2 ▶sub lat {shift->{"lat"}};
Subroutine lat: called CC=1 SCAR=0.0
Pod documented
135  
136 =head2 lon
137  
138 Longitude in degrees: +/- signifies North/South.
139  
140 =cut
141  
142 2 ▶sub lon {shift->{"lon"}};
Subroutine lon: called CC=1 SCAR=0.0
Pod documented
143  
144 =head2 alt
145  
146 Altitude in meters.
147  
148 =cut
149  
150 1 ▶sub alt {shift->{"alt"}};
Subroutine alt: called CC=1 SCAR=0.0
Pod documented
151  
152 =head2 speed
153  
154 Speed over ground, meters per second.
155  
156 =cut
157  
158 2 ▶sub speed {shift->{"speed"}};
Subroutine speed: called CC=1 SCAR=0.0
Pod documented
159  
160 =head2 track
161  
162 Course over ground, degrees from true north.
163  
164 =cut
165  
166 2 ▶sub track {shift->{"track"}};
Subroutine track: called CC=1 SCAR=0.0
Pod documented
167  
168 =head2 climb
169  
170 Climb (postive) or sink (negative) rate, meters per second.
171  
172 =cut
173  
174 2 ▶sub climb {shift->{"climb"}};
Subroutine climb: called CC=1 SCAR=0.0
Pod documented
175  
176 =head2 ept
177  
178 Estimated timestamp error (%f, seconds, 95% confidence).
179  
180 =cut
181  
182 2 ▶sub ept {shift->{"ept"}};
Subroutine ept: called CC=1 SCAR=0.0
Pod documented
183  
184 =head2 epx
185  
186 =cut
187  
188 2 ▶sub epx {shift->{"epx"}};
Subroutine epx: called CC=1 SCAR=0.0
Pod documented
189  
190 =head2 epy
191  
192 Latitude error estimate in meters, 95% confidence.
193  
194 =cut
195  
196 1 ▶sub epy {shift->{"epy"}};
Subroutine epy: called CC=1 SCAR=0.0
Pod documented
197  
198 =head2 epv
199  
200 Estimated vertical error in meters, 95% confidence.
201  
202 =cut
203  
204 2 ▶sub epv {shift->{"epv"}};
Subroutine epv: called CC=1 SCAR=0.0
Pod documented
205  
206 =head2 eps
207  
208 Speed error estimate in meters/sec, 95% confifdence.
209  
210 =cut
211  
212 2 ▶sub eps {shift->{"eps"}};
Subroutine eps: called CC=1 SCAR=0.0
Pod documented
213  
214 =head2 epd
215  
216 Direction error estinmate in degrees, 95% confifdence.
217  
218 =cut
219  
220 1 ▶sub epd {shift->{"epd"}};
Subroutine epd: called CC=1 SCAR=0.0
Pod documented
221  
222 =head2 epc
223  
224 Climb/sink error estinmate in meters/sec, 95% confifdence.
225  
226 =cut
227  
228 1 ▶sub epc {shift->{"epc"}};
Subroutine epc: called CC=1 SCAR=0.0
Pod documented
229  
230 =head1 METHODS VALUE ADDED
231  
232 =head2 point
233  
234 Returns a L<GPS::Point> Object
235  
236 =cut
237  
238 6 ▶sub point {
Subroutine point: called CC=2 SCAR=6.9
Pod documented
239 6 my $self=shift;
240 6 ▶ unless (defined($self->{"point"})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"point"}) 1 5 6
241 1 $self->{"point"}=GPS::Point->new(
242 time => $self->datetime->hires_epoch, #float seconds from the unix epoch
243 timestamp => $self->timestamp, #not yet supported but I'm planning it
244 datetime => $self->datetime, #not yet supported but I'm planning it
245 lat => $self->lat, #signed degrees
246 lon => $self->lon, #signed degrees
247 alt => $self->alt, #meters above the WGS-84 ellipsoid
248 speed => $self->speed, #meters/second (over ground)
249 heading => $self->track, #degrees clockwise from North
250 climb => $self->climb, #meters/second
251 etime => $self->ept, #float seconds
252 ehorizontal => $self->epx, #float meters
253 evertical => $self->epv, #float meters
254 espeed => $self->eps, #meters/second
255 eheading => $self->epd, #degrees
256 eclimb => $self->epc, #meters/second
257 mode => $self->mode, #GPS mode [?=>undef,None=>1,2D=>2,3D=>3]
258 tag => $self->tag, #Name of the GPS message for data
259 );
260 }
261 6 return $self->{"point"};
262 }
263  
264 =head1 BUGS
265  
266 Log on RT and Send to gpsd-dev email list
267  
268 =head1 SUPPORT
269  
270 DavisNetworks.com supports all Perl applications including this package.
271  
272 Try gpsd-dev email list
273  
274 =head1 AUTHOR
275  
276 Michael R. Davis
277 CPAN ID: MRDVT
278 STOP, LLC
279 domain=>michaelrdavis,tld=>com,account=>perl
280 http://www.stopllc.com/
281  
282 =head1 COPYRIGHT
283  
284 This program is free software licensed under the...
285  
286 The BSD License
287  
288 The full text of the license can be found in the LICENSE file included with this module.
289  
290 =head1 SEE ALSO
291  
292 L<Net::GPSD3>, L<GPS::Point>, L<Net::GPSD3::Return::Unknown>
293  
294 =cut
295  
296 4 1;
« GPSD3/Return/WATCH.pm ↑ Summary GPSD3/Return/ERROR.pm »