.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::GPSD3 3pm" .TH Net::GPSD3 3pm "2011-12-30" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::GPSD3 \- Interface to the gpsd server daemon protocol versions 3 (JSON). .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SS "Watch Interface" .IX Subsection "Watch Interface" .Vb 3 \& use Net::GPSD3; \& my $gpsd=Net::GPSD3\->new; \& $gpsd\->watch; .Ve .PP One Liner .PP .Vb 1 \& perl \-MNet::GPSD3 \-e \*(AqNet::GPSD3\->new\->watch\*(Aq .Ve .SS "Poll Interface" .IX Subsection "Poll Interface" .Vb 5 \& use Net::GPSD3; \& use Data::Dumper qw{Dumper}; \& my $gpsd=Net::GPSD3\->new; \& my $poll=$gpsd\->poll; \& print Dumper($poll); .Ve .PP One Liner .PP .Vb 1 \& perl \-MNet::GPSD3 \-e \*(Aqprintf "Protocol: %s\en", Net::GPSD3\->new\->poll\->parent\->cache\->VERSION\->protocol;\*(Aq \& \& Protocol: 3.4 .Ve .SS "\s-1POE\s0 Interface" .IX Subsection "POE Interface" See Net::GPSD3::POE .SH "DESCRIPTION" .IX Header "DESCRIPTION" Net::GPSD3 provides an object client interface to the gpsd server daemon utilizing the version 3 protocol. gpsd is an open source \s-1GPS\s0 daemon from http://www.catb.org/gpsd/ Support for Version 3 of the protocol (\s-1JSON\s0) was added to the daemon in version 2.90. If your daemon is before 2.90 (protocol 2.X), please use the Net::GPSD package. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "new" .IX Subsection "new" Returns a new Net::GPSD3 object. .PP .Vb 2 \& my $gpsd=Net::GPSD3\->new; \& my $gpsd=Net::GPSD3\->new(host=>"127.0.0.1", port=>2947); #defaults .Ve .SH "METHODS" .IX Header "METHODS" .SS "host" .IX Subsection "host" Sets or returns the current gpsd host. .PP .Vb 1 \& my $host=$obj\->host; .Ve .SS "port" .IX Subsection "port" Sets or returns the current gpsd \s-1TCP\s0 port. .PP .Vb 1 \& my $port=$obj\->port; .Ve .SS "poll" .IX Subsection "poll" Sends a Poll request to the gpsd server and returns a Net::GPSD3::Return::POLL object. The method also populates the cache object with the Net::GPSD3::Return::VERISON and Net::GPSD3::Return::DEVICES objects. .PP .Vb 1 \& my $poll=$gpsd\->poll; #isa Net::GPSD3::Return::POLL object .Ve .PP Note: In order to use the poll method consistently you should run the \s-1GPSD\s0 daemon as a service. You may also need to run the daemon with the \*(L"\-n\*(R" option. .SS "watch" .IX Subsection "watch" Calls all handlers that are registered in the handler method. .PP .Vb 1 \& $gpsd\->watch; #will not return unless something goes wrong. .Ve .SS "addHandler" .IX Subsection "addHandler" Adds handlers to the handler list. .PP .Vb 2 \& $gpsd\->addHandler(\e&myHandler); \& $gpsd\->addHandler(\e&myHandler1, \e&myHandler2); .Ve .PP A handler is a sub reference where the first argument is a Net::GPSD3::Return::* object. .SS "handlers" .IX Subsection "handlers" List of handlers that are called in order to process objects from the gpsd wathcer stream. .PP .Vb 2 \& my @handler=$gpsd\->handlers; #() \& my $handler=$gpsd\->handlers; #[] .Ve .SS "cache" .IX Subsection "cache" Returns the Net::GPSD3::Cache caching object. .SH "METHODS Internal" .IX Header "METHODS Internal" .SS "default_handler" .IX Subsection "default_handler" .SS "socket" .IX Subsection "socket" Returns the cached IO::Socket::INET6 object .PP .Vb 1 \& my $socket=$gpsd\->socket; #try to reconnect on failure .Ve .SS "json" .IX Subsection "json" Returns the cached \s-1JSON::XS\s0 object .SS "decode" .IX Subsection "decode" Returns a perl data structure given a \s-1JSON\s0 formated string. .PP .Vb 2 \& my %data=$gpsd\->decode($string); #() \& my $data=$gpsd\->decode($string); #{} .Ve .SS "encode" .IX Subsection "encode" Returns a \s-1JSON\s0 string from a perl data structure .SS "constructor" .IX Subsection "constructor" Constructs a class object by lazy loading the classes. .PP .Vb 4 \& my $obj=$gpsd\->constructor(%$data); \& my $obj=$gpsd\->constructor(class=>"DEVICE", \& string=>\*(Aq{...}\*(Aq, \& ...); .Ve .PP Returns and object in the Net::GPSD3::Return::* namespace. .SH "BUGS" .IX Header "BUGS" Log on \s-1RT\s0 and Send to gpsd-dev email list .PP There are no two \s-1GPS\s0 devices that are alike. Each \s-1GPS\s0 device has a different \s-1GPSD\s0 signature as well. If your \s-1GPS\s0 device does not work out of the box with this package, please send me a log of your devices \s-1JSON\s0 sentences. .PP .Vb 1 \& echo \*(Aq?POLL;\*(Aq | nc 127.0.0.1 2947 \& \& echo \*(Aq?WATCH={"enable":true,"json":true};\*(Aq | socat \-t10 stdin stdout | nc 127.0.0.1 2947 .Ve .SH "SUPPORT" .IX Header "SUPPORT" DavisNetworks.com supports all Perl applications including this package. .PP Try gpsd-dev email list .SH "AUTHOR" .IX Header "AUTHOR" .Vb 5 \& Michael R. Davis \& CPAN ID: MRDVT \& STOP, LLC \& domain=>michaelrdavis,tld=>com,account=>perl \& http://www.stopllc.com/ .Ve .SH "COPYRIGHT" .IX Header "COPYRIGHT" This program is free software licensed under the... .PP .Vb 1 \& The BSD License .Ve .PP The full text of the license can be found in the \s-1LICENSE\s0 file included with this module. .SH "SEE ALSO" .IX Header "SEE ALSO" Net::GPSD, Net::GPSD3::POE, GPS::Point, \s-1JSON::XS\s0, IO::Socket::INET6, DateTime