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; |
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); |
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 |
|
|