Take me over?
NAME
Net::GPSD3 - Interface to the gpsd server daemon protocol version 3 (JSON).
SYNOPSIS
use Net::GPSD3;
my $gpsd=Net::GPSD3->new(host=>"127.0.0.1", port=>2947); #defaults
$gpsd->addHandler(\&myHandler);
$gpsd->watch;
sub myHandler {
my $object=shift;
use Data::Dumper qw{Dumper};
print Dumper($object);
}
The Perl one liner
perl -MNet::GPSD3 -e 'Net::GPSD3->new->watch'
DESCRIPTION
Net::GPSD3 provides an object client interface to the gpsd server daemon utilizing the version 3.1 protocol. gpsd is an open source GPS deamon from http://gpsd.berlios.de/. Support for Version 3 of the protocol (JSON) was adding to the daemon in version 2.90. If your daemon is before 2.90 then please use the Net::GPSD package.
CONSTRUCTOR
new
Returns a new Net::GPSD3 object.
my $gpsd=Net::GPSD3->new;
my $gpsd=Net::GPSD3->new(host=>"127.0.0.1", port=>2947); #defaults
METHODS
host
Sets or returns the current gpsd host.
my $host=$obj->host;
port
Sets or returns the current gpsd TCP port.
my $port=$obj->port;
watch
$gpsd->watch; #will not return unless something goes wrong.
intersperse
Time in seconds to intersperse DEVICES objects into the WATCHER stream. Disabled <= 0.
my $intersperse=$self->intersperse; #$ seconds
addHandler
$gpsd->addHandler(\&myHandler);
$gpsd->addHandler(\&myHandler1, \&myHandler2);
handlers
my @handler=$gpsd->handlers; #()
my $handler=$gpsd->handlers; #[]
METHODS Internal
default_handler
socket
Returns the cached IO::Socket::INET object
my $socket=$gpsd->socket; #try to reconnect on failure
json
Returns the cached JSON::XS object
decode
Returns a perl data structure given a JSON formated string.
my %data=$gpsd->decode($string); #()
my $data=$gpsd->decode($string); #{}
encode
Returns a JSON string from a perl data structure
constructor
Constructs a class object by lazy loading the classes.
my $obj=$gpsd->constructor(%$data);
my $obj=$gpsd->constructor(class=>"DEVICE",
string=>'{...}',
...);
Returns and object in the Net::GPSD3::Return::* namespace.
strftime
The format the DateTime objects
BUGS
Log on RT and Send to gpsd-dev email list
SUPPORT
Try gpsd-dev email list
AUTHOR
Michael R. Davis
CPAN ID: MRDVT
STOP, LLC
domain=>michaelrdavis,tld=>com,account=>perl
http://www.stopllc.com/
COPYRIGHT
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
Net::GPSD, GPS::Point, JSON::XS, IO::Socket::INET, Time::HiRes