line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RFID::Alien::Reader::Test; |
2
|
4
|
|
|
4
|
|
49553
|
use RFID::Alien::Reader; $VERSION=$RFID::Alien::Reader::VERSION; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
367
|
|
3
|
4
|
|
|
4
|
|
5044
|
use RFID::Reader::TestBase; |
|
4
|
|
|
|
|
44108
|
|
|
4
|
|
|
|
|
197
|
|
4
|
|
|
|
|
|
|
@ISA = qw(RFID::Reader::TestBase RFID::Alien::Reader); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Written by Scott Gifford |
7
|
|
|
|
|
|
|
# Copyright (C) 2004-2006 The Regents of the University of Michigan. |
8
|
|
|
|
|
|
|
# See the file LICENSE included with the distribution for license |
9
|
|
|
|
|
|
|
# information. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
RFID::Alien::Reader::Test - A fake implementation of L for testing |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Provides fake backend methods to test out |
18
|
|
|
|
|
|
|
L without having access to a |
19
|
|
|
|
|
|
|
real reader. It inherits from |
20
|
|
|
|
|
|
|
L. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
4
|
|
36
|
use Carp; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
440
|
|
25
|
|
|
|
|
|
|
our %initval = (time => '', |
26
|
|
|
|
|
|
|
persisttime => '5', |
27
|
|
|
|
|
|
|
acquiremode => 'Inventory', |
28
|
|
|
|
|
|
|
taglistantennacombine => 'off', |
29
|
|
|
|
|
|
|
mask => 'All Tags', |
30
|
|
|
|
|
|
|
antennasequence => '0', |
31
|
|
|
|
|
|
|
readerversion => "Reader Type: RFID-Alien-Reader-Test, Ent. SW Rev: $VERSION", |
32
|
|
|
|
|
|
|
); |
33
|
4
|
|
|
4
|
|
36
|
use constant TAGLIST => "Tag:8000 8004 3306 5081, CRC:CB1D, Disc:2004/06/09 11:01:43, Count:3, Ant:0\r\nTag:8000 8004 2812 6165, CRC:DA08, Disc:2004/06/09 11:01:43, Count:1, Ant:0"; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
2294
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new |
36
|
|
|
|
|
|
|
{ |
37
|
2
|
|
|
2
|
0
|
40
|
my $class = shift; |
38
|
2
|
|
|
|
|
15
|
my(%p) = @_; |
39
|
2
|
|
|
|
|
5
|
my $self = {}; |
40
|
2
|
|
|
|
|
9
|
bless($self,$class); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Initialize everything. |
43
|
2
|
|
|
|
|
9
|
foreach my $parent (@ISA) |
44
|
|
|
|
|
|
|
{ |
45
|
4
|
50
|
|
|
|
108
|
if (my $init = $parent->can('_init')) |
46
|
|
|
|
|
|
|
{ |
47
|
4
|
|
|
|
|
29
|
$init->($self,%p); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
2
|
|
|
|
|
20
|
$self->{_settings}={%initval}; |
51
|
2
|
|
|
|
|
12
|
$self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _process_input |
55
|
|
|
|
|
|
|
{ |
56
|
37
|
|
|
37
|
|
2458
|
my $self = shift; |
57
|
37
|
|
|
|
|
69
|
my($readbuf)=@_; |
58
|
|
|
|
|
|
|
|
59
|
37
|
|
|
|
|
269
|
while ($readbuf =~ s/^\x01?([^\r\n]*)\r?\n//) |
60
|
|
|
|
|
|
|
{ |
61
|
37
|
|
|
|
|
400
|
my ($cmd,$var,$rest) = split(' ',$1,3); |
62
|
37
|
100
|
|
|
|
123
|
if (lc $cmd eq 'get') |
|
|
50
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
22
|
100
|
|
|
|
71
|
if (lc $var eq 'taglist') |
|
|
100
|
|
|
|
|
|
65
|
|
|
|
|
|
|
{ |
66
|
3
|
100
|
|
|
|
20
|
if ($self->{_settings}{antennasequence} =~ /\b0\b/) |
67
|
|
|
|
|
|
|
{ |
68
|
2
|
|
|
|
|
12
|
$self->_add_output(TAGLIST."\x0d\x0a\0"); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else |
71
|
|
|
|
|
|
|
{ |
72
|
1
|
|
|
|
|
5
|
$self->_add_output("(No Tags)\x0d\x0a\0"); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
elsif (lc $var eq 'readerversion') |
76
|
|
|
|
|
|
|
{ |
77
|
1
|
|
|
|
|
8
|
$self->_add_output($self->{_settings}{lc $var}."\x0d\x0a\0"); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
else |
80
|
|
|
|
|
|
|
{ |
81
|
18
|
|
|
|
|
93
|
$self->_add_output("$var = $self->{_settings}{lc $var}\x0d\x0a\0"); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif (lc $cmd eq 'set') |
85
|
|
|
|
|
|
|
{ |
86
|
15
|
50
|
|
|
|
82
|
$rest =~ s/^\s*=\s*// |
87
|
|
|
|
|
|
|
or croak "Received invalid set command!"; |
88
|
15
|
|
|
|
|
46
|
$self->{_settings}{lc $var}=$rest; |
89
|
15
|
|
|
|
|
92
|
$self->_add_output("$var = $self->{_settings}{lc $var}\x0d\x0a\0"); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
37
|
|
|
|
|
504
|
$readbuf; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L, L, |
98
|
|
|
|
|
|
|
L, L. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Scott Gifford Egifford@umich.eduE, Esgifford@suspectclass.comE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Copyright (C) 2004-2006 The Regents of the University of Michigan. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
See the file LICENSE included with the distribution for license |
107
|
|
|
|
|
|
|
information. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |