File Coverage

blib/lib/Ekahau/Response/Error.pm
Criterion Covered Total %
statement 117 139 84.1
branch 0 6 0.0
condition 0 2 0.0
subroutine 39 48 81.2
pod 8 9 88.8
total 164 204 80.3


line stmt bran cond sub pod time code
1             package Ekahau::Response::Error;
2 6     6   38 use base 'Ekahau::Response'; our $VERSION=Ekahau::Response::VERSION;
  6         14  
  6         647  
3 6     6   112 use base 'Exporter';
  6         11  
  6         369  
4              
5             # Written by Scott Gifford
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 6     6   32 use strict;
  6         10  
  6         199  
11 6     6   32 use warnings;
  6         11  
  6         226  
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, and use its constructor.
28              
29             =head2 Methods
30              
31             =cut
32              
33              
34 6     6   31 use constant EKAHAU_ERR_WARNING => 1;
  6         22  
  6         458  
35 6     6   52 use constant EKAHAU_ERR_ERROR => 2;
  6         9  
  6         366  
36 6     6   33 use constant EKAHAU_ERR_FATAL => 3;
  6         11  
  6         301  
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 6     6   31 use constant EKAHAU_ERR_DEVICE_NOT_TRACKED => -600;
  6         10  
  6         416  
42 6     6   32 use constant EKAHAU_ERR_HARDWARE_FAILURE => -6;
  6         18  
  6         265  
43 6     6   29 use constant EKAHAU_ERR_ORDER_PRODUCT_TIMEOUT => -304;
  6         10  
  6         430  
44 6     6   31 use constant EKAHAU_ERR_AUTHENTICATION_FAILED => 2;
  6         10  
  6         286  
45 6     6   29 use constant EKAHAU_ERR_CONSUMER_TASK_NOT_STARTED => -302;
  6         12  
  6         6539  
46 6     6   37 use constant EKAHAU_ERR_MALFORMED_REQUEST => 1;
  6         13  
  6         395  
47 6     6   33 use constant EKAHAU_ERR_DATABASE_VERSION_CLASH => -602;
  6         17  
  6         282  
48 6     6   30 use constant EKAHAU_ERR_UNKNOWN_PRODUCT => -301;
  6         12  
  6         382  
49 6     6   35 use constant EKAHAU_ERR_ORDER_REPLY_TIMEOUT => -303;
  6         11  
  6         288  
50 6     6   36 use constant EKAHAU_ERR_UDP_SEND_ERROR => -3;
  6         16  
  6         254  
51 6     6   31 use constant EKAHAU_ERR_AUTH_TIMEOUT => 6;
  6         16  
  6         297  
52 6     6   33 use constant EKAHAU_ERR_CLIENT_DEVICE_REMOVED => -5;
  6         10  
  6         381  
53 6     6   38 use constant EKAHAU_ERR_UNSUPPORTED_PROTOCOL => 3;
  6         58  
  6         302  
54 6     6   39 use constant EKAHAU_ERR_PRODUCTION_FAILED => -305;
  6         12  
  6         284  
55 6     6   29 use constant EKAHAU_ERR_CLIENT_CANNOT_MEASURE_DATA => -4;
  6         27  
  6         358  
56 6     6   31 use constant EKAHAU_ERR_CONTEXT_NOT_FOUND => -1001;
  6         154  
  6         273  
57 6     6   33 use constant EKAHAU_ERR_LICENSE_VIOLATION => 4;
  6         12  
  6         320  
58 6     6   31 use constant EKAHAU_ERR_PRODUCER_NOT_RESPONDING => -307;
  6         11  
  6         276  
59 6     6   33 use constant EKAHAU_ERR_DEVICE_LIMIT_EXCEEDED => -2;
  6         12  
  6         253  
60 6     6   32 use constant EKAHAU_ERR_DEVICE_NOT_FOUND => -601;
  6         11  
  6         283  
61 6     6   33 use constant EKAHAU_ERR_AGENT_LOOKUP_FAILED => -300;
  6         9  
  6         336  
62 6     6   129 use constant EKAHAU_ERR_EMPTY_MODEL => -306;
  6         17  
  6         381  
63 6     6   32 use constant EKAHAU_ERR_ACCESS_DENIED => 5;
  6         12  
  6         6229  
64 6     6   39 use constant EKAHAU_ERR_CONSUMER_NOT_RESPONDING => -308;
  6         20  
  6         291  
65 6     6   30 use constant EKAHAU_ERR_DEVICE_NOT_RESPONDING => -1;
  6         11  
  6         868  
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             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             our @EXPORT_OK = (@{$EXPORT_TAGS{codes}});
88              
89 6     6   32 use constant CODENAME_NAME => 0;
  6         12  
  6         306  
90 6     6   32 use constant CODENAME_DESCRIPTION => 1;
  6         20  
  6         366  
91 6     6   178 use constant CODENAME_EXPLANATION => 2;
  6         19  
  6         280  
92              
93 6     6   32 use constant DEFAULT_ERROR_NAME => 'UNKNOWN_ERROR';
  6         8  
  6         271  
94 6     6   33 use constant DEFAULT_ERROR_DESCRIPTION => 'Unknown Error';
  6         12  
  6         3180  
95 6     6   37 use constant DEFAULT_ERROR_EXPLANATION => 'No explanation available for this error.';
  6         12  
  6         476  
96 6     6   34 use constant DEFAULT_ERROR_INFO => [DEFAULT_ERROR_NAME,DEFAULT_ERROR_DESCRIPTION,DEFAULT_ERROR_EXPLANATION];
  6         13  
  6         5606  
97              
98             # This is the canonical location for this information.
99             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             {
130 0     0 0   my $self = shift;
131              
132 0 0         warn "Created Ekahau::Response::Error object\n"
133             if ($ENV{VERBOSE});
134              
135 0 0         if ($self->{cmd} eq 'CONTEXT_NOT_FOUND')
    0          
136             {
137             # This isn't really an error, but we treat it as one.
138 0           $self->{params}{errorCode} = EKAHAU_ERR_CONTEXT_NOT_FOUND;
139 0           $self->{params}{errorLevel} = EKAHAU_ERR_ERROR;
140             }
141             elsif ($self->{cmd} eq 'FAILURE')
142             {
143             # Authentication Failure
144 0           $self->{params}{errorCode} = $self->{args}[0];
145 0           $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 object to find out if
153             it represents an error or not.
154              
155             =cut
156              
157             sub error
158             {
159 0     0 1   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
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. 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 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             {
198 0     0 1   my $self = shift;
199 0           $self->{params}{errorLevel};
200             }
201              
202             =head3 error_code ( )
203              
204             Returns the code for this error. See L for a list of errors.
205              
206             =cut
207              
208             sub error_code
209             {
210 0     0 1   my $self = shift;
211 0           $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             {
222 0     0 1   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             {
235 0     0 1   my $self = shift;
236 0   0       return $codenames{($self->error_code)} || DEFAULT_ERROR_INFO;
237             }
238              
239             =head3 error_name ( )
240              
241             Returns the name of this error.
242              
243             =cut
244              
245             sub error_name
246             {
247 0     0 1   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             {
259 0     0 1   my $self = shift;
260 0           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             {
271 0     0 1   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 Egifford@umich.eduE, Esgifford@suspectclass.comE
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, L.
403              
404             =cut
405              
406             1;