AnyEvent-GPSD
view release on metacpan or search on metacpan
NAME
AnyEvent::GPSD - event based interface to GPSD
SYNOPSIS
use AnyEvent::GPSD;
DESCRIPTION
This module is an AnyEvent user, you need to make sure that you use and
run a supported event loop.
This module implements an interface to GPSD (http://gpsd.berlios.de/).
You need to consult the GPSD protocol desription in the manpage to make
better sense of this module.
METHODS
$gps = new AnyEvent::GPSD [key => value...]
Creates a (virtual) connection to the GPSD. If the "hostname:port"
argument is missing then "localhost:2947" will be used.
If the connection cannot be established, then it will retry every
second. Otherwise, the connection is put into watcher mode.
You can specify various configuration parameters, most of them
callbacks:
host => $hostname
The host to connect to, default is "locahost".
port => $port
The port to connect to, default is 2947.
min_speed => $speed_in_m_per_s
Sets the mininum speed (default: 0) that is considered real for
the purposes of replay compression or estimate. Speeds below
this value will be considered 0.
on_error => $cb->($gps)
Called on every connection or protocol failure, reason is in $!
(protocl errors are signalled via EBADMSG). Can be used to bail
out if you are not interested in retries.
on_connect => $cb->($gps)
Nornormally used: Called on every successful connection
establish.
on_response => $cb->($gps, $type, $data, $time)
Not normally used: Called on every response received from GPSD.
$type is the single letter type and $data is the data portion,
if any. $time is the timestamp that this message was received
at.
on_satellite_info => $cb->($gps, {satellite-info}...)
Called each time the satellite info changes, also on first
connect. Each "satellite-info" hash contains at least the
following members (mnemonic: all keys have three letters):
"prn" holds the satellite PRN (1..32 GPS, anything higher is
wASS/EGNOS/MCAS etc, see GPS::PRN).
"ele", "azi" contain the elevation (0..90) and azimuth (0..359)
of the satellite.
"snr" contains the signal strength in decibals (28+ is usually
the minimum value for a good fix).
"fix" contains either 1 to indicate that this satellite was used
for the last position fix, 0 otherwise. EGNOS/WAAS etc.
satellites will always show as 0, even if their correction info
was used.
The passed hash references are read-only.
on_fix => $cb->({point})
Called regularly (usually about once/second), even when there is
no connection to the GPSD (so is useful to update your idea of
the current position). The passed hash reference must *not* be
modified in any way.
If "mode" is 2 or 3, then the "{point}" hash contains at least
the following members, otherwise it is undefined which members
exist. Members whose values are not known are "undef" (usually
the error values, speed and so on).
time when this fix was received (s)
( run in 0.543 second using v1.01-cache-2.11-cpan-39bf76dae61 )