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
7 daemon.
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 Note: This package supports the older version 2 protocol. It works for
23 gpsd versions less than 3.00. However, for all versions of the gpsd
24 deamon greater than 2.90 you should use the version 3 protocol
25 supported by Net::GPSD3.
26
27 Net::GPSD provides an object client interface to the gpsd server
28 daemon. gpsd is an open source GPS deamon from
29 http://gpsd.berlios.de/.
30
31 For example the get method returns a blessed hash reference like
32
33 {S=>[?|0|1|2],
34 P=>[lat,lon]}
35
36 Fortunately, there are various methods that hide this hash from the
37 user.
38
40 new
41 Returns a new Net::GPSD object.
42
43 my $obj=Net::GPSD->new(host=>"localhost", port=>"2947");
44
46 initialize
47 get
48 Returns a current point object regardless if there is a fix or not.
49 Applications should test if $point->fix is true.
50
51 my $point=$obj->get();
52
53 subscribe
54 The subscribe method listens to gpsd server in watcher (W command)
55 mode and calls the handler for each point received. The return for the
56 handler will be sent back as the first argument to the handler on the
57 next call.
58
59 $obj->subscribe();
60 $obj->subscribe(handler=>\&gpsd_handler, config=>$config);
61
62 default_point_handler
63 default_satellitelist_handler
64 getsatellitelist
65 Returns a list of Net::GPSD::Satellite objects. (maps to gpsd Y
66 command)
67
68 my @list=$obj->getsatellitelist;
69 my $list=$obj->getsatellitelist;
70
71 retrieve
72 open
73 parse
74 host
75 Sets or returns the current gpsd host.
76
77 my $host=$obj->host;
78
79 port
80 Sets or returns the current gpsd TCP port.
81
82 my $port=$obj->port;
83
84 baud
85 Returns the baud rate of the connect GPS receiver. (maps to gpsd B
86 command first data element)
87
88 my $baud=$obj->baud;
89
90 rate
91 Returns the sampling rate of the GPS receiver. (maps to gpsd C command
92 first data element)
93
94 my $rate=$obj->rate;
95
96 device
97 Returns the GPS device name. (maps to gpsd F command first data
98 element)
99
100 my $device=$obj->device;
101
102 identification (aka id)
103 Returns a text string identifying the GPS. (maps to gpsd I command
104 first data element)
105
106 my $identification=$obj->identification;
107 my $identification=$obj->id;
108
109 id
110 protocol
111 Returns the GPSD protocol revision number. (maps to gpsd L command
112 first data element)
113
114 my $protocol=$obj->protocol;
115
116 daemon
117 Returns the gpsd daemon version. (maps to gpsd L command second data
118 element)
119
120 my $daemon=$obj->daemon;
121
122 commands
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 Returns the time difference between two point objects in seconds.
131
132 my $seconds=$obj->time($p1, $p2);
133
134 distance
135 Returns the distance difference between two point objects in meters.
136 (simple calculation)
137
138 my $meters=$obj->distance($p1, $p2);
139
140 track
141 Returns a point object at the predicted location in time seconds
142 assuming constant velocity. (Geo::Forward calculation)
143
144 my $point=$obj->track($p1, $seconds);
145
146 q2u
148 Try the examples in the bin folder. Most every method has a default
149 which is most likely what you will want.
150
152 The distance function is Geo::Inverse.
153
154 The track function uses Geo::Forward.
155
156 All units are degrees, meters, seconds.
157
159 Email the author and log on RT.
160
163 DavisNetworks.com supports all Perl applications including this
164 package.
165
167 Michael R. Davis, qw/gpsd michaelrdavis com/
168
170 Copyright (c) 2006 Michael R. Davis (mrdvt92)
171
172 This library is free software; you can redistribute it and/or modify it
173 under the same terms as Perl itself.
174
176 Geo::Inverse, Geo::Forward
177
178
179
180perl v5.34.0 2022-01-21 Net::GPSD(3)