1Net::GPSD(3) User Contributed Perl Documentation Net::GPSD(3)
2
3
4
6 Net::GPSD - Provides an object client interface to the gpsd server dae‐
7 mon.
8
10 use Net::GPSD;
11 $obj=Net::GPSD->new;
12 my $point=$obj->get;
13 print $point->latlon. "\n";
14
15 or
16
17 use Net::GPSD;
18 $obj=Net::GPSD->new;
19 $obj->subscribe();
20
22 Net::GPSD provides an object client interface to the gpsd server dae‐
23 mon. gpsd is an open source GPS deamon from http://gpsd.berlios.de/.
24
25 For example the get method returns a blessed hash reference like
26
27 {S=>[?⎪0⎪1⎪2],
28 P=>[lat,lon]}
29
30 Fortunately, there are various methods that hide this hash from the
31 user.
32
34 new
35
36 Returns a new Net::GPSD object.
37
38 my $obj=Net::GPSD->new(host=>"localhost", port=>"2947");
39
41 get
42
43 Returns a current point object regardless if there is a fix or not.
44 Applications should test if $point->fix is true.
45
46 my $point=$obj->get();
47
48 subscribe
49
50 The subscribe method listens to gpsd server in watcher (W command)
51 mode and calls the handler for each point received. The return for the
52 handler will be sent back as the first argument to the handler on the
53 next call.
54
55 $obj->subscribe();
56 $obj->subscribe(handler=>\&gpsd_handler, config=>$config);
57
58 getsatellitelist
59
60 Returns a list of Net::GPSD::Satellite objects. (maps to gpsd Y com‐
61 mand)
62
63 my @list=$obj->getsatellitelist;
64 my $list=$obj->getsatellitelist;
65
66 host
67
68 Returns the current gpsd host.
69
70 my $host=$obj->host;
71
72 port
73
74 Returns the current gpsd TCP port.
75
76 my $port=$obj->port;
77
78 baud
79
80 Returns the baud rate of the connect GPS receiver. (maps to gpsd B com‐
81 mand first data element)
82
83 my $baud=$obj->baud;
84
85 rate
86
87 Returns the sampling rate of the GPS receiver. (maps to gpsd C command
88 first data element)
89
90 my $rate=$obj->rate;
91
92 device
93
94 Returns the GPS device name. (maps to gpsd F command first data ele‐
95 ment)
96
97 my $device=$obj->device;
98
99 identification (aka id)
100
101 Returns a text string identifying the GPS. (maps to gpsd I command
102 first data element)
103
104 my $identification=$obj->identification;
105 my $identification=$obj->id;
106
107 protocol
108
109 Returns the GPSD protocol revision number. (maps to gpsd L command
110 first data element)
111
112 my $protocol=$obj->protocol;
113
114 daemon
115
116 Returns the gpsd daemon version. (maps to gpsd L command second data
117 element)
118
119 my $daemon=$obj->daemon;
120
121 commands
122
123 Returns a string of accepted command letters. (maps to gpsd L command
124 third data element)
125
126 my $commands=$obj->commands;
127
129 time
130
131 Returns the time difference between two point objects in seconds.
132
133 my $seconds=$obj->time($p1, $p2);
134
135 distance
136
137 Returns the distance difference between two point objects in meters.
138 (simple calculation)
139
140 my $meters=$obj->distance($p1, $p2);
141
142 track
143
144 Returns a point object at the predicted location in time seconds assum‐
145 ing constant velocity. (Geo::Forward calculation)
146
147 my $point=$obj->track($p1, $seconds);
148
150 Try the examples in the bin folder. Most every method has a default
151 which is most likely what you will want.
152
154 The distance function is Geo::Inverse.
155
156 The track function is Geo::Forward.
157
158 All units are degrees, meters, seconds.
159
161 No known bugs.
162
165 Michael R. Davis, qw/gpsd michaelrdavis com/
166
168 Copyright (c) 2006 Michael R. Davis (mrdvt92)
169
170 This library is free software; you can redistribute it and/or modify it
171 under the same terms as Perl itself.
172
174 Geo::Inverse Geo::Forward
175
176
177
178perl v5.8.8 2007-01-15 Net::GPSD(3)