--- 3m-810.pl 2009/04/06 13:18:55 30 +++ 3m-810.pl 2009/04/06 15:19:24 31 @@ -101,6 +101,23 @@ my $tags_data; my $visible_tags; +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', +}; + +warn "## known item type: ",dump( $item_type ) if $debug; + my $port=new Device::SerialPort($device) || die "can't open serial port $device: $!\n"; warn "using $device $handshake $baudrate $databits $parity $stopbits" if $debug; $handshake=$port->handshake($handshake); @@ -222,7 +239,9 @@ $tag_data_block->{$tag}->[ $ord ] = $data; } $tags_data->{ $tag } = join('', @{ $tag_data_block->{$tag} }); - print "DATA $tag ",dump( $tags_data ), "\n"; + + my $item_type_nr = ord(substr( $tags_data->{$tag}, 3, 1 )); + print "DATA $tag ",dump( $tags_data ), " item type: ", ( $item_type->{ $item_type_nr } || "UNKWOWN '$item_type_nr' in " . dump( $item_type ) ), "\n"; } sub read_tag {