338 |
my $uid = shift; |
my $uid = shift; |
339 |
my $hex_uid = as_hex($uid); |
my $hex_uid = as_hex($uid); |
340 |
|
|
341 |
cpr( "FF B0 23 01 $hex_uid 00 04", "Read Multiple Blocks $hex_uid" ); |
my $max_block; |
342 |
# cpr( "FF B0 2B 01 $hex_uid", "Get System Information $hex_uid" ); |
|
343 |
|
cpr( "FF B0 2B 01 $hex_uid", "Get System Information $hex_uid", sub { |
344 |
|
my $data = shift; |
345 |
|
|
346 |
|
warn "# data ",as_hex($data); |
347 |
|
|
348 |
|
my $DSFID = substr($data,5-2,1); |
349 |
|
my $UID = substr($data,6-2,8); |
350 |
|
my $AFI = substr($data,14-2,1); |
351 |
|
my $MEM = substr($data,15-2,1); |
352 |
|
my $SIZE = substr($data,16-2,1); |
353 |
|
my $IC_REF = substr($data,17-2,1); |
354 |
|
|
355 |
|
warn "# split ",as_hex( $DSFID, $UID, $AFI, $MEM, $SIZE, $IC_REF ); |
356 |
|
|
357 |
|
$max_block = ord($SIZE); |
358 |
|
}); |
359 |
|
|
360 |
|
my $transponder_data; |
361 |
|
|
362 |
|
my $block = 0; |
363 |
|
while ( $block < $max_block ) { |
364 |
|
cpr( sprintf("FF B0 23 01 $hex_uid %02x 04", $block), "Read Multiple Blocks $block", sub { |
365 |
|
my $data = shift; |
366 |
|
|
367 |
|
my $DB_N = ord substr($data,5-2,1); |
368 |
|
my $DB_SIZE = ord substr($data,6-2,1); |
369 |
|
|
370 |
|
$data = substr($data,7-2,-2); |
371 |
|
warn "# DB N: $DB_N SIZE: $DB_SIZE ", as_hex( $data ); |
372 |
|
foreach ( 1 .. $DB_N ) { |
373 |
|
my $sec = substr($data,0,1); |
374 |
|
my $db = substr($data,1,$DB_SIZE); |
375 |
|
warn "block $_ ",dump( $sec, $db ); |
376 |
|
$transponder_data .= reverse split(//,$db); |
377 |
|
$data = substr($data, $DB_SIZE + 1); |
378 |
|
} |
379 |
|
}); |
380 |
|
$block += 4; |
381 |
|
} |
382 |
|
|
383 |
|
warn "DATA $hex_uid ", dump($transponder_data); |
384 |
|
exit; |
385 |
} |
} |
386 |
|
|
387 |
|
|
391 |
|
|
392 |
cpr( 'FF B0 01 00', 'ISO - Inventory', sub { |
cpr( 'FF B0 01 00', 'ISO - Inventory', sub { |
393 |
my $data = shift; |
my $data = shift; |
394 |
|
if (length($data) < 5 + 2 ) { |
395 |
|
warn "# no tags in range\n"; |
396 |
|
return; |
397 |
|
} |
398 |
my $data_sets = ord(substr($data,3,1)); |
my $data_sets = ord(substr($data,3,1)); |
399 |
$data = substr($data,4); |
$data = substr($data,4); |
400 |
foreach ( 1 .. $data_sets ) { |
foreach ( 1 .. $data_sets ) { |