-package RFID::Biblio::Reader::3M810;
+package Biblio::RFID::Reader::3M810;
=head1 NAME
-RFID::Biblio::Reader::3M810 - support for 3M 810 RFID reader
+Biblio::RFID::Reader::3M810 - support for 3M 810 RFID reader
=head1 DESCRIPTION
-This module uses L<RFID::Biblio::Reader::Serial> over USB/serial adapter
+This module uses L<Biblio::RFID::Reader::Serial> over USB/serial adapter
with 3M 810 RFID reader, often used in library applications.
This is most mature implementation which supports full API defined
-in L<RFID::Biblio::Reader::API>. This include scanning for all tags in reader
+in L<Biblio::RFID::Reader::API>. This include scanning for all tags in reader
range, reading and writing of data, and AFI security manipulation.
This implementation is developed using Portmon on Windows to capture serial traffic
use warnings;
use strict;
-use base 'RFID::Biblio::Reader::Serial';
-use RFID::Biblio;
+use base 'Biblio::RFID::Reader::Serial';
+use Biblio::RFID;
use Data::Dump qw(dump);
use Carp qw(confess);
$bytes = "\xD6" . $bytes . $checksum;
}
- warn ">> ", as_hex( $bytes ), "\t\t[$description]\n";
+ warn ">> ", as_hex( $bytes ), "\t\t[$description]\n" if $debug;
$port->write( $bytes );
my $r_len = $port->read(3);
warn "<< ", as_hex($r_len,$data),
' | ',
substr($data,-2,2) eq checksum(substr($r_len,1).substr($data,0,-2)) ? 'OK' : 'ERROR',
- " $len bytes\n";
+ " $len bytes\n" if $debug;
$coderef->( $data ) if $coderef;
my $b = hex2bytes $hex;
my $l = length($b);
if ( substr($data,0,$l) eq $b ) {
- warn "_matched $hex [$l] in ",as_hex($data);
+ warn "_matched $hex [$l] in ",as_hex($data) if $debug;
return substr($data,$l);
}
}
} elsif ( $rest = _matched $data => 'FE 00 00 05 01' ) {
warn "FIXME ready? ",as_hex $rest;
} elsif ( $rest = _matched $data => '02 06' ) {
- warn "ERROR ",as_hex($rest);
+ die "ERROR ",as_hex($rest);
} else {
- warn "FIXME unsuported ",as_hex($rest);
+ die "FIXME unsuported ",as_hex($rest);
}
});
my $blocks = substr($rest,8,1);
warn "# WRITE ",as_hex($tag), " [$blocks]\n";
} elsif ( $rest = _matched $data => '04 06' ) {
- warn "ERROR ",as_hex($rest);
+ die "ERROR ",as_hex($rest);
} else {
die "UNSUPPORTED";
}
warn "# SECURITY ", hex_tag($tag), " AFI: ", as_hex($afi);
} elsif ( $rest = _matched $data => '0A 06' ) {
- warn "ERROR reading security from $tag ", as_hex($data);
+ die "ERROR reading security from $tag ", as_hex($data);
} else {
- warn "IGNORED ",as_hex($data);
+ die "IGNORED ",as_hex($data);
}
});
warn "## read_afi ",dump($tag, $afi);
die "write_afi got $tag_back expected $tag" if $tag_back ne $tag;
warn "# SECURITY ", hex_tag($tag), " AFI: ", as_hex($afi);
} elsif ( $rest = _matched $data => '0A 06' ) {
- warn "ERROR writing AFI to $tag ", as_hex($data);
- undef $afi;
+ die "ERROR writing AFI to $tag ", as_hex($data);
} else {
- warn "IGNORED ",as_hex($data);
- undef $afi;
+ die "IGNORED ",as_hex($data);
}
});
warn "## write_afi ", dump( $tag, $afi );
=head1 SEE ALSO
-L<RFID::Biblio::Reader::API>
+L<Biblio::RFID::Reader::API>