rename module to Biblio::RFID
[Biblio-RFID.git] / lib / RFID / Biblio / Reader / API.pm
1 package Biblio::RFID::Reader::API;
2
3 use warnings;
4 use strict;
5
6 =head1 NAME
7
8 Biblio::RFID::Reader::API - low-level RFID reader documentation
9
10 =cut
11
12 =head1 MANDATORY METHODS
13
14 Each reader must implement following hooks as sub-classes.
15
16 =head2 init
17
18   $self->init;
19
20 =head2 inventory
21
22   my @tags = $self->invetory;
23
24 =head2 read_blocks
25
26   my $hash = $self->read_blocks( $tag );
27
28 All blocks are under key which is tag UID with array of blocks returned from reader
29
30   $hash = { 'E000000123456789' => [ 'blk1', 'blk2', ... ] };
31
32 L<Biblio::RFID::Reader::3M810> sends tag UID with data payload, so we might expect
33 to receive response from other tags from protocol specification, 
34
35 =head2 write_blocks
36
37   $self->write_blocks( $tag => $bytes );
38
39   $self->write_blocks( $tag => [ 'blk1', 'blk2', ... ] );
40
41 =head2 read_afi
42
43   my $afi = $self->read_afi( $tag );
44
45 =head2 write_afi
46
47   $self->write_afi( $tag => $afi );
48
49
50 =head1 METHODS
51
52 =head2 new
53
54 Just calls C<init> in reader implementation so this class
55 can be used as simple stub base class like
56 L<Biblio::RFID::Reader::librfid> does
57
58 =cut
59
60 sub new {
61         my $class = shift;
62         my $self = {@_};
63         bless $self, $class;
64         $self->init && return $self;
65 }
66
67 1;