/[RFID]/cpr-m02.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /cpr-m02.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 84 by dpavlin, Mon Jul 12 11:46:21 2010 UTC revision 85 by dpavlin, Mon Jul 12 12:00:39 2010 UTC
# Line 14  use Time::HiRes; Line 14  use Time::HiRes;
14    
15  use IO::Socket::INET;  use IO::Socket::INET;
16    
17  my $debug = 2;  my $debug = 0;
18    
19  my $tags_data;  my $tags_data;
20  my $tags_security;  my $tags_security;
# Line 288  sub cpr_m02_checksum { Line 288  sub cpr_m02_checksum {
288  }  }
289    
290  sub cpr {  sub cpr {
291          my ( $hex, $description ) = shift;          my ( $hex, $description ) = @_;
292          my $bytes = str2bytes($hex);          my $bytes = str2bytes($hex);
293          my $len = pack( 'c', length( $bytes ) + 3 );          my $len = pack( 'c', length( $bytes ) + 3 );
294          my $send = $len . $bytes;          my $send = $len . $bytes;
295          my $checksum = cpr_m02_checksum($send);          my $checksum = cpr_m02_checksum($send);
296          $send .= $checksum;          $send .= $checksum;
297    
298          warn ">> ", as_hex( $send ), "[$description]\n";          warn ">> ", as_hex( $send ), "\t\t[$description]\n";
299          $port->write( $send );          $port->write( $send );
300    
301          my $r_len = $port->read(1);          my $r_len = $port->read(1);
# Line 314  sub cpr { Line 314  sub cpr {
314          Time::HiRes::sleep 0.050;          Time::HiRes::sleep 0.050;
315  }  }
316    
317  #cpr( 'FF  52 00', 'detect boud rate' );  # FF = COM-ADDR any
318    
319  #cpr( '00  65', 'software version' );  cpr( 'FF  52 00',       'Boud Rate Detection' );
320    
321  cpr( 'FF  65', 'get ? info' );  cpr( 'FF  65',          'Get Software Version' );
322    
323  cpr( 'FF  69 00', 'get reader info' );  cpr( 'FF  66 00',       'Get Reader Info - General hard and firware' );
324    
325  cpr( 'FF B0 01 00', '?' );  cpr( 'FF  69',          'RF Reset' );
326    
327  cpr( 'FF 69', '?' );  cpr( 'FF  B0  01 00', 'ISO - Inventory' );
328    
329  #cpr( '', '?' );  #cpr( '', '?' );
330    

Legend:
Removed from v.84  
changed lines
  Added in v.85

  ViewVC Help
Powered by ViewVC 1.1.26