Hi all,

I've recently found myself trying to write a PERL script to query GPSd,
with the intention of tying it into Apache, so that one might be able to
fetch GPS coordinates for a page.

I've happened upon Net::GPSD3 and there's a simple demon in the docs:

use Net::GPSD3;
use Data::Dumper qw{Dumper};
my $gpsd=Net::GPSD3->new;
my $poll=$gpsd->poll;
print Dumper($poll);

Sadly, this doesn't really result in anything useful.  Here's what
tcpdump has to say about it:

?DEVICES;
?POLL;
{"class":"VERSION","release":"3.25","rev":"3.25","proto_major":3,"proto_minor":15}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyACM0","driver":"u-blox","subtype":"SW
EXT CORE 4.04 (7f89f7),HW 00190000","subtype1":"ROM BASE
0x118B2060,FWVER=SPG
4.04,PROTVER=32.01,MOD=NEO-M9N,GPS;GLO;GAL;BDS,SBAS;QZSS","activated":"2025-06-05T14:58:12.065Z","flags":1,"native":1,"bps":9600,"parity":"N","stopbits":1,"cycle":1.00,"mincycle":0.02}]}
{"class":"POLL","time":"2025-06-05T14:58:12.488Z","active":0,"tpv":[],"gst":[],"sky":[]}
?POLL;
{"class":"POLL","time":"2025-06-05T14:58:12.491Z","active":0,"tpv":[],"gst":[],"sky":[]}

I think that perhaps the bit where it says "active:0" is a bit of an
area of suspecion, although I don't see any way to change that.

There's also a watch method, $gpsd->watch; which does actually get a lot
of the GPS data, on the downside, it sits in a loop, printing the data
to screen, which isn't exactly the effect that I'm looking for.

The docs over at https://gpsd.gitlab.io/gpsd/client-howto.html have this
to say:

"?WATCH={"enable":true}

This activates all devices without enabling streaming of reports. You
can then say "?POLL;" to poll gpsd’s recorded data."

Which implies one has to issue a WATCH before a POLL, this seems to
contradict the Net::GPSD3 docs, which give an example with just a poll
method, which TCPdump shows doesn't issue a WATCH.

Can anyone please offer any advise on this?

Kind regards,
Mike.

Attachment: signature.asc
Description: PGP signature

Reply via email to