| RFID-Matrics documentation | Contained in the RFID-Matrics distribution. |
RFID::Matrics::Reader::Serial - Implement RFID::Matrics::Reader over a serial link
This class takes a serial port object and implements the Matrics RFID protocol over it. This object is based on RFID::Reader::Serial, which should be consulted for additional information.
An example:
use Win32::Serialport;
use RFID::Matrics::Reader::Serial;
$com = Win32::SerialPort->new($opt{c})
or die "Couldn't open COM port '$opt{c}': $^E\n";
my $reader =
RFID::Matrics::Reader::Serial->new(Port => $com,
Node => 4,
Antenna => 1)
or die "Couldn't create reader object";
This class is built on top of RFID::Matrics::Reader, and uses RFID::Reader::Serial to implement the underlying setup, reading, and writing functions.
This creates a new RFID::Matrics::Reader::Serial object. All parameters are simply sent along to either the RFID::Reader::Serial Constructor or the set method (set in Matrics::Reader).
RFID::Matrics::Reader, RFID::Matrics::Reader::TCP, RFID::Reader::Serial, Win32::SerialPort, Device::SerialPort, http://www.eecs.umich.edu/~wherefid/code/rfid-perl/.
Scott Gifford <gifford@umich.edu>, <sgifford@suspectclass.com>
Copyright (C) 2004 The Regents of the University of Michigan.
See the file LICENSE included with the distribution for license information.
| RFID-Matrics documentation | Contained in the RFID-Matrics distribution. |
package RFID::Matrics::Reader::Serial; use RFID::Matrics::Reader; $VERSION=$RFID::Matrics::Reader::VERSION; use RFID::Reader::Serial; use Exporter; @ISA = qw(RFID::Reader::Serial RFID::Matrics::Reader Exporter); @EXPORT_OK = @RFID::Matrics::Reader::EXPORT_OK; %EXPORT_TAGS = %RFID::Matrics::Reader::EXPORT_TAGS; # Written by Scott Gifford <gifford@umich.edu> # Copyright (C) 2004 The Regents of the University of Michigan. # See the file LICENSE included with the distribution for license # information.
use RFID::Matrics::Reader qw(:ant); use Carp; use constant BAUDRATE => 230400; use constant DATABITS => 8; use constant STOPBITS => 1; use constant PARITY => 'none'; use constant HANDSHAKE => 'none'; use constant DEFAULT_TIMEOUT => 2000; #ms
sub new { my $class = shift; my(%p)=@_; my $self = {}; $self->{com} = $p{Port}||$p{comport} or croak __PACKAGE__."::new requires argument 'Port'\n"; $self->{timeout} = $p{Timeout}||$p{timeout}||DEFAULT_TIMEOUT; $self->{databits}=DATABITS; $self->{stopbits}=STOPBITS; $self->{parity}=PARITY; $self->{handshake}=HANDSHAKE; $self->{baudrate}=$p{Baudrate}||$p{baudrate}||BAUDRATE; bless $self,$class; # Initialize everything. foreach my $parent (@ISA) { if (my $init = $parent->can('_init')) { $init->($self,%p); } } $self; }
1;