- package RFID::Biblio::RFID501;
+ package Biblio::RFID::RFID501;
use warnings;
use strict;
=head1 NAME
- RFID::Biblio::RFID501 - RFID Standard for Libraries
+ Biblio::RFID::RFID501 - RFID Standard for Libraries
=head1 DESCRIPTION
=head2 to_hash
- my $hash = RFID::Biblio::Decode::RFID501->to_hash( $bytes );
+ my $hash = Biblio::RFID::Decode::RFID501->to_hash( $bytes );
- my $hash = RFID::Biblio::Decode::RFID501->to_hash( [ 'blk1', 'blk2', ... , 'blk7' ] );
+ my $hash = Biblio::RFID::Decode::RFID501->to_hash( [ 'blk1', 'blk2', ... , 'blk7' ] );
=head2 from_hash
- my $blocks = RFID::Biblio::Decode::RFID->from_hash({ content => "1301234567" });
+ my $blocks = Biblio::RFID::Decode::RFID->from_hash({ content => "1301234567" });
=head2 blank_3m
=head2 blank
- my $blocks = RFID::Biblio::Decode::RFID->blank;
+ my $blocks = Biblio::RFID::Decode::RFID->blank;
=cut
warn "## from_hash ",dump($hash);
+ $hash->{$_} ||= 0 foreach ( qw( set total type branch library ) );
+
return pack('C4Z16Nl>l',
0x04,
( $hash->{set} << 4 ) | ( $hash->{total} & 0x0f ),
- 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);
# drain on startup
my ( $count, $str ) = $port->read(3);
- my $data = $port->read( ord(substr($str,2,1)) );
- warn "drain ",as_hex( $str, $data ),"\n";
+ if ( $count ) {
+ my $data = $port->read( ord(substr($str,2,1)) );
+ warn "drain ",as_hex( $str, $data ),"\n";
+ }
$port->read_char_time(100); # 0.1 s char timeout
$port->read_const_time(500); # 0.5 s read timeout
=head1 SEE ALSO
- L<RFID::Biblio::Reader::API>
+ L<Biblio::RFID::Reader::API>
use Data::Dump qw(dump);
use Getopt::Long;
use lib 'lib';
- use RFID::Biblio::Reader;
- use RFID::Biblio::RFID501;
+ use Biblio::RFID::Reader;
+ use Biblio::RFID::RFID501;
use Storable;
my $evolis_dir = '/home/dpavlin/klin/Printer-EVOLIS'; # FIXME
my $loop = 1;
my $reader = '3M';
my $debug = 0;
-my $afi = 0x42;
+my $afi = 0x00; # XXX
my $test = 0;
my $log_print = 'log.print';
print "# queue ", dump @queue;
- my $rfid = RFID::Biblio::Reader->new( $reader );
- $RFID::Biblio::debug = $debug;
+ my $rfid = Biblio::RFID::Reader->new( $reader );
+ $Biblio::RFID::debug = $debug;
sub tag {
my $tag = shift;
, " AFI: "
, uc unpack('H2', $rfid->afi($tag))
, " "
- , dump( RFID::Biblio::RFID501->to_hash( $rfid->blocks($tag) ) )
+ , dump( Biblio::RFID::RFID501->to_hash( $rfid->blocks($tag) ) )
, $/
;
}
my $card = shift @queue;
my $number = $card->[0];
print "PROGRAM $tag $number\n";
- $rfid->write_blocks( $tag => RFID::Biblio::RFID501->from_hash({ content => $number }) );
- $rfid->write_afi( $tag => chr($afi) );
+ $rfid->write_blocks( $tag => Biblio::RFID::RFID501->from_hash({ content => $number }) );
+ $rfid->write_afi( $tag => chr($afi) ) if $afi;
$programmed->{$tag} = $number;
store $programmed, $persistant_path;
use Data::Dump qw(dump);
use Getopt::Long;
use lib 'lib';
- use RFID::Biblio::Reader;
- use RFID::Biblio::RFID501;
+ use Biblio::RFID::Reader;
+ use Biblio::RFID::RFID501;
my $loop = 0;
my $reader;
'debug+' => \$debug,
) || die $!;
- my $rfid = RFID::Biblio::Reader->new( $reader );
- $RFID::Biblio::debug = $debug;
+ my $rfid = Biblio::RFID::Reader->new( $reader );
+ $Biblio::RFID::debug = $debug;
sub tag {
my $tag = shift;
, " AFI: "
, uc unpack('H2', $rfid->afi($tag))
, " "
- , dump( RFID::Biblio::RFID501->to_hash( $rfid->blocks($tag) ) )
+ , dump( Biblio::RFID::RFID501->to_hash( $rfid->blocks($tag) ) )
, $/
;
}
warn localtime()." visible: ",join(' ',@visible),"\n";
+ sleep 1;
+
} while $loop;
#!/usr/bin/perl -T
-use Test::More tests => 7;
+use Test::More tests => 8;
BEGIN {
use lib 'lib';
- use_ok( 'RFID::Biblio' );
- use_ok( 'RFID::Biblio::Reader::API' );
- use_ok( 'RFID::Biblio::Reader::Serial' );
- use_ok( 'RFID::Biblio::Reader::3M810' );
- use_ok( 'RFID::Biblio::Reader::CPRM02' );
- use_ok( 'RFID::Biblio::Reader::librfid' );
- use_ok( 'RFID::Biblio::Reader' );
- use_ok( 'RFID::Biblio::RFID501' );
- use_ok( 'Biblio::RFID' );
- use_ok( 'Biblio::RFID::Reader::API' );
- use_ok( 'Biblio::RFID::Reader::Serial' );
- use_ok( 'Biblio::RFID::Reader::3M810' );
- use_ok( 'Biblio::RFID::Reader::CPRM02' );
- use_ok( 'Biblio::RFID::Reader::librfid' );
- use_ok( 'Biblio::RFID::Reader' );
++ use_ok( 'Biblio::RFID' );
++ use_ok( 'Biblio::RFID::Reader::API' );
++ use_ok( 'Biblio::RFID::Reader::Serial' );
++ use_ok( 'Biblio::RFID::Reader::3M810' );
++ use_ok( 'Biblio::RFID::Reader::CPRM02' );
++ use_ok( 'Biblio::RFID::Reader::librfid' );
++ use_ok( 'Biblio::RFID::Reader' );
++ use_ok( 'Biblio::RFID::RFID501' );
}
- diag( "Testing RFID::Biblio $RFID::Biblio::VERSION, Perl $], $^X" );
+ diag( "Testing Biblio::RFID $Biblio::RFID::VERSION, Perl $], $^X" );