| 1 | package Net::GPSD3::Return::POLL; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use base qw{Net::GPSD3::Return::Unknown::Timestamp}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION='0.18'; | |||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | Net::GPSD3::Return::POLL - Net::GPSD3 Return POLL Object | ||||||||||
| 11 | |||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||
| 13 | |||||||||||
| 14 | use Net::GPSD3; | ||||||||||
| 15 | use Data::Dumper qw{Dumper}; | ||||||||||
| 16 | my $gpsd = Net::GPSD3->new; | ||||||||||
| 17 | my $poll = $gpsd->poll; | ||||||||||
| 18 | print Dumper($poll); | ||||||||||
| 19 | |||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||
| 21 | |||||||||||
| 22 | Provides a Perl object interface to the POLL object returned by the GPSD daemon. | ||||||||||
| 23 | |||||||||||
| 24 | =head1 METHODS | ||||||||||
| 25 | |||||||||||
| 26 | =head2 class | ||||||||||
| 27 | |||||||||||
| 28 | Returns the object class | ||||||||||
| 29 | |||||||||||
| 30 | =head2 string | ||||||||||
| 31 | |||||||||||
| 32 | Returns the JSON string | ||||||||||
| 33 | |||||||||||
| 34 | =head2 parent | ||||||||||
| 35 | |||||||||||
| 36 | Return the parent L<Net::GPSD3> object | ||||||||||
| 37 | |||||||||||
| 38 | =head2 time | ||||||||||
| 39 | |||||||||||
| 40 | =head2 timestamp | ||||||||||
| 41 | |||||||||||
| 42 | =head2 datetime | ||||||||||
| 43 | |||||||||||
| 44 | =head2 active | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | 2 | ▶ | sub active {shift->{"active"}}; | ||||||||
|
Subroutine
active: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | |||||||||||
| 50 | =head2 fix, tpv | ||||||||||
| 51 | |||||||||||
| 52 | Returns the first fix from the Fixes array or undef if none. | ||||||||||
| 53 | |||||||||||
| 54 | my $fix=$poll->fix #isa Net::GPSD3::Return::TPV or undef | ||||||||||
| 55 | |||||||||||
| 56 | Note: I will try to keep this method consistant | ||||||||||
| 57 | |||||||||||
| 58 | =cut | ||||||||||
| 59 | |||||||||||
| 60 | 2 | ▶ | sub fix {shift->Fixes->[0]}; | ||||||||
|
Subroutine
fix: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 61 | 0 | ▶ | sub tpv {shift->Fixes->[0]}; | ||||||||
|
Subroutine
tpv: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 62 | |||||||||||
| 63 | =head2 Fixes | ||||||||||
| 64 | |||||||||||
| 65 | Object wrapper around JSON data | ||||||||||
| 66 | |||||||||||
| 67 | my $fix=$poll->Fixes #isa [] of Net::GPSD3::Return::TPV objects | ||||||||||
| 68 | my @fix=$poll->Fixes #isa () of Net::GPSD3::Return::TPV objects | ||||||||||
| 69 | |||||||||||
| 70 | Note: I'm not sure why this is an array from the protocol but do not count on this staying the same | ||||||||||
| 71 | |||||||||||
| 72 | =cut | ||||||||||
| 73 | |||||||||||
| 74 | 8 | ▶ | sub Fixes { | ||||||||
|
Subroutine
Fixes: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||
| 75 | 8 | my $self=shift; | |||||||||
| 76 | 2 | $self->{"Fixes"}=[map {$self->parent->constructor(%$_, string=>$self->parent->encode($_))} $self->_fixes] | |||||||||
| 77 | 8 | ▶ | unless defined $self->{"Fixes"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | 0 | ▶ | return wantarray ? @{$self->{"Fixes"}} : $self->{"Fixes"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 8 | ▶ | sub _fixes { | ||||||||
|
Subroutine
_fixes: called CC=4 SCAR=13.9
| |||||||||||
| 82 | 8 | my $self=shift; | |||||||||
| 83 | 8 | ▶ | $self->{"fixes"}=delete($self->{"tpv"}) if exists $self->{"tpv"}; #RT 73489 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | 8 | ▶ | $self->{"fixes"}=[] unless ref($self->{"fixes"}) eq "ARRAY"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 85 | 8 | ▶ | return wantarray ? @{$self->{"fixes"}} : $self->{"fixes"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | =head2 sky | ||||||||||
| 89 | |||||||||||
| 90 | Returns the first object from the Skyviews array or undef if none. | ||||||||||
| 91 | |||||||||||
| 92 | my $sky=$poll->sky #isa Net::GPSD3::Return::SKY or undef | ||||||||||
| 93 | |||||||||||
| 94 | Note: I will try to keep this method consistant | ||||||||||
| 95 | |||||||||||
| 96 | =cut | ||||||||||
| 97 | |||||||||||
| 98 | 2 | ▶ | sub sky {shift->Skyviews->[0]}; | ||||||||
|
Subroutine
sky: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 99 | |||||||||||
| 100 | =head2 Skyviews | ||||||||||
| 101 | |||||||||||
| 102 | Object wrapper around JSON data | ||||||||||
| 103 | |||||||||||
| 104 | my $sky=$poll->Skyviews #isa [] of Net::GPSD3::Return::SKY objects | ||||||||||
| 105 | my @sky=$poll->Skyviews #isa () of Net::GPSD3::Return::SKY objects | ||||||||||
| 106 | |||||||||||
| 107 | Note: I'm not sure why this is an array from the protocol but do not count on this staying the same | ||||||||||
| 108 | |||||||||||
| 109 | =cut | ||||||||||
| 110 | |||||||||||
| 111 | 10 | ▶ | sub Skyviews { | ||||||||
|
Subroutine
Skyviews: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||
| 112 | 10 | my $self=shift; | |||||||||
| 113 | 2 | $self->{"Skyviews"}=[map {$self->parent->constructor(%$_, string=>$self->parent->encode($_))} $self->_skyviews] | |||||||||
| 114 | 10 | ▶ | unless defined $self->{"Skyviews"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 115 | 0 | ▶ | return wantarray ? @{$self->{"Skyviews"}} : $self->{"Skyviews"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 8 | ▶ | sub _skyviews { | ||||||||
|
Subroutine
_skyviews: called CC=4 SCAR=13.9
| |||||||||||
| 119 | 8 | my $self=shift; | |||||||||
| 120 | 8 | ▶ | $self->{"skyviews"}=delete($self->{"sky"}) if exists $self->{"sky"}; #RT 73489 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 121 | 8 | ▶ | $self->{"skyviews"}=[] unless ref($self->{"skyviews"}) eq "ARRAY"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | 8 | ▶ | return wantarray ? @{$self->{"skyviews"}} : $self->{"skyviews"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | } | ||||||||||
| 124 | |||||||||||
| 125 | =head2 Gst | ||||||||||
| 126 | |||||||||||
| 127 | Object wrapper around JSON data | ||||||||||
| 128 | |||||||||||
| 129 | my $gst=$poll->Gst #isa [] of Net::GPSD3::Return::GST objects | ||||||||||
| 130 | my @gst=$poll->Gst #isa () of Net::GPSD3::Return::GST objects | ||||||||||
| 131 | |||||||||||
| 132 | Note: I'm not sure why this is an array from the protocol but do not count on this staying the same | ||||||||||
| 133 | |||||||||||
| 134 | =cut | ||||||||||
| 135 | |||||||||||
| 136 | 0 | ▶ | sub Gst { | ||||||||
|
Subroutine
Gst: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 137 | 0 | my $self=shift; | |||||||||
| 138 | 0 | $self->{"Gst"}=[map {$self->parent->constructor(%$_, string=>$self->parent->encode($_))} $self->_gst] | |||||||||
| 139 | 0 | ▶ | unless defined $self->{"Gst"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | 0 | ▶ | return wantarray ? @{$self->{"Gst"}} : $self->{"Gst"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 141 | } | ||||||||||
| 142 | |||||||||||
| 143 | 0 | ▶ | sub _gst { | ||||||||
|
Subroutine
_gst: not called CC=3 SCAR=24.8
| |||||||||||
| 144 | 0 | my $self=shift; | |||||||||
| 145 | 0 | ▶ | $self->{"gst"}=[] unless ref($self->{"gst"}) eq "ARRAY"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 146 | 0 | ▶ | return wantarray ? @{$self->{"gst"}} : $self->{"gst"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 147 | } | ||||||||||
| 148 | |||||||||||
| 149 | =head1 BUGS | ||||||||||
| 150 | |||||||||||
| 151 | Log on RT and send to gpsd-dev email list | ||||||||||
| 152 | |||||||||||
| 153 | =head1 SUPPORT | ||||||||||
| 154 | |||||||||||
| 155 | DavisNetworks.com supports all Perl applications including this package. | ||||||||||
| 156 | |||||||||||
| 157 | Try gpsd-dev email list | ||||||||||
| 158 | |||||||||||
| 159 | =head1 AUTHOR | ||||||||||
| 160 | |||||||||||
| 161 | Michael R. Davis | ||||||||||
| 162 | CPAN ID: MRDVT | ||||||||||
| 163 | STOP, LLC | ||||||||||
| 164 | domain=>michaelrdavis,tld=>com,account=>perl | ||||||||||
| 165 | http://www.stopllc.com/ | ||||||||||
| 166 | |||||||||||
| 167 | =head1 COPYRIGHT | ||||||||||
| 168 | |||||||||||
| 169 | This program is free software licensed under the... | ||||||||||
| 170 | |||||||||||
| 171 | The BSD License | ||||||||||
| 172 | |||||||||||
| 173 | The full text of the license can be found in the LICENSE file included with this module. | ||||||||||
| 174 | |||||||||||
| 175 | =head1 SEE ALSO | ||||||||||
| 176 | |||||||||||
| 177 | L<Net::GPSD3>, L<Net::GPSD3::Return::Unknown::Timestamp> | ||||||||||
| 178 | |||||||||||
| 179 | =cut | ||||||||||
| 180 | |||||||||||
| 181 | 2 | 1; | |||||||||