Garmin(3) User Contributed Perl Documentation Garmin(3)NAMEGPS::Garmin - Perl interface to GPS equipment using the Garmin Protocol
SYNOPSIS
use GPS::Garmin;
$gps = new GPS::Garmin( 'Port' => '/dev/ttyS0',
'Baud' => 9600,
);
To transfer current position, and direction symbols:
($latsign,$lat,$lonsign,$lon) = $gps->get_position;
To transfer current time:
($sec,$min,$hour,$mday,$mon,$year) = $gps->get_time;
To transfer trackpoints:
$gps->prepare_transfer("trk");
while($gps->records) {
($lat,$lon,$time) = $gps->grab;
}
To transfer Waypoints:
$gps->prepare_transfer("wpt");
while($gps->records) {
($title,$lat,$lon,$desc) = $gps->grab;
}
DESCRIPTIONGPS::Garmin allow the connection and use of of a GPS receiver in perl
scripts. Currently only the GRMN/GRMN protocol is implemented but NMEA
is a work in progress.
This module currently works with Garmin GPS II+ equipments, but should
work on most Garmin receivers that support the GRMN/GRMN protocol.
GETTING STARTED
Make sure your GPS receiver is in host mode, GRMN/GRMN protocol. To
start a connection in your script, just:
use GPS::Garmin;
$gps = new GPS::Garmin ( 'Port' => '/dev/ttyS0',
'Baud' => 9600,
'Return' => 'hash',
) or die "Unable to connect to receiver: $!";
Where Port is the port that your GPS is connected to, and Baud the
speed of connection ( default is 9600 bps).
If Return is set to 'hash', then waypoints and tracks are returned as
hashes, possibly containing more information. XXX This is not
implemented completely for all data and device types. An undefined
'Return' value would cause to return lists with basic information
(latitude and longitude) instead.
To know current coordinates:
($latsign,$lat,$lnsign,$lon) = $gps->get_position;
$ltsign is "S" or "N" (South or North)
$lat is current latitude in degrees.minutes.
$lnsign is "W" or "E" (West or East)
$lon is current longitude in degrees.minutes.
To transfer the track records:
$gps->prepare_transfer("trk");
while($gps->records) {
($lat,$lon,$time) = $gps->grab;
}
$time is in unix epoch seconds
With 'Return' => 'hash' this would be
$gps->prepare_transfer("trk");
while($gps->records) {
%trk_data = $gps->grab;
}
instead.
KNOWN LIMITATIONS
- Trackpoint transfer won't work in the following Garmin devices, since
they don't support it:
GPS 50 GPS 55 GPS 150 GPS 150 XL GPS 165 GNC 250 GNC
250XL GNC 300 GNC 300XL
You can check you GPS capabilities by looking at the table in page 50
of the Garmin protocol specification at
<http://www.garmin.com/support/protocol.html>
- You need to have Win32::SerialPort to have GPS::Garmin working in
Windows.
BUGS
Lacks documentation
AUTHOR
Joao Pedro B Goncalves , joaop@iscsp.utl.pt
SEE ALSO
Peter Bennett's GPS www and ftp directory:
ftp://sundae.triumf.ca/pub/peter/index.html.
http://vancouver-webpages.com/peter/idx_garmin.html
Official Garmin Communication Protocol Reference
http://www.garmin.com/support/protocol.html
perl v5.14.0 2007-12-27 Garmin(3)