ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-GPSD/GPSD.pm
(Generate patch)

Comparing AnyEvent-GPSD/GPSD.pm (file contents):
Revision 1.2 by root, Wed Jul 2 05:17:37 2008 UTC vs.
Revision 1.3 by root, Wed Jul 2 05:21:58 2008 UTC

88 88
89C<snr> contains the signal strength in decibals (28+ is usually the 89C<snr> contains the signal strength in decibals (28+ is usually the
90minimum value for a good fix). 90minimum value for a good fix).
91 91
92C<fix> contains either C<1> to indicate that this satellite was used for 92C<fix> contains either C<1> to indicate that this satellite was used for
93the last position fix, C<0> otherwise. EGNOS/WAAS etc. satellites will 93the last position fix, C<0> otherwise. EGNOS/WAAS etc. satellites will
94always show as C<0>, even if their correction info was used. 94always show as C<0>, even if their correction info was used.
95
96The passed hash references are read-only.
95 97
96=item on_fix => $cb->({point}) 98=item on_fix => $cb->({point})
97 99
98Called regularly (usually about once/second), even when there is no 100Called regularly (usually about once/second), even when there is no
99connection to the GPSD (so is useful to update your idea of the current 101connection to the GPSD (so is useful to update your idea of the current
316This returns an estimate of the current position based on the last fix and 318This returns an estimate of the current position based on the last fix and
317the time passed since then. Useful for interactive applications where you 319the time passed since then. Useful for interactive applications where you
318want more frequent updates, but not very useful to store, as the next fix 320want more frequent updates, but not very useful to store, as the next fix
319might well be totally off. 321might well be totally off.
320 322
321If the fix is older then C<$max_seconds> (default: C<1.9>) or if no fix is 323If the fix is older then C<$max_seconds> (default: C<1.9> times the update
322available, returns the empty list. 324interval, i.e. usually C<1.9> seconds) or if no fix is available, returns
325the empty list.
323 326
324=cut 327=cut
325 328
326sub estimate { 329sub estimate {
327 my ($self, $max) = @_; 330 my ($self, $max) = @_;
328 331
329 $max ||= 1.9 unless defined $max; 332 $max ||= 1.9 * $self->{interval} unless defined $max;
330 333
331 my $geo = $self->{geo_forward} ||= new Geo::Forward; 334 my $geo = $self->{geo_forward} ||= new Geo::Forward;
332 335
333 my $fix = $self->{fix} or return; 336 my $fix = $self->{fix} or return;
334 $fix->{mode} >= 2 or return; 337 $fix->{mode} >= 2 or return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines