line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::GPSD3::POE; |
2
|
1
|
|
|
1
|
|
1511953
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
7
|
use base qw{Net::GPSD3}; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
80
|
|
5
|
1
|
|
|
1
|
|
1086
|
use POE::Session; |
|
1
|
|
|
|
|
4726
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
1180
|
use POE::Wheel::ReadWrite; |
|
1
|
|
|
|
|
200827
|
|
|
1
|
|
|
|
|
36
|
|
7
|
1
|
|
|
1
|
|
11
|
use POE::Filter::Line; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
8
|
1
|
|
|
1
|
|
7
|
use POE::Kernel; #exports $poe_kernel |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION='0.17'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Net::GPSD3::POE - Net::GPSD3 POE Session object |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use POE; |
19
|
|
|
|
|
|
|
use Net::GPSD3::POE; |
20
|
|
|
|
|
|
|
my $gpsd=Net::GPSD3::POE->new; |
21
|
|
|
|
|
|
|
#$gpsd->addHandler; |
22
|
|
|
|
|
|
|
$gpsd->session; |
23
|
|
|
|
|
|
|
#other POE::Sessions... |
24
|
|
|
|
|
|
|
POE::Kernel->run; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
One Liner |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
perl -MPOE -MNet::GPSD3::POE -e 'Net::GPSD3::POE->new->session;POE::Kernel->run;' |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This package adds a L capabilty to Net::GPSD3. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 session |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Configures and returns the POE::Session ID |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub session { |
43
|
0
|
|
|
0
|
1
|
|
my $self=shift; #ISA Net::GPSD::POE |
44
|
0
|
0
|
|
|
|
|
$self->{"session"}=POE::Session->create( |
45
|
|
|
|
|
|
|
object_states => [ |
46
|
|
|
|
|
|
|
$self => { |
47
|
|
|
|
|
|
|
_start => '_session_start', |
48
|
|
|
|
|
|
|
_stop => '_session_stop', |
49
|
|
|
|
|
|
|
shutdown => '_session_shutdown', |
50
|
|
|
|
|
|
|
input_event => '_event_handler', |
51
|
|
|
|
|
|
|
pause => 'pause', |
52
|
|
|
|
|
|
|
resume => 'resume', |
53
|
|
|
|
|
|
|
}])->ID unless $self->{"session"}; |
54
|
0
|
|
|
|
|
|
return $self->{"session"}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _session_start { |
58
|
0
|
|
|
0
|
|
|
my $self=shift; |
59
|
0
|
|
|
|
|
|
$self->{"wheel"}=POE::Wheel::ReadWrite->new( |
60
|
|
|
|
|
|
|
InputEvent => "input_event", |
61
|
|
|
|
|
|
|
Handle => $self->socket, |
62
|
|
|
|
|
|
|
Filter => POE::Filter::Line->new( |
63
|
|
|
|
|
|
|
InputLiteral => "\r\n", |
64
|
|
|
|
|
|
|
OutputLiteral => "\n", |
65
|
|
|
|
|
|
|
), |
66
|
|
|
|
|
|
|
); |
67
|
0
|
|
|
|
|
|
$self->resume; |
68
|
0
|
|
|
|
|
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 resume |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Resumes or starts the watcher stream but not the socket |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub resume { |
78
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
79
|
0
|
0
|
|
|
|
|
if ($self->{"wheel"}) { |
80
|
0
|
|
|
|
|
|
$self->{"wheel"}->put($self->_watch_string_on); |
81
|
0
|
0
|
|
|
|
|
delete $self->{"paused"} if exists $self->{"paused"}; |
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
|
return $self; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 pause |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Pauses or turns off the watcher stream but not the socket |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub pause { |
93
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
94
|
0
|
0
|
|
|
|
|
unless ($self->{"paused"}) { |
95
|
0
|
0
|
|
|
|
|
$self->{"wheel"}->put($self->_watch_string_off) |
96
|
|
|
|
|
|
|
if $self->{"wheel"}; |
97
|
0
|
|
|
|
|
|
$self->{"paused"}=1; #Should we get this from the WATCH return? |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
|
return $self; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _session_stop { |
103
|
0
|
|
|
0
|
|
|
my $self=shift; |
104
|
0
|
0
|
|
|
|
|
$poe_kernel->call($self->{"session"}, "shutdown") |
105
|
|
|
|
|
|
|
if $self->{"session"}; |
106
|
0
|
|
|
|
|
|
return $self; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub _session_shutdown { |
110
|
0
|
|
|
0
|
|
|
my $self=$_[OBJECT]; |
111
|
0
|
|
|
|
|
|
return delete $self->{"wheel"}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _event_handler { |
115
|
0
|
|
|
0
|
|
|
my ($self, $line)=@_[OBJECT, ARG0]; |
116
|
0
|
|
|
|
|
|
my @handler=$self->handlers; |
117
|
0
|
0
|
|
|
|
|
push @handler, \&Net::GPSD3::default_handler unless scalar(@handler); |
118
|
0
|
|
|
|
|
|
my $object=$self->constructor($self->decode($line), string=>$line); |
119
|
0
|
|
|
|
|
|
$_->($object) foreach @handler; |
120
|
0
|
|
|
|
|
|
$self->cache($object); |
121
|
0
|
|
|
|
|
|
return $self; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 BUGS |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Log on RT and Send to gpsd-dev email list |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SUPPORT |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
DavisNetworks.com supports all Perl applications including this package. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Try gpsd-dev email list |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Michael R. Davis |
137
|
|
|
|
|
|
|
CPAN ID: MRDVT |
138
|
|
|
|
|
|
|
STOP, LLC |
139
|
|
|
|
|
|
|
domain=>michaelrdavis,tld=>com,account=>perl |
140
|
|
|
|
|
|
|
http://www.stopllc.com/ |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 COPYRIGHT |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This program is free software licensed under the... |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The BSD License |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 SEE ALSO |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L, L, L, L, L |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |