Take me over?
NAME
Net::GPSD - Provides an Perl object client interface to the gpsd server daemon.
SYNOPSIS
use Net::GPSD;
$obj=new Net::GPSD;
my $point=$obj->get;
print $point->latlon. "\n";
or
use Net::GPSD;
$obj=new Net::GPSD;
$obj->subscribe();
DESCRIPTION
Net::GPSD provides an Perl object client interface to the gpsd server daemon. gpsd is an open source GPS deamon from http://gpsd.berlios.de/.
For example the get method returns a blessed hash reference like
{S=>[?|0|1|2],
P=>[lat,lon]}
Fortunately, there are various methods that hide this hash from the user.
CONSTRUCTOR
new
Returns a new Net::GPSD object.
my $obj=Net::GPSD->new(host=>"localhost", port=>"2947");
METHODS
get
Returns a current point object regardless if there is a fix or not. Application should test if $point->fix is true.
my $point->get();
subscribe
The subscribe method listens to gpsd server in watcher (W command) mode and calls the handler for each point received. The return for the handler will be sent back as the first argument to the handler on the next call.
$obj->subscribe();
$obj->subscribe(handler=>\&gpsd_handler, config=>$config);
getsatellitelist
Returns a list of Net::GPSD::Satellite objects. (maps to gpsd Y command)
my @list=$obj->getsatellitelist;
my $list=$obj->getsatellitelist;
host
Returns the current gpsd host.
my $host=$obj->host;
port
Returns the current gpsd TCP port.
my $port=$obj->port;
baud
Returns the baud rate of the connect GPS receiver. (maps to gpsd B command first data element)
my $baud=$obj->baud;
rate
Returns the sampling rate of the GPS receiver. (maps to gpsd C command first data element)
my $rate=$obj->rate;
device
Returns the GPS device name. (maps to gpsd F command first data element)
my $device=$obj->device;
identification (aka id)
Returns a text string identifying the GPS. (maps to gpsd I command first data element)
my $identification=$obj->identification;
my $identification=$obj->id;
protocol
Returns the GPSD protocol revision number. (maps to gpsd L command first data element)
my $protocol=$obj->protocol;
daemon
Returns the gpsd daemon version. (maps to gpsd L command second data element)
my $daemon=$obj->daemon;
commands
Returns a string of accepted command letters. (maps to gpsd L command third data element)
my $commands=$obj->commands;
FUNCTIONS
time
Returns the time difference between two point objects in seconds.
my $seconds=$obj->time($p1, $p2);
distance
Returns the distance difference between two point objects in meters. (simple calculation)
my $meters=$obj->distance($p1, $p2);
track
Returns a point object at the predicted location in time seconds assuming constant velocity. (Geo::Forward calculation)
my $point=$obj->track($p1, $seconds);
GETTING STARTED
Try the examples in the bin folder. Most every method has a default which is most likely what you will want.
KNOWN LIMITATIONS
The distance function is home grown; don't trust it. When I get a chance, I'll migrate it to something else. Maybe Geo:Ellisoid
BUGS
No known bugs.
EXAMPLES
- example-get
- example-subscribe
- example-subscribe-handler
- example-check
- example-information
- example-getsatellitelist
- example-tracker
- example-tracker-http
- example-tracker-text
AUTHOR
Michael R. Davis, qw/gpsd michaelrdavis com/
SEE ALSO
http://gpsd.davisnetworks.com/
http://gpsd.berlios.de/
Geo::Forward Net::GPSD::Point Net::GPSD::Satellite