unify read_blocks and invetory interface
[Biblio-RFID.git] / lib / RFID / Serial.pm
index 82e1c61..9c32a6d 100644 (file)
@@ -3,6 +3,9 @@ package RFID::Serial;
 use warnings;
 use strict;
 
+use base 'Exporter';
+our @EXPORT = qw( hex2bytes as_hex hex_tag );
+
 use Device::SerialPort qw(:STAT);
 use Data::Dump qw(dump);
 
@@ -16,9 +19,6 @@ our $VERSION = '0.01';
 
 my $debug = 0;
 
-use base 'Exporter';
-our @EXPORT = qw( hex2bytes as_hex );
-
 
 =head1 SYNOPSIS
 
@@ -78,6 +78,8 @@ Formatting functions are exported
 
 =head2 hex2bytes
 
+  my $bytes = hex2bytes($hex);
+
 =cut
 
 sub hex2bytes {
@@ -92,6 +94,12 @@ sub hex2bytes {
        return $bytes;
 }
 
+=head2 as_hex
+
+  print as_hex( $bytes );
+
+=cut
+
 sub as_hex {
        my @out;
        foreach my $str ( @_ ) {
@@ -103,6 +111,14 @@ sub as_hex {
        return join(' | ', @out);
 }
 
+=head2 hex_tag
+
+  print hex_tag $bytes;
+
+=cut
+
+sub hex_tag { uc(unpack('H16', shift)) }
+
 
 =head1 AUTHOR