Net::GPSD3::Return::TPV - Net::GPSD3 Return TPV Object


Net-GPSD3 documentation Contained in the Net-GPSD3 distribution.

Index


Code Index:

NAME

Top

Net::GPSD3::Return::TPV - Net::GPSD3 Return TPV Object

SYNOPSIS

Top

  printf "Time: %s, Lat: %s, Lon: %s\n", $object->time, $object->lat, $object->lon;

DESCRIPTION

Top

Provides a Perl object interface to the Time-Velocity-Position (TVP) object returned by the GPSD daemon.

Example JSON objects:

Protocol 3.1 Versions

  {
    "class":"TPV",
    "tag":"MID2",
    "device":"/dev/ttyUSB0",
    "time":1253593085.470,
    "ept":0.005,
    "lat":38.88945123,
    "lon":-77.03522143,
    "track":171.7249,
    "speed":0.467,
    "mode":2
  }

  {
    "class":"TPV",
    "tag":"MID2",
    "device":"/dev/ttyUSB0",
    "time":1253593667.430,
    "ept":0.005,
    "lat":38.88945123,
    "lon":-77.03522143,
    "alt":146.911,
    "track":180.0000,
    "speed":0.194,
    "climb":-0.157,
    "mode":3
  }

Protocol 3.4 Version

  {
    "class":"TPV",
    "tag":"0x0106",
    "device":"/dev/cuaU0",
    "time":"2011-03-20T06:51:59.12Z",
    "ept":0.005,
    "lat":37.371427205,
    "lon":-122.015179890,
    "alt":25.789,
    "epx":1.926,
    "epy":1.808,
    "epv":6.497,
    "track":0.0000,
    "speed":0.000,
    "climb":0.000,
    "eps":3.85,
    "mode":3
  }

METHODS PROPERTIES

Top

class

Returns the object class

string

Returns the JSON string

parent

Return the parent Net::GPSD object

device

Name of originating device.

tag

Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence type.

mode

NMEA mode: %d, 0=no mode value yet seen, 1=no fix, 2=2D, 3=3D.

time

Seconds since the Unix epoch, UTC. The value may have a fractional part of up to .01sec precision.

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.

timestamp

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.

Note: I expect that in protocol 3.5 the value will be passed directly as TPV->timestamp

datetime

Returns a DateTime object

lat

Latitude in degrees: +/- signifies West/East

lon

Longitude in degrees: +/- signifies North/South.

alt

Altitude in meters.

speed

Speed over ground, meters per second.

track

Course over ground, degrees from true north.

climb

Climb (postive) or sink (negative) rate, meters per second.

ept

Estimated timestamp error (%f, seconds, 95% confidence).

epx

epy

Latitude error estimate in meters, 95% confidence.

epv

Estimated vertical error in meters, 95% confidence.

eps

Speed error estimate in meters/sec, 95% confifdence.

epd

Direction error estinmate in degrees, 95% confifdence.

epc

Climb/sink error estinmate in meters/sec, 95% confifdence.

METHODS VALUE ADDED

Top

point

Returns a GPS::Point Object

BUGS

Top

Log on RT and Send to gpsd-dev email list

SUPPORT

Top

DavisNetworks.com supports all Perl applications including this package.

Try gpsd-dev email list

AUTHOR

Top

  Michael R. Davis
  CPAN ID: MRDVT
  STOP, LLC
  domain=>michaelrdavis,tld=>com,account=>perl
  http://www.stopllc.com/

COPYRIGHT

Top

SEE ALSO

Top

Net::GPSD3, GPS::Point, Net::GPSD3::Return::Unknown


Net-GPSD3 documentation Contained in the Net-GPSD3 distribution.
package Net::GPSD3::Return::TPV;
use strict;
use warnings;
use base qw{Net::GPSD3::Return::Unknown::Timestamp};
use GPS::Point;

our $VERSION='0.12';

sub device {shift->{"device"}};

sub tag {shift->{"tag"}};

sub mode {shift->{"mode"}};

sub lat {shift->{"lat"}};

sub lon {shift->{"lon"}};

sub alt {shift->{"alt"}};

sub speed {shift->{"speed"}};

sub track {shift->{"track"}};

sub climb {shift->{"climb"}};

sub ept {shift->{"ept"}};

sub epx {shift->{"epx"}};

sub epy {shift->{"epy"}};

sub epv {shift->{"epv"}};

sub eps {shift->{"eps"}};

sub epd {shift->{"epd"}};

sub epc {shift->{"epc"}};

sub point {
  my $self=shift;
  unless (defined($self->{"point"})) {
    $self->{"point"}=GPS::Point->new(
         time        => $self->datetime->hires_epoch, #float seconds from the unix epoch
         timestamp   => $self->timestamp,             #not yet supported but I'm planning it
         datetime    => $self->datetime,              #not yet supported but I'm planning it
         lat         => $self->lat,     #signed degrees
         lon         => $self->lon,     #signed degrees
         alt         => $self->alt,     #meters above the WGS-84 ellipsoid
         speed       => $self->speed,   #meters/second (over ground)
         heading     => $self->track,   #degrees clockwise from North
         climb       => $self->climb,   #meters/second
         etime       => $self->ept,     #float seconds
         ehorizontal => $self->epx,     #float meters
         evertical   => $self->epv,     #float meters
         espeed      => $self->eps,     #meters/second
         eheading    => $self->epd,     #degrees
         eclimb      => $self->epc,     #meters/second
         mode        => $self->mode,    #GPS mode [?=>undef,None=>1,2D=>2,3D=>3]
         tag         => $self->tag,     #Name of the GPS message for data
                                    );
  }
  return $self->{"point"};
}

1;