NAME

RFID::Matrics::Reader - Abstract base class for a Matrics RFID reader

SYNOPSIS

This abstract base class provides most of the methods required for interfacing Perl with a Matrics RFID reader. To actually create an object, use RFID::Matrics::Reader::Serial or RFID::Matrics::Reader::TCP. It is based on RFID::Reader.

    use RFID::Matrics::Reader::Serial;
    my $reader = 
      RFID::Matrics::Reader::Serial->new(Port => $com_port_object,
				         Node => 4,
					 Antenna => 1)
        or die "Couldn't create reader object\n";

    my @err = $reader->set(PowerLevel => 0xff,
		           Environment => 4) == 0
        or die "Couldn't set params: @err\n";

    my @tags = $reader->readtags;
    foreach my $tag (@tags)
    {
	my $tag_info = $tag->get('Antenna','ID','Type');
	print "I see tag $tag_info{Type}.$tag_info{ID} ".
              "at antenna $tag_info{Antenna}.\n";
    }

DESCRIPTION

This abstract base class implements the commands for communicating with a Matrics reader. It is written according to the specifications in Matrics' Stationary Reader / Host Protocol (RS-485) Specification, using version 2.8 from October 19th 2003. It was tested with an RDR-001 model reader.

To actually create a reader object, use RFID::Matrics::Reader::Serial or RFID::Matrics::Reader::TCP. Those classes inherit from this one.

This class inherits some methods and settings from RFID::Reader.

METHODS

get

Get various properties of the reader or the internal state of the object. The syntax is described in the RFID::Reader get method documentation. See Matrics Properties and Generic Properties for the properties that can be retreived.

set

Set one or more properties associated with a reader. Depending on implementation, this may send one or more commands to the reader, set an internal flag, or take some other action.

This method takes a hash with the properties to be set as keys, and their new values as values. It returns a list of errors that occured; if no errors occured, it will return an empty list. In a scalar context, that evaluates to the number of errors that occured, so you can test for errors like this:

my @errs = $reader->set(SomeVariable => "New Value") == 0
  or die "Couldn't set SomeVariable: @errs";

See Properties for the properties that can be set.

readtags

Read all of the tags in the reader's field, honoring any settings affecting the reading and filtering of tags. This returns a (possibly empty) list of tags, which will be of type RFID::EPC::Tag or RFID::Tag::Matrics. See the RFID::Reader readtags method documentation for more information.

finish

Perform any cleanup tasks for the reader. In particular, shut off any constant reads that are currently running.

Properties

Antenna

The default antenna for get operations; see also AntennaSequence. This defaults to 1 if it is not set.

AntennaSequence

An arrayref of the antennas that should be queried, and in what order. The antenna names for a 4-port Matrics reader are simply 1, 2, 3, and 4. For example:

$reader->set(AntennaSequence => [1,2,3,4]);

The default AntennaSequence is the default Antenna.

Debug

Control the amount debugging information sent to STDERR. A higher value for this property will cause more information to be output.

UniqueTags

A boolean value controlling whether duplicate tags should be removed from the list returned by readtags.

Environment

How long an antenna should try to read tags during a readtags command, between 0 and 4. 0 will read for a very short time, and is appropriate for environments where tags come and go very quickly, and it's OK if you miss a tag somtimes. 4 will read for longer, and is appropriate where tags stay relatively static and you want the reader to try its best to find all of them.

When this item is retreived, you get the value for the default antenna. When it's set, it's set for all of the antennas in the AntennaSequence. To set the level for only one antenna, use Environment_Antennan, where n is the number of the antenna you'd like to set.

Node

The Matrics node address associated with this object. It defaults to 4.

PowerLevel

The amount of power an antenna should use when doing a read, between 0 and 255. 255 is full-power; the scale of this setting is logarithmic, so 208 is about 50% power, and 0x80 is about 25% power.

When this item is retreived, you get the value for the default antenna. When it's set, it's set for all of the antennas in the AntennaSequence. To set the level for only one antenna, use PowerLevel_Antennan, where n is the number of the antenna you'd like to set.

ReaderVersion

The software version running on this reader, as a string. Cannot be set.

ReaderSerialNum

The serial number of this reader, as a string. Cannot be set.

SEE ALSO

RFID::Matrics::Reader::Serial, RFID::Matrics::Reader::TCP, RFID::EPC::Tag, RFID::Matrics::Tag, http://www.eecs.umich.edu/~wherefid/code/rfid-perl/.

AUTHOR

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.