lib/Ekahau.pm

filter: Statementstmt 84.8% 101 / 119 Branchbran 59.5% 50 / 84 Conditioncond 43.5% 17 / 39 MC/DCmcdc 6.2% 1 / 16 Subroutinesub 100% 20 / 20 Podpod 100% 16 / 16 totaltotal 69.7% 205 / 294 CC 57 SCAR 23.8
CC
57
Cov
69%
_respmatch
31.6
getresponse
15.0
get_device_list
6.6
CRAP 10.8
« lib/Ekahau/Base.pm ↑ Summary lib/Ekahau/Server/Test.pm »
1 package Ekahau;
2 13 ▶use base 'Ekahau::Base'; our $VERSION = $Ekahau::Base::VERSION;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # Written by Scott Gifford <gifford@umich.edu>
5 # Copyright (C) 2004 The Regents of the University of Michigan.
6 # See the file LICENSE included with the distribution for license
7 # information.
8  
9 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 Ekahau - Synchronous interface to Ekahau location sensing system
15  
16 =head1 SYNOPSIS
17  
18 The C<Ekahau> class provides a straightforward synchronous interface
19 to the Ekahau location sensing system's YAX protocol. The YAX
20 protocol itself is asynchronous, so this module tries its best to hide
21 that from you.
22  
23 This class inherits from L<Ekahau::Base|Ekahau::Base>, and you can use methods from
24 that class. An alternative, event-driven interface is provided by
25 L<Ekahau::Events|Ekahau::Events>.
26  
27 =head1 DESCRIPTION
28  
29 This class implements methods for querying the Ekahau Positioning
30 Engine, and processing the responses. Each C<Ekahau> object
31 represents a connection to the Ekahau server. Some methods send
32 queries to the server, others receive responses, and still others do
33 both. This class tries to hide the asynchronousness of the YAX
34 protocol from you.
35  
36 The basic mechanism allows you to send requests, and wait for
37 responses. If other responses unrelated to the one you're waiting for
38 come in, they will be queued and sent to you when you ask for them.
39 Some methods will first send a request then wait for the response,
40 handling all of the details internally.
41  
42 =head2 Constructor
43  
44 This classes uses L<Ekahau::Base::new|Ekahau::Base/new> as its constructor.
45  
46 =head2 Methods
47  
48 =head3 getresponse ( [ $tags ], [ $cmds ] )
49  
50 Get the next L<Ekahau::Response|Ekahau::Response> matching the given tags and commands.
51 If you specify neither tags nor commands, the next response will be
52 returned. If you specify just one of the two, responses will only be
53 matched against the one specified. If you specify both, responses
54 must match one of the tags, and one of the commands.
55  
56 Both C<$tags> and C<$cmds> should be list references.
57  
58 Examples:
59  
60 $obj->getresponse(); # Next response
61 $obj->getresponse(['LOC','AREA']); # Next response with LOC or AREA tag
62 $obj->getresponse([],['DEVICE_LIST']); # Next DEVICE_LIST response
63  
64 =cut
65  
66 sub getresponse
67 37 ▶{
Subroutine getresponse: called CC=13 SCAR=27.1
Pod documented
68 37 my $self = shift;
69 37 my ($tags,$cmds)=@_;
70  
71 37 ▶ my $tagmap = (($tags and @$tags) ? { map { $_ => 1 } @$tags } : undef);
Branch: 1 branch
BranchTrueFalseTotal
$tags && @$tags ? : 37 0 37
Condition33%1/3
$tags and @$tags
!ll&&!rl&&r
0037
MC/DC0%0/2
$tags and @$tags
$tags @$tags
Truth table33%1/3
A and B
A= $tagsB= @$tags
ABresult
0X0
100
111
72 0 ▶ my $cmdmap = (($cmds and @$cmds) ? { map { $_ => 1 } @$cmds } : undef);
Branch: 1 branch
BranchTrueFalseTotal
$cmds && @$cmds ? : 0 37 37
Condition33%1/3
$cmds and @$cmds
!ll&&!rl&&r
3700
MC/DC0%0/2
$cmds and @$cmds
$cmds @$cmds
Truth table33%1/3
A and B
A= $cmdsB= @$cmds
ABresult
0X0
100
111
73  
74 # See if we have something on the queue already
75 37 ▶ if ($self->{_q})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_q"}) 8 29 37
76 {
77 8 foreach my $i (0..$#{$self->{_q}})
78 {
79 10 ▶ if (_respmatch($self->{_q}[$i],$tagmap,$cmdmap))
Branch: 1 branch
BranchTrueFalseTotal
if (_respmatch($self->{"_q"}[$i], $tagmap, $cmdmap)) 2 8 10
80 {
81 2 return splice(@{$self->{_q}},$i,1);
82 }
83 }
84 }
85  
86 # Wait until we get something, or the timeout expires.
87 35 my $started = time;
88 35 while(1)
89 {
90 75 ▶ while (my $resp = $self->getpending)
Branch: 1 branch
BranchTrueFalseTotal
if (my $resp = $self->getpending) 38 40 78
91 {
92 38 ▶ return $resp if (_respmatch($resp,$tagmap,$cmdmap));
Branch: 1 branch
BranchTrueFalseTotal
if _respmatch($resp, $tagmap, $cmdmap) 35 3 38
93 3 push @{$self->{_q}},$resp;
94 }
95 # See if we timed out.
96 40 ▶ $self->can_read($self->{_timeout}?($self->{_timeout}-(time-$started)):0)
Branch: 2 branches
BranchTrueFalseTotal
$self->can_read($self->{"_timeout"} ? $self->{"_timeout"} - (time - $started) : 0) or return undef 40 0 40
$self->{'_timeout'} ? : 40 0 40
97 or return undef;
98
99 40 ▶ $self->readsome()
Branch: 1 branch
BranchTrueFalseTotal
$self->readsome or return undef 40 0 40
100 or return undef;
101 }
102 }
103  
104 =head3 gettaggedresponse ( @tags )
105  
106 Get the next L<Ekahau::Response|Ekahau::Response> matching any of the given tags. This
107 is exactly equivalent to:
108  
109 $self->getresponse([@_]);
110  
111 =cut
112  
113 sub gettaggedresponse
114 37 ▶{
Subroutine gettaggedresponse: called CC=1 SCAR=0.0
Pod documented
115 37 my $self = shift;
116 37 $self->getresponse([@_]);
117 }
118  
119 sub _respmatch
120 48 ▶{
Subroutine _respmatch: called CC=12 SCAR=34.5
121 48 my($resp,$tagmap,$cmdmap) = @_;
122 return ((!$tagmap and !$cmdmap)
123 or (!$cmdmap and $resp->{tag} and $tagmap->{$resp->{tag}})
124 or (!$tagmap and $resp->{cmd} and $cmdmap->{$resp->{cmd}})
125 48 ▶ or ($resp->{cmd} and $resp->{tag} and $tagmap->{$resp->{tag}} and $cmdmap->{$resp->{cmd}}));
Condition45%15/33
!($tagmap || $cmdmap) || !$cmdmap && $resp->{'tag'} && $$tagmap{$resp->{'tag'}} || !$tagmap && $resp->{'cmd'} && $$cmdmap{$resp->{'cmd'}} || $resp->{'cmd'} && $resp->{'tag'} && $$tagmap{$resp->{'tag'}} && $$cmdmap{$resp->{'cmd'}}
l!l&&r!l&&!r
37011
not $tagmap || $cmdmap or not $cmdmap and $resp->{"tag"} and $$tagmap{$resp->{"tag"}} or not $tagmap and $resp->{"cmd"} and $$cmdmap{$resp->{"cmd"}}
l!l&&r!l&&!r
37011
not $tagmap || $cmdmap or not $cmdmap and $resp->{"tag"} and $$tagmap{$resp->{"tag"}}
l!l&&r!l&&!r
03711
$tagmap || $cmdmap
l!l&&r!l&&!r
4800
not $cmdmap and $resp->{"tag"} and $$tagmap{$resp->{"tag"}}
!ll&&!rl&&r
01137
not $cmdmap and $resp->{"tag"}
!ll&&!rl&&r
0048
not $tagmap and $resp->{"cmd"} and $$cmdmap{$resp->{"cmd"}}
!ll&&!rl&&r
1100
not $tagmap and $resp->{"cmd"}
!ll&&!rl&&r
1100
$resp->{"cmd"} and $resp->{"tag"} and $$tagmap{$resp->{"tag"}} and $$cmdmap{$resp->{"cmd"}}
!ll&&!rl&&r
1100
$resp->{"cmd"} and $resp->{"tag"} and $$tagmap{$resp->{"tag"}}
!ll&&!rl&&r
0110
$resp->{"cmd"} and $resp->{"tag"}
!ll&&!rl&&r
0011
MC/DC8%1/12
!($tagmap || $cmdmap) || !$cmdmap && $resp->{'tag'} && $$tagmap{$resp->{'tag'}} || !$tagmap && $resp->{'cmd'} && $$cmdmap{$resp->{'cmd'}} || $resp->{'cmd'} && $resp->{'tag'} && $$tagmap{$resp->{'tag'}} && $$cmdmap{$resp->{'cmd'}}
$tagmap $cmdmap not $cmdmap $resp->{"tag"} $$tagmap{$resp->{"tag"}} not $tagmap $resp->{"cmd"} $$cmdmap{$resp->{"cmd"}} $resp->{"cmd"} $resp->{"tag"} $$tagmap{$resp->{"tag"}} $$cmdmap{$resp->{"cmd"}}
Truth table2%2/99
not(A || B) or not(C) and D and E or not(F) and G and H || I and J and K and L
A= $tagmapB= $cmdmapC= not $cmdmapD= $resp->{"tag"}E= $$tagmap{$resp->{"tag"}}F= not $tagmapG= $resp->{"cmd"}H= $$cmdmap{$resp->{"cmd"}}I= $resp->{"cmd"}J= $resp->{"tag"}K= $$tagmap{$resp->{"tag"}}L= $$cmdmap{$resp->{"cmd"}}
ABCDEFGHIJKLresult
00XXXXXXXXXX1
1X111XXXXXXX1
01111XXXXXXX1
1X0XX111XXXX1
1X10X111XXXX1
1X110111XXXX1
010XX111XXXX1
0110X111XXXX1
01110111XXXX1
1X0XX0XX11111
1X0XX10X11111
1X0XX11011111
1X10X0XX11111
1X10X10X11111
1X10X11011111
1X1100XX11111
1X11010X11111
1X11011011111
010XX0XX11111
010XX10X11111
010XX11011111
0110X0XX11111
0110X10X11111
0110X11011111
011100XX11111
0111010X11111
0111011011111
1X0XX0XX0XXX0
1X0XX0XX10XX0
1X0XX0XX110X0
1X0XX0XX11100
1X0XX10X0XXX0
1X0XX10X10XX0
1X0XX10X110X0
1X0XX10X11100
1X0XX1100XXX0
1X0XX11010XX0
1X0XX110110X0
1X0XX11011100
1X10X0XX0XXX0
1X10X0XX10XX0
1X10X0XX110X0
1X10X0XX11100
1X10X10X0XXX0
1X10X10X10XX0
1X10X10X110X0
1X10X10X11100
1X10X1100XXX0
1X10X11010XX0
1X10X110110X0
1X10X11011100
1X1100XX0XXX0
1X1100XX10XX0
1X1100XX110X0
1X1100XX11100
1X11010X0XXX0
1X11010X10XX0
1X11010X110X0
1X11010X11100
1X1101100XXX0
1X11011010XX0
1X110110110X0
1X11011011100
010XX0XX0XXX0
010XX0XX10XX0
010XX0XX110X0
010XX0XX11100
010XX10X0XXX0
010XX10X10XX0
010XX10X110X0
010XX10X11100
010XX1100XXX0
010XX11010XX0
010XX110110X0
010XX11011100
0110X0XX0XXX0
0110X0XX10XX0
0110X0XX110X0
0110X0XX11100
0110X10X0XXX0
0110X10X10XX0
0110X10X110X0
0110X10X11100
0110X1100XXX0
0110X11010XX0
0110X110110X0
0110X11011100
011100XX0XXX0
011100XX10XX0
011100XX110X0
011100XX11100
0111010X0XXX0
0111010X10XX0
0111010X110X0
0111010X11100
011101100XXX0
0111011010XX0
01110110110X0
0111011011100
126  
127 }
128  
129 =head3 get_device_list ( )
130  
131 Get a list of devices currently detected on the Ekahau system. The
132 response is returned as a reference to a list of numeric IDs. On
133 error, this method will return C<undef>.
134  
135 =cut
136  
137 sub get_device_list
138 9 ▶{
Subroutine get_device_list: called CC=5 SCAR=18.9
Pod documented
139 9 my $self = shift;
140  
141 9 ▶ my $tag = $self->request_device_list
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_device_list or return undef 9 0 9
142 or return undef;
143 9 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 9 0 9
144 or return undef;
145
146 9 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 0 9 9
elsif ($resp->type ne 'DeviceList') { } 0 9 9
147 {
148 0 return $self->reterr("GET_DEVICE_LIST failed: ".$resp->error_description);
149 }
150 elsif ($resp->type ne 'DeviceList')
151 {
152 0 return $self->reterr("GET_DEVICE_LIST failed: unexpected response!");
153 }
154  
155 9 return [$resp->devices];
156 }
157  
158 =head3 get_device_properties ( $device_id )
159  
160 Get the properties for the device with the given ID. Returns an
161 L<Ekahau::Response|Ekahau::Response> object.
162  
163 =cut
164  
165 sub get_device_properties
166 3 ▶{
Subroutine get_device_properties: called CC=5 SCAR=17.0
Pod documented
167 3 my $self = shift;
168  
169 3 ▶ my $tag = $self->request_device_properties(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_device_properties(@_) or return undef 3 0 3
170 or return undef;
171 3 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 3 0 3
172 or return undef;
173  
174 3 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 1 2 3
elsif ($resp->type ne 'DeviceProperties') { } 0 2 2
175 {
176 1 return $self->reterr("GET_DEVICE_PROPERTIES failed: ".$resp->error_description);
177 }
178 elsif ($resp->type ne 'DeviceProperties')
179 {
180 0 return $self->reterr("GET_DEVICE_PROPERTIES failed: unexpected response of type ".$resp->type."!");
181 }
182
183 2 $resp;
184 }
185  
186 =head3 get_location_context ( $area_id )
187  
188 Get the properties of the area with the given ID. Returns an
189 L<Ekahau::Response|Ekahau::Response> object.
190  
191 =cut
192  
193 sub get_location_context
194 3 ▶{
Subroutine get_location_context: called CC=5 SCAR=17.3
Pod documented
195 3 my $self = shift;
196  
197 3 ▶ my $tag = $self->request_location_context(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_location_context(@_) or return undef 3 0 3
198 or return undef;
199 3 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 3 0 3
200 or return undef;
201  
202 3 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 1 2 3
elsif ($resp->type ne 'LocationContext') { } 0 2 2
203 {
204 1 $self->{err} = "GET_CONTEXT failed: ".$resp->error_description;
205 1 return undef;
206 }
207 elsif ($resp->type ne 'LocationContext')
208 {
209 0 $self->{err} = "GET_CONTEXT failed: unexpected response!";
210 0 return undef;
211 }
212
213 2 $resp;
214 }
215  
216 =head3 get_map_image ( $area_id )
217  
218 Get a map of the area with the given ID. Returns an
219 L<Ekahau::Response::MapImage|Ekahau::Response::MapImage> object.
220  
221 =cut
222  
223 sub get_map_image
224 3 ▶{
Subroutine get_map_image: called CC=5 SCAR=18.9
Pod documented
225 3 my $self = shift;
226  
227 3 ▶ my $tag = $self->request_map_image(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_map_image(@_) or return undef 3 0 3
228 or return undef;
229 3 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 3 0 3
230 or return undef;
231  
232 3 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 0 3 3
elsif ($resp->type ne 'MapImage') { } 0 3 3
233 {
234 0 return $self->reterr("GET_MAP failed: ".$resp->error_description);
235 }
236 elsif ($resp->type ne 'MapImage')
237 {
238 0 return $self->reterr("GET_MAP failed: unexpected response!");
239 }
240
241 3 $resp;
242 }
243  
244 =head3 get_all_areas ( )
245  
246 Returns a list of all logical areas, as an
247 L<Ekahau::Response::AreaList|Ekahau::Response::AreaList> object.
248  
249 =cut
250  
251 sub get_all_areas
252 1 ▶{
Subroutine get_all_areas: called CC=5 SCAR=18.9
Pod documented
253 1 my $self = shift;
254  
255 1 ▶ my $tag = $self->request_all_areas(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_all_areas(@_) or return undef 1 0 1
256 or return undef;
257 1 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 1 0 1
258 or return undef;
259  
260 1 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 0 1 1
elsif ($resp->type ne 'AreaList') { } 0 1 1
261 {
262 0 return $self->reterr("GET_LOGICAL_AREAS failed: ".$resp->error_description);
263 }
264 elsif ($resp->type ne 'AreaList')
265 {
266 0 return $self->reterr("GET_LOGICAL_AREAS failed: unexpected response!");
267 }
268
269 1 $resp;
270 }
271  
272  
273 =head3 start_location_track ( [ $properties ], $device)
274  
275 Start a continuous query tracking the location of the given device.
276 An optional hash reference containing properties for the query can be
277 given; see L<Ekahau::Base::start_location_track|Ekahau::Base/start_location_track> for details.
278  
279 You can get results with L<next_location|/next_location> or L<next_track|/next_track>.
280  
281 =cut
282  
283 sub start_location_track
284 3 ▶{
Subroutine start_location_track: called CC=2 SCAR=6.9
Pod documented
285 3 my $self = shift;
286 3 ▶ my %p = ref $_[0] ? %{ (shift) } : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 1 2 3
287 3 $p{Tag} = 'LOC';
288 3 $self->SUPER::start_location_track(\%p,@_);
289 }
290  
291 =head3 stop_location_track ($device)
292  
293 Stop a continuous query tracking the location of the given device.
294  
295 =cut
296  
297 sub stop_location_track
298 2 ▶{
Subroutine stop_location_track: called CC=5 SCAR=18.9
Pod documented
299 2 my $self = shift;
300
301 2 ▶ my $tag = $self->request_stop_location_track(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_stop_location_track(@_) or return undef 2 0 2
302 or return undef;
303 2 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 2 0 2
304 or return undef;
305  
306 2 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 0 2 2
elsif ($resp->type ne 'StopLocationTrackOK') { } 0 2 2
307 {
308 0 return $self->reterr("STOP_LOCATION_TRACK failed: ".$resp->error_description);
309 }
310 elsif ($resp->type ne 'StopLocationTrackOK')
311 {
312 0 return $self->reterr("STOP_LOCATION_TRACK failed: unexpected response '".$resp->type."!");
313 }
314  
315 2 $resp;
316 }
317  
318  
319 =head3 next_location ( )
320  
321 Return the next location for any of the continuous queries started by
322 calls to L<start_location_track|/start_location_track>. The returned value will be an
323 L<Ekahau::Response|Ekahau::Response> object, or C<undef> on error.
324  
325 =cut
326  
327 sub next_location
328 4 ▶{
Subroutine next_location: called CC=3 SCAR=12.7
Pod documented
329 4 my $self = shift;
330  
331 4 ▶ my $r = $self->gettaggedresponse('LOC')
Branch: 1 branch
BranchTrueFalseTotal
my $r = $self->gettaggedresponse("LOC") or return undef 4 0 4
332 or return undef;
333
334 4 ▶ if ($r->{cmd} ne 'LOCATION_ESTIMATE')
Branch: 1 branch
BranchTrueFalseTotal
if ($r->{"cmd"} ne "LOCATION_ESTIMATE") 0 4 4
335 {
336 0 return $self->reterr("LOCATION_ESTIMATE failed: $r->{cmd} @{$r->{args}}");
337 }
338 4 return $r;
339 }
340  
341 =head3 start_area_track ( [ $properties ], $device_id )
342  
343 Start a continuous query tracking the area where the given device is
344 located. An optional hash reference containing properties for the
345 query can be given; see L<Ekahau::Base::start_area_track|Ekahau::Base/start_area_track> for details.
346  
347 You can get results with L<next_area|/next_area> or L<next_track|/next_track>.
348  
349 =cut
350  
351 sub start_area_track
352 4 ▶{
Subroutine start_area_track: called CC=2 SCAR=6.9
Pod documented
353 4 my $self = shift;
354 4 ▶ my %p = ref $_[0] ? %{ (shift) } : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 2 2 4
355 4 $p{Tag} = 'AREA';
356  
357 4 $self->SUPER::start_area_track(\%p,@_);
358 }
359  
360 =head3 stop_area_track ($device)
361  
362 Stop a continuous query tracking the area of the given device.
363  
364 =cut
365  
366 sub stop_area_track
367 3 ▶{
Subroutine stop_area_track: called CC=5 SCAR=18.9
Pod documented
368 3 my $self = shift;
369
370 3 ▶ my $tag = $self->request_stop_area_track(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $tag = $self->request_stop_area_track(@_) or return undef 3 0 3
371 or return undef;
372 3 ▶ my $resp = $self->gettaggedresponse($tag)
Branch: 1 branch
BranchTrueFalseTotal
my $resp = $self->gettaggedresponse($tag) or return undef 3 0 3
373 or return undef;
374  
375 3 ▶ if ($resp->error)
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->error) { } 0 3 3
elsif ($resp->type ne 'StopAreaTrackOK') { } 0 3 3
376 {
377 0 return $self->reterr("STOP_AREA_TRACK failed: ".$resp->error_description);
378 }
379 elsif ($resp->type ne 'StopAreaTrackOK')
380 {
381 0 return $self->reterr("STOP_AREA_TRACK failed: unexpected response '".$resp->type."'!");
382 }
383  
384 3 $resp;
385 }
386  
387  
388 =head3 next_area ( )
389  
390 Return the next area for any of the continuous queries started by
391 calls to L<start_area_track|/start_area_track>. The returned value will be an
392 L<Ekahau::Response|Ekahau::Response> object, or C<undef> on error.
393  
394 =cut
395  
396 sub next_area
397 7 ▶{
Subroutine next_area: called CC=2 SCAR=7.9
Pod documented
398 7 my $self = shift;
399 7 my $r = $self->gettaggedresponse('AREA');
400
401 7 ▶ if ($r->{cmd} ne 'AREA_ESTIMATE')
Branch: 1 branch
BranchTrueFalseTotal
if ($r->{"cmd"} ne "AREA_ESTIMATE") 0 7 7
402 {
403 0 return $self->reterr("AREA_ESTIMATE failed: $r->{cmd} @{$r->{args}}");
404 }
405 7 return $r;
406 }
407  
408 =head3 start_track ( [ $properties ], $device_id )
409  
410 Start tracking both the location and the area of the given device, by
411 calling the L<start_location_track|/start_location_track> and L<start_area_track|/start_area_track> methods.
412  
413 An optional hash reference containing properties for the query can be
414 given. These properties will be passed on to both queries; if you
415 need different properties for the two queries call the methods
416 directly.
417  
418 Results can be obtained by calling the L<next_track|/next_track> method.
419  
420 =cut
421  
422 sub start_track
423 1 ▶{
Subroutine start_track: called CC=1 SCAR=0.0
Pod documented
424 1 my $self = shift;
425  
426 # Use temp variables so we can return the correct result,
427 # but still make sure we start both.
428 1 my $e1 = $self->start_location_track(@_);
429 1 my $e2 = $self->start_area_track(@_);
430  
431 1 return $e1 and $e2;
432 }
433  
434 =head3 stop_track ( $device_id )
435  
436 Stop tracking both the location and the area of the given device, by
437 calling the L<stop_location_track|/stop_location_track> and L<stop_area_track|/stop_area_track> methods.
438  
439 =cut
440  
441 sub stop_track
442 1 ▶{
Subroutine stop_track: called CC=1 SCAR=0.0
Pod documented
443 1 my $self = shift;
444  
445 # Use temp variables so we can return the correct result,
446 # but still make sure we start both.
447 1 my $e1 = $self->stop_location_track(@_);
448 1 my $e2 = $self->stop_area_track(@_);
449  
450 1 return $e1 and $e2;
451 }
452  
453  
454 =head3 next_track ( )
455  
456 Return the next location or area for any of the continuous queries
457 started by calls to L<start_track|/start_track>, L<start_location_track|/start_location_track>, or
458 L<start_area_track|/start_area_track>. The returned value will be an
459 L<Ekahau::Response|Ekahau::Response> object, or C<undef> on error.
460  
461 =cut
462  
463 sub next_track
464 2 ▶{
Subroutine next_track: called CC=1 SCAR=0.0
Pod documented
465 2 my $self = shift;
466 2 my(%p)=@_;
467  
468 2 return $self->gettaggedresponse('LOC','AREA');
469 }
470  
471  
472 13 1;
473  
474 =head1 AUTHOR
475  
476 Scott Gifford E<lt>gifford@umich.eduE<gt>, E<lt>sgifford@suspectclass.comE<gt>
477  
478 Copyright (C) 2005 The Regents of the University of Michigan.
479  
480 See the file LICENSE included with the distribution for license
481 information.
482  
483  
484 =head1 SEE ALSO
485  
486 L<Ekahau::Base|Ekahau::Base>, L<Ekahau::Events|Ekahau::Events>.
487  
488 =cut
« lib/Ekahau/Base.pm ↑ Summary lib/Ekahau/Server/Test.pm »