GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Garmin(3) User Contributed Perl Documentation Garmin(3)

GPS::Garmin - Perl interface to GPS equipment using the Garmin Protocol

    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;
    }

GPS::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.

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.

- 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.

Lacks documentation

Joao Pedro B Gonçalves , joaop@iscsp.utl.pt

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

Hey! The above document had some coding errors, which are explained below:
Around line 519:
Non-ASCII character seen before =encoding in 'Gonçalves'. Assuming CP1252
2009-03-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.