my $hash = RFID::Serial::Decode::RFID501->to_hash( $bytes );
+ my $hash = RFID::Serial::Decode::RFID501->to_hash( [ 'blk1', 'blk2', ... , 'blk7' ] );
+
=cut
+my $item_type = {
+ 1 => 'Book',
+ 6 => 'CD/CD ROM',
+ 2 => 'Magazine',
+ 13 => 'Book with Audio Tape',
+ 9 => 'Book with CD/CD ROM',
+ 0 => 'Other',
+
+ 5 => 'Video',
+ 4 => 'Audio Tape',
+ 3 => 'Bound Journal',
+ 8 => 'Book with Diskette',
+ 7 => 'Diskette',
+};
+
sub to_hash {
my ( $self, $data ) = @_;
+ return unless $data;
+
+ $data = join('', @$data) if ref $data eq 'ARRAY';
+
+ warn "## to_hash $data\n";
+
my ( $u1, $set_item, $u2, $type, $content, $br_lib, $custom ) = unpack('C4Z16Nl>',$data);
my $hash = {
u1 => $u1, # FIXME
total => ( $set_item & 0x0f ),
type => $type,
+ type_label => $item_type->{$type},
content => $content,
branch => $br_lib >> 20,