| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::GPSD3::Return::SKY; | 
| 2 | 4 |  |  | 4 |  | 989 | use strict; | 
|  | 4 |  |  |  |  | 8 |  | 
|  | 4 |  |  |  |  | 148 |  | 
| 3 | 4 |  |  | 4 |  | 19 | use warnings; | 
|  | 4 |  |  |  |  | 8 |  | 
|  | 4 |  |  |  |  | 122 |  | 
| 4 | 4 |  |  | 4 |  | 21 | use base qw{Net::GPSD3::Return::Unknown::Timestamp}; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 875 |  | 
| 5 | 4 |  |  | 4 |  | 21 | use DateTime; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 1577 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION='0.12'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 NAME | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | Net::GPSD3::Return::SKY - Net::GPSD3 Return SKY Object | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | Provides a Perl object interface to the SKY object returned by the GPSD daemon. | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | An example JSON object: | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head3 Protcol 3.1 versions | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | { | 
| 24 |  |  |  |  |  |  | "class":"SKY", | 
| 25 |  |  |  |  |  |  | "tag":"MID4", | 
| 26 |  |  |  |  |  |  | "device":"/dev/ttyUSB0", | 
| 27 |  |  |  |  |  |  | "time":1253593665.430, | 
| 28 |  |  |  |  |  |  | "hdop":23.60, | 
| 29 |  |  |  |  |  |  | "reported":9, | 
| 30 |  |  |  |  |  |  | "satellites": | 
| 31 |  |  |  |  |  |  | [ | 
| 32 |  |  |  |  |  |  | {"PRN":15,"el":77,"az":123,"ss":0, "used":false}, | 
| 33 |  |  |  |  |  |  | {"PRN":18,"el":25,"az":268,"ss":0, "used":false}, | 
| 34 |  |  |  |  |  |  | {"PRN":27,"el":13,"az":150,"ss":0, "used":false}, | 
| 35 |  |  |  |  |  |  | {"PRN":29,"el":47,"az":228,"ss":0, "used":false}, | 
| 36 |  |  |  |  |  |  | {"PRN":5, "el":39,"az":58, "ss":46,"used":true }, | 
| 37 |  |  |  |  |  |  | {"PRN":21,"el":41,"az":309,"ss":33,"used":true }, | 
| 38 |  |  |  |  |  |  | {"PRN":10,"el":32,"az":61, "ss":40,"used":true }, | 
| 39 |  |  |  |  |  |  | {"PRN":8, "el":12,"az":48, "ss":40,"used":true }, | 
| 40 |  |  |  |  |  |  | {"PRN":2, "el":9, "az":124,"ss":0, "used":false} | 
| 41 |  |  |  |  |  |  | ] | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head3 Protcol 3.4 versions | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | { | 
| 47 |  |  |  |  |  |  | "class":"SKY", | 
| 48 |  |  |  |  |  |  | "tag":"0x0120", | 
| 49 |  |  |  |  |  |  | "device":"/dev/cuaU0", | 
| 50 |  |  |  |  |  |  | "xdop":0.58, | 
| 51 |  |  |  |  |  |  | "ydop":0.96, | 
| 52 |  |  |  |  |  |  | "vdop":1.92, | 
| 53 |  |  |  |  |  |  | "tdop":1.14, | 
| 54 |  |  |  |  |  |  | "hdop":1.90, | 
| 55 |  |  |  |  |  |  | "gdop":2.93, | 
| 56 |  |  |  |  |  |  | "pdop":2.70, | 
| 57 |  |  |  |  |  |  | "satellites":[ | 
| 58 |  |  |  |  |  |  | {"PRN":17,"el":76,"az":174,"ss":34,"used":true}, | 
| 59 |  |  |  |  |  |  | {"PRN":28,"el":57,"az":38,"ss":30,"used":false}, | 
| 60 |  |  |  |  |  |  | {"PRN":27,"el":22,"az":314,"ss":18,"used":true}, | 
| 61 |  |  |  |  |  |  | {"PRN":7,"el":15,"az":127,"ss":29,"used":true}, | 
| 62 |  |  |  |  |  |  | {"PRN":15,"el":31,"az":297,"ss":27,"used":true}, | 
| 63 |  |  |  |  |  |  | {"PRN":11,"el":18,"az":54,"ss":28,"used":false}, | 
| 64 |  |  |  |  |  |  | {"PRN":24,"el":18,"az":63,"ss":29,"used":false}, | 
| 65 |  |  |  |  |  |  | {"PRN":9,"el":4,"az":313,"ss":18,"used":false}, | 
| 66 |  |  |  |  |  |  | {"PRN":8,"el":45,"az":117,"ss":33,"used":true}, | 
| 67 |  |  |  |  |  |  | {"PRN":26,"el":49,"az":245,"ss":37,"used":true}, | 
| 68 |  |  |  |  |  |  | {"PRN":4,"el":5,"az":170,"ss":17,"used":false}, | 
| 69 |  |  |  |  |  |  | {"PRN":138,"el":44,"az":157,"ss":40,"used":true} | 
| 70 |  |  |  |  |  |  | ] | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 METHODS PROPERTIES | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head2 class | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | Returns the object class | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head2 string | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | Returns the JSON string | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =head2 parent | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | Return the parent Net::GPSD object | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =head2 device | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =cut | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 1 |  |  | 1 | 1 | 5 | sub device {shift->{"device"}}; | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =head2 tag | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =cut | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 1 |  |  | 1 | 1 | 4 | sub tag {shift->{"tag"}}; | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head2 time | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head2 timestamp | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head2 datetime | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head2 reported | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | Count of satellites in view | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =cut | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | sub reported { | 
| 112 | 1 |  |  | 1 | 1 | 3 | my $self=shift; | 
| 113 | 1 | 50 |  |  |  | 5 | $self->{"reported"}=scalar(@{$self->satellites}) | 
|  | 1 |  |  |  |  | 4 |  | 
| 114 |  |  |  |  |  |  | unless defined $self->{"reported"}; | 
| 115 | 1 |  |  |  |  | 6 | return $self->{"reported"}; | 
| 116 |  |  |  |  |  |  | } | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =head2 used | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | Count of satellites used in calculation | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =cut | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | sub used { | 
| 125 | 1 |  |  | 1 | 1 | 10 | my $self=shift; | 
| 126 | 1 | 50 |  |  |  | 13 | $self->{"used"}=scalar(@{[grep {$_->{"used"}} $self->satellites]}) | 
|  | 1 |  |  |  |  | 8 |  | 
|  | 12 |  |  |  |  | 150 |  | 
| 127 |  |  |  |  |  |  | unless defined $self->{"used"}; | 
| 128 | 1 |  |  |  |  | 20 | return $self->{"used"}; | 
| 129 |  |  |  |  |  |  | } | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =head2 satellites | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | Returns a list of satellite data structures. | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | my $satellites=$sky->satellites(); #[{},...] | 
| 136 |  |  |  |  |  |  | my @satellites=$sky->satellites(); #({},...) | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | =cut | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | sub satellites { | 
| 141 | 7 |  |  | 7 | 1 | 1786 | my $self=shift; | 
| 142 | 7 | 50 |  |  |  | 35 | unless (ref($self->{"satellites"}) eq "ARRAY") { | 
| 143 | 0 |  |  |  |  | 0 | $self->{"satellites"}=[]; | 
| 144 |  |  |  |  |  |  | } | 
| 145 | 7 | 100 |  |  |  | 24 | return wantarray ? @{$self->{"satellites"}} : $self->{"satellites"}; | 
|  | 5 |  |  |  |  | 28 |  | 
| 146 |  |  |  |  |  |  | } | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =head2 Satellites | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | Returns a list of L objects. | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | my @satellites=$sky->Satellites; #(bless{},...) | 
| 153 |  |  |  |  |  |  | my $satellites=$sky->Satellites; #[bless{},...] | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =cut | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | sub Satellites { | 
| 158 | 4 |  |  | 4 | 1 | 998 | my $self=shift; | 
| 159 | 4 | 100 |  |  |  | 17 | unless (defined($self->{"Satellites"})) { | 
| 160 | 36 |  |  |  |  | 140 | $self->{"Satellites"}=[ | 
| 161 | 36 |  |  |  |  | 56 | map {$self->parent->constructor(%$_, | 
| 162 |  |  |  |  |  |  | class=>"Satellite", | 
| 163 |  |  |  |  |  |  | string=>$self->parent->encode($_))} | 
| 164 | 3 |  |  |  |  | 11 | grep {ref($_) eq "HASH"} $self->satellites]; | 
| 165 |  |  |  |  |  |  | } | 
| 166 | 4 | 100 |  |  |  | 27 | return wantarray ? @{$self->{"Satellites"}} : $self->{"Satellites"}; | 
|  | 1 |  |  |  |  | 8 |  | 
| 167 |  |  |  |  |  |  | } | 
| 168 |  |  |  |  |  |  |  | 
| 169 |  |  |  |  |  |  | =head1 BUGS | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | Log on RT and Send to gpsd-dev email list | 
| 172 |  |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  | =head1 SUPPORT | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | DavisNetworks.com supports all Perl applications including this package. | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | Try gpsd-dev email list | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | =head1 AUTHOR | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | Michael R. Davis | 
| 182 |  |  |  |  |  |  | CPAN ID: MRDVT | 
| 183 |  |  |  |  |  |  | STOP, LLC | 
| 184 |  |  |  |  |  |  | domain=>michaelrdavis,tld=>com,account=>perl | 
| 185 |  |  |  |  |  |  | http://www.stopllc.com/ | 
| 186 |  |  |  |  |  |  |  | 
| 187 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 188 |  |  |  |  |  |  |  | 
| 189 |  |  |  |  |  |  | This program is free software licensed under the... | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | The BSD License | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | The full text of the license can be found in the LICENSE file included with this module. | 
| 194 |  |  |  |  |  |  |  | 
| 195 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | L, L, L | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | =cut | 
| 200 |  |  |  |  |  |  |  | 
| 201 |  |  |  |  |  |  | 1; |