lib/Ekahau/Response/Error.pm

filter: Statementstmt 94.4% 137 / 145 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 91.6% 44 / 48 Podpod 88.8% 8 / 9 totaltotal 92.4% 195 / 211 CC 5 SCAR 3.0
CC
5
Cov
93%
init
4.0
error_info
2.1
error_level
2.0
CRAP 1.3
« lib/Ekahau/Response/StopLocationTrackOK.pm ↑ Summary lib/Ekahau/Response/DeviceList.pm »
1 package Ekahau::Response::Error;
2 15 ▶use base 'Ekahau::Response'; our $VERSION=Ekahau::Response::VERSION;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 15 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # Written by Scott Gifford <gifford@umich.edu>
6 # Copyright (C) 2004 The Regents of the University of Michigan.
7 # See the file LICENSE included with the distribution for license
8 # information.
9  
10 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 Ekahau::Response::Error - An error response from Ekahau
16  
17 =head1 SYNOPSIS
18  
19 Contains information about an error returned by the Ekahau Positioning
20 Engine.
21  
22 =head1 DESCRIPTION
23  
24 =head2 Constructor
25  
26 Generally you will not want to construct these objects yourself; they
27 are created by L<Ekahau::Response|Ekahau::Response>, and use its constructor.
28  
29 =head2 Methods
30  
31 =cut
32  
33  
34 15 ▶use constant EKAHAU_ERR_WARNING => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 15 ▶use constant EKAHAU_ERR_ERROR => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 15 ▶use constant EKAHAU_ERR_FATAL => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 # Error codes
39 # Generated by:
40 # perl -MEkahau::Response::Error -e 'while(my($k,$v) = each(%Ekahau::Response::Error::codenames)) { print "use constant EKAHAU_ERR_$v->[0] => $k;\n"; }'
41 15 ▶use constant EKAHAU_ERR_DEVICE_NOT_TRACKED => -600;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 15 ▶use constant EKAHAU_ERR_HARDWARE_FAILURE => -6;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 15 ▶use constant EKAHAU_ERR_ORDER_PRODUCT_TIMEOUT => -304;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 15 ▶use constant EKAHAU_ERR_AUTHENTICATION_FAILED => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 15 ▶use constant EKAHAU_ERR_CONSUMER_TASK_NOT_STARTED => -302;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 15 ▶use constant EKAHAU_ERR_MALFORMED_REQUEST => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 15 ▶use constant EKAHAU_ERR_DATABASE_VERSION_CLASH => -602;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 15 ▶use constant EKAHAU_ERR_UNKNOWN_PRODUCT => -301;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 15 ▶use constant EKAHAU_ERR_ORDER_REPLY_TIMEOUT => -303;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 15 ▶use constant EKAHAU_ERR_UDP_SEND_ERROR => -3;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 15 ▶use constant EKAHAU_ERR_AUTH_TIMEOUT => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 15 ▶use constant EKAHAU_ERR_CLIENT_DEVICE_REMOVED => -5;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 15 ▶use constant EKAHAU_ERR_UNSUPPORTED_PROTOCOL => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 15 ▶use constant EKAHAU_ERR_PRODUCTION_FAILED => -305;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 15 ▶use constant EKAHAU_ERR_CLIENT_CANNOT_MEASURE_DATA => -4;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 15 ▶use constant EKAHAU_ERR_CONTEXT_NOT_FOUND => -1001;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 15 ▶use constant EKAHAU_ERR_LICENSE_VIOLATION => 4;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 15 ▶use constant EKAHAU_ERR_PRODUCER_NOT_RESPONDING => -307;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 15 ▶use constant EKAHAU_ERR_DEVICE_LIMIT_EXCEEDED => -2;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 15 ▶use constant EKAHAU_ERR_DEVICE_NOT_FOUND => -601;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 15 ▶use constant EKAHAU_ERR_AGENT_LOOKUP_FAILED => -300;
Subroutine BEGIN: called CC=1 SCAR=0.0
62 15 ▶use constant EKAHAU_ERR_EMPTY_MODEL => -306;
Subroutine BEGIN: called CC=1 SCAR=0.0
63 15 ▶use constant EKAHAU_ERR_ACCESS_DENIED => 5;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 15 ▶use constant EKAHAU_ERR_CONSUMER_NOT_RESPONDING => -308;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 15 ▶use constant EKAHAU_ERR_DEVICE_NOT_RESPONDING => -1;
Subroutine BEGIN: called CC=1 SCAR=0.0
66  
67 # Many of these codes generated by
68 # perl -MEkahau::Response::Error -e 'while(my($k,$v) = each(%Ekahau::Response::Error::codenames)) { print "$v->[0] "; }'
69  
70 15 our %EXPORT_TAGS = (codes => [qw(
71  
72 EKAHAU_ERR_WARNING EKAHAU_ERR_ERROR EKAHAU_ERR_FATAL
73  
74 DEVICE_NOT_TRACKED ERR_HARDWARE_FAILURE ORDER_PRODUCT_TIMEOUT
75 EKAHAU_ERR_AUTHENTICATION_FAILED CONSUMER_TASK_NOT_STARTED
76 EKAHAU_ERR_MALFORMED_REQUEST DATABASE_VERSION_CLASH UNKNOWN_PRODUCT
77 ORDER_REPLY_TIMEOUT UDP_SEND_ERROR EKAHAU_ERR_AUTH_TIMEOUT
78 CLIENT_DEVICE_REMOVED EKAHAU_ERR_UNSUPPORTED_PROTOCOL
79 PRODUCTION_FAILED CLIENT_CANNOT_MEASURE_DATA
80 EKAHAU_ERR_CONTEXT_NOT_FOUND EKAHAU_ERR_LICENSE_VIOLATION
81 PRODUCER_NOT_RESPONDING DEVICE_LIMIT_EXCEEDED DEVICE_NOT_FOUND
82 AGENT_LOOKUP_FAILED EMPTY_MODEL EKAHAU_ERR_ACCESS_DENIED
83 CONSUMER_NOT_RESPONDING DEVICE_NOT_RESPONDING
84  
85 )]);
86  
87 15 our @EXPORT_OK = (@{$EXPORT_TAGS{codes}});
88  
89 15 ▶use constant CODENAME_NAME => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 15 ▶use constant CODENAME_DESCRIPTION => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
91 15 ▶use constant CODENAME_EXPLANATION => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 15 ▶use constant DEFAULT_ERROR_NAME => 'UNKNOWN_ERROR';
Subroutine BEGIN: called CC=1 SCAR=0.0
94 15 ▶use constant DEFAULT_ERROR_DESCRIPTION => 'Unknown Error';
Subroutine BEGIN: called CC=1 SCAR=0.0
95 15 ▶use constant DEFAULT_ERROR_EXPLANATION => 'No explanation available for this error.';
Subroutine BEGIN: called CC=1 SCAR=0.0
96 15 ▶use constant DEFAULT_ERROR_INFO => [DEFAULT_ERROR_NAME,DEFAULT_ERROR_DESCRIPTION,DEFAULT_ERROR_EXPLANATION];
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 # This is the canonical location for this information.
99 15 our %codenames = (
100 -600 => ['DEVICE_NOT_TRACKED','Device Not Tracked','The device is not being tracked'],
101 -601 => ['DEVICE_NOT_FOUND','Device Not Found','The device has not been detected by the Positioning Engine'],
102 -602 => ['DATABASE_VERSION_CLASH','Database Version Clash','Internal error, the system could not update the model database. Requires restarting the software'],
103 -303 => ['ORDER_REPLY_TIMEOUT','Order Reply Timeout','The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get a EKAHAU_ERR_DEVICE_NOT_RESPONDING error first.'],
104 -304 => ['ORDER_PRODUCT_TIMEOUT','Order Product Timeout','The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get -1 error first.'],
105 -306 => ['EMPTY_MODEL','Empty Model','Create a positioning model with Ekahau Manager and save it to the Positioning Engine'],
106 -307 => ['PRODUCER_NOT_RESPONDING','Producer Not Responding','The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get -1 error first.'],
107 -308 => ['CONSUMER_NOT_RESPONDING','Consumer Not Responding','The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get -1 error first.'],
108 -300 => ['AGENT_LOOKUP_FAILED','Agent Lookup Failed','If this occurs, contact Ekahau support.'],
109 -301 => ['UNKNOWN_PRODUCT','Unknown Product','If this occurs, contact Ekahau support.'],
110 -302 => ['CONSUMER_TASK_NOT_STARTED','Consumer Task Not Started','If this occurs, contact Ekahau support.'],
111 -305 => ['PRODUCTION_FAILED','Production Failed','If this occurs, contact Ekahau support.'],
112 -1 => ['DEVICE_NOT_RESPONDING','Device Not Responding','No data (any UDP packets) has been received from the device'],
113 -2 => ['DEVICE_LIMIT_EXCEEDED','Device Limit Exceeded','Device limit (how many devices your license allows you to track) is exceeded.'],
114 -3 => ['UDP_SEND_ERROR','UDP Send Error','Could not send UDP packet'],
115 -4 => ['CLIENT_CANNOT_MEASURE_DATA','Client Cannot Measure Data','Ekahau Client can not get signal information from the network adapter.'],
116 -5 => ['CLIENT_DEVICE_REMOVED','Client Device Removed','Network adapter has been removed from the client device.'],
117 -6 => ['HARDWARE_FAILURE','Hardware Failure','Network adapter has an internal error.'],
118 -1001 => ['CONTEXT_NOT_FOUND','Location Context Not Found','No location context exists for the requested context ID'],
119 1 => ['MALFORMED_REQUEST','Malformed Request','The Ekahau engine expected HELLO and TALK commands but received something else.'],
120 2 => ['AUTHENTICATION_FAILED','Authentication Failed','Password or license is wrong.'],
121 3 => ['UNSUPPORTED_PROTOCOL','Unsupported protocol','The requested protocol was not found.'],
122 4 => ['LICENSE_VIOLATION','License Violation','Too many open sockets for your license.'],
123 5 => ['ACCESS_DENIED','Access Denied','Authentication was OK, but the connect was refused either because your IP address is not allowed to connect, or because the server is too busy.'],
124 6 => ['AUTH_TIMEOUT','Authentication timeout','HELLO and TALK commands were not sent quickly enough'],
125 );
126  
127 # Internal method
128 sub init
129 15 ▶{
Subroutine init: called CC=4 SCAR=13.9
Pod undocumented
130 15 my $self = shift;
131  
132 warn "Created Ekahau::Response::Error object\n"
133 15 ▶ if ($ENV{VERBOSE});
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"VERBOSE"} 0 15 15
134  
135 15 ▶ if ($self->{cmd} eq 'CONTEXT_NOT_FOUND')
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'cmd'} eq 'CONTEXT_NOT_FOUND') { } 2 13 15
elsif ($self->{'cmd'} eq 'FAILURE') { } 8 5 13
136 {
137 # This isn't really an error, but we treat it as one.
138 2 $self->{params}{errorCode} = EKAHAU_ERR_CONTEXT_NOT_FOUND;
139 2 $self->{params}{errorLevel} = EKAHAU_ERR_ERROR;
140 }
141 elsif ($self->{cmd} eq 'FAILURE')
142 {
143 # Authentication Failure
144 8 $self->{params}{errorCode} = $self->{args}[0];
145 8 $self->{params}{errorLevel} = EKAHAU_ERR_FATAL;
146 }
147 }
148  
149 =head3 error ( )
150  
151 Always returns true, to indicate this is an error object. This method
152 can be used on an arbitrary L<Ekahau::Response|Ekahau::Response> object to find out if
153 it represents an error or not.
154  
155 =cut
156  
157 sub error
158 18 ▶{
Subroutine error: called CC=1 SCAR=0.0
Pod documented
159 18 1;
160 }
161  
162 =head3 error_level ( )
163  
164 Returns an integer representing the severity of the error. Errors are
165 ordered from least to most severe, so you can say things like C<if
166 ($err->error_level >= EKAHAU_ERR_ERROR). Constants are used to refer
167 to the various levels, which you can refer to as
168 C<Ekahau::Response::Error::EKAHAU_ERR_CODE>. You can also import
169 these symbols into your program using the C<:codes> tag, which allows
170 them to be used without the C<Ekahau::Response::Error> prefix. They
171 can be imported like this:
172  
173 use Ekahau::Response::Error qw(:codes)
174  
175 These constants represent the different error levels:
176  
177 =over 4
178  
179 =item EKAHAU_ERR_WARNING
180  
181 A small problem that should not affect tracking or other operations on
182 the server.
183  
184 =item EKAHAU_ERR_ERROR
185  
186 An error that may affect tracking, but may still be recoverable.
187  
188 =item EHAKAU_ERR_FATAL
189  
190 A fatal error requires restarting Ekahau.
191  
192 =back
193  
194 =cut
195  
196 sub error_level
197 0 ▶{
Subroutine error_level: not called CC=1 SCAR=6.9
Pod documented
198 0 my $self = shift;
199 0 $self->{params}{errorLevel};
200 }
201  
202 =head3 error_code ( )
203  
204 Returns the code for this error. See L<Errors|/Errors> for a list of errors.
205  
206 =cut
207  
208 sub error_code
209 10 ▶{
Subroutine error_code: called CC=1 SCAR=0.0
Pod documented
210 10 my $self = shift;
211 10 $self->{params}{errorCode};
212 }
213  
214 =head3 error_msg ( )
215  
216 Returns the exact error response from the Ekahau engine.
217  
218 =cut
219  
220 sub error_msg
221 0 ▶{
Subroutine error_msg: not called CC=1 SCAR=6.9
Pod documented
222 0 my $self = shift;
223 0 $self->{cmd};
224 }
225  
226 =head3 error_info ( )
227  
228 Returns a triple containing the error name, description, and
229 explanation for this error.
230  
231 =cut
232  
233 sub error_info
234 10 ▶{
Subroutine error_info: called CC=2 SCAR=7.2
Pod documented
235 10 my $self = shift;
236 10 ▶ return $codenames{($self->error_code)} || DEFAULT_ERROR_INFO;
Condition50%1/2
$Ekahau::Response::Error::codenames{$self->error_code} || ['UNKNOWN_ERROR', 'Unknown Error', 'No explanation available for this error.']
l!l
100
MC/DC0%0/1
$Ekahau::Response::Error::codenames{$self->error_code} || ['UNKNOWN_ERROR', 'Unknown Error', 'No explanation available for this error.']
$Ekahau::Response::Error::codenames{$self->error_code}
Truth table50%1/2
A
A= $Ekahau::Response::Error::codenames{$self->error_code}
Aresult
11
00
237 }
238  
239 =head3 error_name ( )
240  
241 Returns the name of this error.
242  
243 =cut
244  
245 sub error_name
246 0 ▶{
Subroutine error_name: not called CC=1 SCAR=6.9
Pod documented
247 0 my $self = shift;
248 0 return $self->error_info->[CODENAME_NAME];
249 }
250  
251 =head3 error_description
252  
253 Returns a brief description of the error
254  
255 =cut
256  
257 sub error_description
258 10 ▶{
Subroutine error_description: called CC=1 SCAR=0.0
Pod documented
259 10 my $self = shift;
260 10 return $self->error_info->[CODENAME_DESCRIPTION];
261 }
262  
263 =head3 error_explanation
264  
265 Returns a longer explanation for this error.
266  
267 =cut
268  
269 sub error_explanation
270 0 ▶{
Subroutine error_explanation: not called CC=1 SCAR=6.9
Pod documented
271 0 my $self = shift;
272 0 return $self->error_info->[CODENAME_EXPLANATION];
273 }
274  
275 # Generated by
276 # perl -MEkahau::Response::Error -e 'while(my($k,$v) = each(%Ekahau::Response::Error::codenames)) { print "=head3 EKAHAU_ERR_$v->[0]\n\n$v->[1]. $v->[2]\n\n"; }'
277  
278 =head2 Errors
279  
280 =head3 EKAHAU_ERR_DEVICE_NOT_TRACKED
281  
282 Device Not Tracked. The device is not being tracked
283  
284 =head3 EKAHAU_ERR_HARDWARE_FAILURE
285  
286 Hardware Failure. Network adapter has an internal error.
287  
288 =head3 EKAHAU_ERR_ORDER_PRODUCT_TIMEOUT
289  
290 Order Product Timeout. The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get -1 error first.
291  
292 =head3 EKAHAU_ERR_AUTHENTICATION_FAILED
293  
294 Authentication Failed. Password or license is wrong.
295  
296 =head3 EKAHAU_ERR_CONSUMER_TASK_NOT_STARTED
297  
298 Consumer Task Not Started. If this occurs, contact Ekahau support.
299  
300 =head3 EKAHAU_ERR_MALFORMED_REQUEST
301  
302 Malformed Request. The Ekahau engine expected HELLO and TALK commands but received something else.
303  
304 =head3 EKAHAU_ERR_DATABASE_VERSION_CLASH
305  
306 Database Version Clash. Internal error, the system could not update the model database. Requires restarting the software
307  
308 =head3 EKAHAU_ERR_UNKNOWN_PRODUCT
309  
310 Unknown Product. If this occurs, contact Ekahau support.
311  
312 =head3 EKAHAU_ERR_ORDER_REPLY_TIMEOUT
313  
314 Order Reply Timeout. The device which you are trying to track might not be responding. Check that the device is still connected to the network and properly running Ekahau Client. Usually you get a EKAHAU_ERR_DEVICE_NOT_RESPONDING error first.
315  
316 =head3 EKAHAU_ERR_UDP_SEND_ERROR
317  
318 UDP Send Error. Could not send UDP packet
319  
320 =head3 EKAHAU_ERR_AUTH_TIMEOUT
321  
322 Authentication timeout. HELLO and TALK commands were not sent quickly enough
323  
324 =head3 EKAHAU_ERR_CLIENT_DEVICE_REMOVED
325  
326 Client Device Removed. Network adapter has been removed from the client device.
327  
328 =head3 EKAHAU_ERR_UNSUPPORTED_PROTOCOL
329  
330 Unsupported protocol. The requested protocol was not found.
331  
332 =head3 EKAHAU_ERR_PRODUCTION_FAILED
333  
334 Production Failed. If this occurs, contact Ekahau support.
335  
336 =head3 EKAHAU_ERR_CLIENT_CANNOT_MEASURE_DATA
337  
338 Client Cannot Measure Data. Ekahau Client can not get signal information from the network adapter.
339  
340 =head3 EKAHAU_ERR_CONTEXT_NOT_FOUND
341  
342 Location Context Not Found. No location context exists for the requested context ID
343  
344 =head3 EKAHAU_ERR_LICENSE_VIOLATION
345  
346 License Violation. Too many open sockets for your license.
347  
348 =head3 EKAHAU_ERR_PRODUCER_NOT_RESPONDING
349  
350 Producer Not Responding. The device which you are trying to track
351 might not be responding. Check that the device is still connected to
352 the network and properly running Ekahau Client. Usually you get -1
353 error first.
354  
355 =head3 EKAHAU_ERR_DEVICE_LIMIT_EXCEEDED
356  
357 Device Limit Exceeded. Device limit (how many devices your license
358 allows you to track) is exceeded.
359  
360 =head3 EKAHAU_ERR_DEVICE_NOT_FOUND
361  
362 Device Not Found. The device has not been detected by the Positioning Engine
363  
364 =head3 EKAHAU_ERR_AGENT_LOOKUP_FAILED
365  
366 Agent Lookup Failed. If this occurs, contact Ekahau support.
367  
368 =head3 EKAHAU_ERR_EMPTY_MODEL
369  
370 Empty Model. Create a positioning model with Ekahau Manager and save
371 it to the Positioning Engine
372  
373 =head3 EKAHAU_ERR_ACCESS_DENIED
374  
375 Access Denied. Authentication was OK, but the connect was refused
376 either because your IP address is not allowed to connect, or because
377 the server is too busy.
378  
379 =head3 EKAHAU_ERR_CONSUMER_NOT_RESPONDING
380  
381 Consumer Not Responding. The device which you are trying to track
382 might not be responding. Check that the device is still connected to
383 the network and properly running Ekahau Client. Usually you get -1
384 error first.
385  
386 =head3 EKAHAU_ERR_DEVICE_NOT_RESPONDING
387  
388 Device Not Responding. No data (any UDP packets) has been received from the device
389  
390 =head1 AUTHOR
391  
392 Scott Gifford E<lt>gifford@umich.eduE<gt>, E<lt>sgifford@suspectclass.comE<gt>
393  
394 Copyright (C) 2005 The Regents of the University of Michigan.
395  
396 See the file LICENSE included with the distribution for license
397 information.
398  
399  
400 =head1 SEE ALSO
401  
402 L<Ekahau::Response|Ekahau::Response>, L<Ekahau::Base|Ekahau::Base>.
403  
404 =cut
405  
406 15 1;
« lib/Ekahau/Response/StopLocationTrackOK.pm ↑ Summary lib/Ekahau/Response/DeviceList.pm »