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