Net::GPSD - Provides an object client interface to the gpsd server daemon.
use Net::GPSD; $obj=Net::GPSD->new; my $point=$obj->get; print $point->latlon. "\n";
use Net::GPSD; $obj=Net::GPSD->new; $obj->subscribe();
Note: This package supports the older version 2 protocol. It works for gpsd versions less than 3.00. However, for all versions of the gpsd deamon greater than 2.90 you should use the version 3 protocol supported by Net::GPSD3.
Net::GPSD provides an 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
Fortunately, there are various methods that hide this hash from the user.
Returns a new Net::GPSD object.
my $obj=Net::GPSD->new(host=>"localhost", port=>"2947");
Returns a current point object regardless if there is a fix or not. Applications should test if $point->fix is true.
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);
Returns a list of Net::GPSD::Satellite objects. (maps to gpsd Y command)
my @list=$obj->getsatellitelist; my $list=$obj->getsatellitelist;
Sets or returns the current gpsd host.
Sets or returns the current gpsd TCP port.
Returns the baud rate of the connect GPS receiver. (maps to gpsd B command first data element)
Returns the sampling rate of the GPS receiver. (maps to gpsd C command first data element)
Returns the GPS device name. (maps to gpsd F command first data element)
Returns a text string identifying the GPS. (maps to gpsd I command first data element)
my $identification=$obj->identification; my $identification=$obj->id;
Returns the GPSD protocol revision number. (maps to gpsd L command first data element)
Returns the gpsd daemon version. (maps to gpsd L command second data element)
Returns a string of accepted command letters. (maps to gpsd L command third data element)
Returns the time difference between two point objects in seconds.
my $seconds=$obj->time($p1, $p2);
Returns the distance difference between two point objects in meters. (simple calculation)
my $meters=$obj->distance($p1, $p2);
Returns a point object at the predicted location in time seconds assuming constant velocity. (Geo::Forward calculation)
my $point=$obj->track($p1, $seconds);
Try the examples in the bin folder. Most every method has a default which is most likely what you will want.
The distance function is Geo::Inverse.
The track function uses Geo::Forward.
All units are degrees, meters, seconds.
Email the author and log on RT.
DavisNetworks.com supports all Perl applications including this package.
Michael R. Davis, qw/gpsd michaelrdavis com/
Copyright (c) 2006 Michael R. Davis (mrdvt92)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.