1 package Biblio::RFID::SmartX;
6 use Data::Dump qw(dump);
10 Biblio::RFID::SmartX - Croatian student cards format
19 my $hash = Biblio::RFID::Decode::SmartX->to_hash( [ 'sector1', 'sector2', ... , 'sector7' ] );
25 return join('', map { sprintf("%02x",ord($_)) } split (//, $data));
29 my ( $self, $data ) = @_;
33 die "expecting array of sectors" unless ref $data eq 'ARRAY';
38 $decoded->[$_] = bcd( $data->[$_] );
42 $hash->{SXID} = substr( $decoded->[4], 0, 20 );
43 $hash->{JMBAG} = substr( $decoded->[4], 22, 10 );
44 $hash->{OIB} = substr( $decoded->[5], 16, 11 );
45 $hash->{SPOL} = substr( $data->[5], 14, 1 ); # char, not BCD!
46 $hash->{INST_ID} = substr( $decoded->[6], 0, 12 );
47 $hash->{CARD_V} = substr( $decoded->[6], 12, 4 );
49 warn "## hash = ",dump($hash);