--- 3m-810.pl 2010/02/11 10:52:14 63 +++ 3m-810.pl 2010/02/11 12:33:19 64 @@ -19,33 +19,6 @@ my $tags_security; my $visible_tags; -my $meteor_server; # = '192.168.1.13:4671'; -my $meteor_fh; - -sub meteor { - my @a = @_; - push @a, scalar localtime() if $a[0] =~ m{^info}; - - if ( ! defined $meteor_fh ) { - if ( $meteor_fh = - IO::Socket::INET->new( - PeerAddr => $meteor_server, - Timeout => 1, - ) - ) { - warn "# meteor connected to $meteor_server"; - } else { - warn "can't connect to meteor $meteor_server: $!"; - $meteor_fh = 0; - } - } - - if ( $meteor_fh ) { - warn ">> meteor ",dump( @a ); - print $meteor_fh "ADDMESSAGE test ",join('|',@a),"\n" - } -} - my $listen_port = 9000; # pick something not in use my $server_url = "http://localhost:$listen_port"; @@ -194,7 +167,6 @@ 'parity=s' => \$parity, 'stopbits=i' => \$stopbits, 'handshake=s' => \$handshake, - 'meteor=s' => \$meteor_server, 'http-server!' => \$http_server, ) or die $!; @@ -273,7 +245,6 @@ 'D5 00 09 04 00 11 0A 05 00 02 7250', sub { my $hw_ver = join('.', unpack('CCCC', skip_assert(3) )); print "hardware version $hw_ver\n"; - meteor( 'info', "Found reader hardware $hw_ver" ); }); cmd( 'D6 00 0C 13 04 01 00 02 00 03 00 04 00 AAF2','FIXME: stats?', @@ -291,7 +262,6 @@ if ( ! $nr ) { _log "no tags in range\n"; update_visible_tags(); - meteor( 'info-none-in-range' ); $tags_data = {}; } else { @@ -303,8 +273,6 @@ warn "## tags ",as_hex($tags), " [$tl] = ",dump( $tags ) if $debug; _log "$nr tags in range: ", join(',', @tags ) , "\n"; - meteor( 'info-in-range', join(' ',@tags)); - update_visible_tags( @tags ); } } @@ -338,9 +306,8 @@ $visible_tags->{$tag}++; if ( ! defined $last_visible_tags->{$tag} ) { if ( defined $tags_data->{$tag} ) { -# meteor( 'in-range', $tag ); + warn "$tag in range\n"; } else { - meteor( 'read', $tag ); read_tag( $tag ); } } else { @@ -349,19 +316,16 @@ delete $last_visible_tags->{$tag}; # leave just missing tags if ( -e "$program_path/$tag" ) { - meteor( 'write', $tag ); write_tag( $tag ); } if ( -e "$secure_path/$tag" ) { - meteor( 'secure', $tag ); secure_tag( $tag ); } } foreach my $tag ( keys %$last_visible_tags ) { my $data = delete $tags_data->{$tag}; - print "removed tag $tag with data ",dump( $data ),"\n"; - meteor( 'removed', $tag ); + warn "$tag removed ", dump($data), $/; } warn "## update_visible_tags(",dump( @tags ),") = ",dump( $visible_tags )," removed: ",dump( $last_visible_tags ), " data: ",dump( $tags_data ) if $debug; @@ -696,7 +660,7 @@ warn "## DISPATCH payload to with rest", dump( $payload, $to, $rest ) if $debug; $dispatch->{ $to }->( $rest ); } else { - print "NO DISPATCH for ",as_hex( $full ),"\n"; + die "NO DISPATCH for ",as_hex( $full ),"\n"; } return $data;