--- 3m-810.pl 2009/06/24 09:30:28 50 +++ 3m-810.pl 2009/06/24 13:39:43 54 @@ -14,7 +14,11 @@ my $debug = 0; -my $meteor_server = '192.168.1.13:4671'; +my $tags_data; +my $tags_security; +my $visible_tags; + +my $meteor_server; # = '192.168.1.13:4671'; my $meteor_fh; sub meteor { @@ -96,10 +100,11 @@ warn "WEB >> $path" if $debug; } elsif ( $method =~ m{/scan} ) { my $tags = scan_for_tags(); - my $json = {}; + my $json = { time => time() }; map { my $d = decode_tag($_); $d->{sid} = $_; + $d->{security} = $tags_security->{$_}; push @{ $json->{tags} }, $d; } keys %$tags; print $client "HTTP/1.0 200 OK\r\nContent-Type: application/x-javascript\r\n\r\n", @@ -205,9 +210,6 @@ =cut -my $tags_data; -my $visible_tags; - my $item_type = { 1 => 'Book', 6 => 'CD/CD ROM', @@ -309,6 +311,7 @@ $visible_tags = {}; foreach my $tag ( @tags ) { + $visible_tags->{$tag}++; if ( ! defined $last_visible_tags->{$tag} ) { if ( defined $tags_data->{$tag} ) { # meteor( 'in-range', $tag ); @@ -316,7 +319,6 @@ meteor( 'read', $tag ); read_tag( $tag ); } - $visible_tags->{$tag}++; } else { warn "## using cached data for $tag" if $debug; } @@ -432,6 +434,7 @@ ( $from_tag, $security ) = ( substr($rest,0,8), substr($rest,8,1) ); die "security from other tag: ",as_hex( $from_tag ) if $from_tag ne str2bytes( $tag ); $security = as_hex( $security ); + $tags_security->{$tag} = $security; warn "# SECURITY $tag = $security\n"; } ); @@ -657,7 +660,7 @@ warn "## DISPATCH payload to with rest", dump( $payload, $to, $rest ) if $debug; $dispatch->{ $to }->( $rest ); } else { - print "NO DISPATCH for ",dump( $full ),"\n"; + print "NO DISPATCH for ",as_hex( $full ),"\n"; } return $data;