1Garmin(3) User Contributed Perl Documentation Garmin(3)
2
3
4
6 GPS::Garmin - Perl interface to GPS equipment using the Garmin Protocol
7
9 use GPS::Garmin;
10 $gps = new GPS::Garmin( 'Port' => '/dev/ttyS0',
11 'Baud' => 9600,
12 );
13
14 To transfer current position, and direction symbols:
15
16 ($latsign,$lat,$lonsign,$lon) = $gps->get_position;
17
18 To transfer current time:
19
20 ($sec,$min,$hour,$mday,$mon,$year) = $gps->get_time;
21
22 To transfer trackpoints:
23
24 $gps->prepare_transfer("trk");
25 while($gps->records) {
26 ($lat,$lon,$time) = $gps->grab;
27 }
28
29 To transfer Waypoints:
30
31 $gps->prepare_transfer("wpt");
32 while($gps->records) {
33 ($title,$lat,$lon,$desc) = $gps->grab;
34 }
35
37 GPS::Garmin allow the connection and use of of a GPS receiver in perl
38 scripts. Currently only the GRMN/GRMN protocol is implemented but NMEA
39 is a work in progress.
40
41 This module currently works with Garmin GPS II+ equipments, but should
42 work on most Garmin receivers that support the GRMN/GRMN protocol.
43
45 Make sure your GPS receiver is in host mode, GRMN/GRMN protocol. To
46 start a connection in your script, just:
47
48 use GPS::Garmin;
49 $gps = new GPS::Garmin ( 'Port' => '/dev/ttyS0',
50 'Baud' => 9600,
51 'Return' => 'hash',
52 ) or die "Unable to connect to receiver: $!";
53
54 Where Port is the port that your GPS is connected to, and Baud the
55 speed of connection ( default is 9600 bps).
56
57 If Return is set to 'hash', then waypoints and tracks are returned as
58 hashes, possibly containing more information. XXX This is not
59 implemented completely for all data and device types. An undefined
60 'Return' value would cause to return lists with basic information
61 (latitude and longitude) instead.
62
63 To know current coordinates:
64
65 ($latsign,$lat,$lnsign,$lon) = $gps->get_position;
66
67 $ltsign is "S" or "N" (South or North)
68 $lat is current latitude in degrees.minutes.
69 $lnsign is "W" or "E" (West or East)
70 $lon is current longitude in degrees.minutes.
71
72 To transfer the track records:
73
74 $gps->prepare_transfer("trk");
75 while($gps->records) {
76 ($lat,$lon,$time) = $gps->grab;
77 }
78
79 $time is in unix epoch seconds
80
81 With 'Return' => 'hash' this would be
82
83 $gps->prepare_transfer("trk");
84 while($gps->records) {
85 %trk_data = $gps->grab;
86 }
87
88 instead.
89
91 - Trackpoint transfer won't work in the following Garmin devices, since
92 they don't support it:
93
94 GPS 50 GPS 55 GPS 150 GPS 150 XL GPS 165 GNC 250 GNC
95 250XL GNC 300 GNC 300XL
96
97 You can check you GPS capabilities by looking at the table in page 50
98 of the Garmin protocol specification at
99 <http://www.garmin.com/support/protocol.html>
100
101 - You need to have Win32::SerialPort to have GPS::Garmin working in
102 Windows.
103
105 Lacks documentation
106
108 Joao Pedro B Goncalves , joaop@iscsp.utl.pt
109
111 Peter Bennett's GPS www and ftp directory:
112
113 ftp://sundae.triumf.ca/pub/peter/index.html.
114 http://vancouver-webpages.com/peter/idx_garmin.html
115
116 Official Garmin Communication Protocol Reference
117
118 http://www.garmin.com/support/protocol.html
119
120
121
122perl v5.12.0 2007-12-27 Garmin(3)