#!/usr/bin/perl -w # # TechTag_poller.pl # # Simple ISO host inventory polling for the FEIG readers. # # Copyright (C) 2001-2004 Brian Rudy (brudy@praecogito.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # # If a tag is found, send a request to the application server # for an image grab for the detected tags. # # 0.01 7/9/2004 # First working version. Only supports polling mode. # use RFID::FEIG::ISC; use LWP::Simple; my $serial_port = "/dev/ttyS1"; my $application_server = "zazaconsole"; #my $application_server = "zazaconsole.exhibits.thetech.org"; init_port($serial_port); Baud_Rate_Detection(); parse_response(getMsg(0.6)); # Main loop while (1) { #select(undef, undef, undef, 0.30); # sleep for 300ms select(undef, undef, undef, 0.03); # sleep for 30ms ISO_Host_Command_Inventory(); my @IDs = parse_response(getMsg(0.6)); # Scans can take up to 600ms! if ((defined $IDs[0]) && ($IDs[0] ne "0")) { if (scalar @IDs > 1) { my $ID_string = join "&ID=", @IDs; print "Requesting single image grab for visitors $ID_string\n"; if (is_error(getprint("http://" . $application_server . "/cgi-bin/SmartMuseum?operation=SnapImage&ID=" . $ID_string))) { print "SnapImage request to $application_server for ID=$ID_string failed!\n"; } } else { print "Requesting image grab for ID=" . $IDs[0] . "\n"; if (is_error(getprint("http://" . $application_server . "/cgi-bin/SmartMuseum?operation=SnapImage&ID=" . $IDs[0]))) { print "SnapImage request to $application_server for " . $IDs[0] . " failed!\n"; } } } else { #print "No tags found\n"; } } shutdown_port();