com.phidgets
Class RFIDPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.phidgets.RFIDPhidget

public final class RFIDPhidget
extends Phidget

This class represents a Phidget RFID Reader. All methods to read tags and set outputs on the RFID reader are implemented in this class.

The Phidget RFID reader can read one tag at a time. Both tag and tagloss event handlers are provided, as well as control over the antenna so that multiple readers can exists in close proximity without interference.

Author:
Phidgets Inc.

Field Summary
static int PHIDGET_RFID_PROTOCOL_EM4100
          EM4100 (EM4102) 40-bit.
static int PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B
          ISO11785 FDX-B encoding (Animal ID).
static int PHIDGET_RFID_PROTOCOL_PHIDGETS
          PhidgetsTAG Protocol 24 character ASCII.
 
Fields inherited from class com.phidgets.Phidget
PHIDCLASS_ACCELEROMETER, PHIDCLASS_ADVANCEDSERVO, PHIDCLASS_ANALOG, PHIDCLASS_BRIDGE, PHIDCLASS_ENCODER, PHIDCLASS_FREQUENCYCOUNTER, PHIDCLASS_GPS, PHIDCLASS_INTERFACEKIT, PHIDCLASS_LED, PHIDCLASS_MOTORCONTROL, PHIDCLASS_NOTHING, PHIDCLASS_PHSENSOR, PHIDCLASS_RFID, PHIDCLASS_SERVO, PHIDCLASS_STEPPER, PHIDCLASS_TEMPERATURESENSOR, PHIDCLASS_TEXTLCD, PHIDCLASS_TEXTLED, PHIDCLASS_WEIGHTSENSOR, PHIDGET_LOG_CRITICAL, PHIDGET_LOG_DEBUG, PHIDGET_LOG_ERROR, PHIDGET_LOG_INFO, PHIDGET_LOG_VERBOSE, PHIDGET_LOG_WARNING, PHIDID_ACCELEROMETER_2AXIS, PHIDID_ACCELEROMETER_3AXIS, PHIDID_ADVANCEDSERVO_1MOTOR, PHIDID_ADVANCEDSERVO_8MOTOR, PHIDID_ANALOG_4OUTPUT, PHIDID_BIPOLAR_STEPPER_1MOTOR, PHIDID_BRIDGE_4INPUT, PHIDID_ENCODER_1ENCODER_1INPUT, PHIDID_ENCODER_HS_1ENCODER, PHIDID_ENCODER_HS_4ENCODER_4INPUT, PHIDID_FREQUENCYCOUNTER_2INPUT, PHIDID_GPS, PHIDID_INTERFACEKIT_0_0_4, PHIDID_INTERFACEKIT_0_0_8, PHIDID_INTERFACEKIT_0_16_16, PHIDID_INTERFACEKIT_0_8_8_w_LCD, PHIDID_INTERFACEKIT_2_2_2, PHIDID_INTERFACEKIT_4_8_8, PHIDID_INTERFACEKIT_8_8_8, PHIDID_INTERFACEKIT_8_8_8_w_LCD, PHIDID_IR, PHIDID_LED_64, PHIDID_LED_64_ADV, PHIDID_LINEAR_TOUCH, PHIDID_MOTORCONTROL_1MOTOR, PHIDID_MOTORCONTROL_HC_2MOTOR, PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT, PHIDID_NOTHING, PHIDID_PHSENSOR, PHIDID_RFID, PHIDID_RFID_2OUTPUT, PHIDID_RFID_2OUTPUT_READ_WRITE, PHIDID_ROTARY_TOUCH, PHIDID_SERVO_1MOTOR, PHIDID_SERVO_1MOTOR_OLD, PHIDID_SERVO_4MOTOR, PHIDID_SERVO_4MOTOR_OLD, PHIDID_SPATIAL_ACCEL_3AXIS, PHIDID_SPATIAL_ACCEL_GYRO_COMPASS, PHIDID_TEMPERATURESENSOR, PHIDID_TEMPERATURESENSOR_4, PHIDID_TEMPERATURESENSOR_IR, PHIDID_TEXTLCD_2x20, PHIDID_TEXTLCD_2x20_w_0_8_8, PHIDID_TEXTLCD_2x20_w_8_8_8, PHIDID_TEXTLCD_ADAPTER, PHIDID_TEXTLED_1x8, PHIDID_TEXTLED_4x8, PHIDID_UNIPOLAR_STEPPER_4MOTOR, PHIDID_WEIGHTSENSOR
 
Constructor Summary
RFIDPhidget()
           
 
Method Summary
 void addOutputChangeListener(OutputChangeListener l)
          Adds an output change listener.
 void addTagGainListener(TagGainListener l)
          Adds a tag gained listener.
 void addTagLossListener(TagLossListener l)
          Adds a tag lost listener.
 boolean getAntennaOn()
          Returns the state of the antenna.
 java.lang.String getLastTag()
          Returns the last tag read.
 int getLastTagProtocol()
          Returns the protocol of the last tag read.
 boolean getLEDOn()
          Returns the state of the onboard LED.
 int getOutputCount()
          Returns the number of outputs.
 boolean getOutputState(int index)
          Returns the state of an output.
 boolean getTagStatus()
          Returns the state of whether or not a tag is being read by the reader.
 void removeOutputChangeListener(OutputChangeListener l)
           
 void removeTagGainListener(TagGainListener l)
           
 void removeTagLossListener(TagLossListener l)
           
 void setAntennaOn(boolean state)
          Sets the state of the antenna.
 void setLEDOn(boolean state)
          Sets the state of the onboard LED.
 void setOutputState(int index, boolean state)
          Sets the state of a digital output.
 void write(java.lang.String tag, int protocol, boolean lock)
          Writes a tag.
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, addServerConnectListener, addServerDisconnectListener, close, disableLogging, enableLogging, equals, getDeviceClass, getDeviceID, getDeviceLabel, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getServerAddress, getServerID, getServerPort, isAttached, isAttachedToServer, log, open, open, open, open, open, openAny, openAny, openAny, openAny, openAny, openLabel, openLabel, openLabel, openLabel, openLabel, removeAttachListener, removeDetachListener, removeErrorListener, removeServerConnectListener, removeServerDisconnectListener, setDeviceLabel, toString, waitForAttachment, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PHIDGET_RFID_PROTOCOL_EM4100

public static final int PHIDGET_RFID_PROTOCOL_EM4100
EM4100 (EM4102) 40-bit. This is used with getSgetLastTagProtocolcreenSize and write

See Also:
Constant Field Values

PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B

public static final int PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B
ISO11785 FDX-B encoding (Animal ID). This is used with getSgetLastTagProtocolcreenSize and write

See Also:
Constant Field Values

PHIDGET_RFID_PROTOCOL_PHIDGETS

public static final int PHIDGET_RFID_PROTOCOL_PHIDGETS
PhidgetsTAG Protocol 24 character ASCII. This is used with getSgetLastTagProtocolcreenSize and write

See Also:
Constant Field Values
Constructor Detail

RFIDPhidget

public RFIDPhidget()
            throws PhidgetException
Method Detail

getOutputCount

public int getOutputCount()
                   throws PhidgetException
Returns the number of outputs. These are the outputs provided by the terminal block. Older RFID readers do not have these outputs, and this method will return 0.

Returns:
number of outputs
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getOutputState

public boolean getOutputState(int index)
                       throws PhidgetException
Returns the state of an output. True indicated activated, False deactivated, which is the default.

Parameters:
index - index of the output
Returns:
state of the output
Throws:
PhidgetException - If this Phidget is not opened and attached, or the index is out of range. See open for information on determining if a device is attached.

setOutputState

public void setOutputState(int index,
                           boolean state)
                    throws PhidgetException
Sets the state of a digital output. True indicated activated, False deactivated, which is the default.

Parameters:
index - index of the output
state - desired state
Throws:
PhidgetException - If this Phidget is not opened and attached, or the index is out of range. See open for information on determining if a device is attached.

getAntennaOn

public boolean getAntennaOn()
                     throws PhidgetException
Returns the state of the antenna. True indicated that the antenna is active, False indicated inactive.

Returns:
state of the antenna
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

setAntennaOn

public void setAntennaOn(boolean state)
                  throws PhidgetException
Sets the state of the antenna. True turns the antenna on, False turns it off. The antenna if by default turned off, and needs to be explicitely activated before tags can be read. Control over the antenna allows multiple readers to be used in close proximity, as multiple readers will interfere with each other if their antenna's are activated simultaneously.

Parameters:
state - new state for the antenna
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getLEDOn

public boolean getLEDOn()
                 throws PhidgetException
Returns the state of the onboard LED. This LED is by default turned off.

Returns:
state of the LED
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

setLEDOn

public void setLEDOn(boolean state)
              throws PhidgetException
Sets the state of the onboard LED. True turns the LED on, False turns it off. The LED is by default turned off.

Parameters:
state - new state for the LED
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getLastTag

public java.lang.String getLastTag()
                            throws PhidgetException
Returns the last tag read. This method will only return a valid tag after a tag has been seen. This method can be used even after a tag has been removed from the reader

Returns:
tag
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getLastTagProtocol

public int getLastTagProtocol()
                       throws PhidgetException
Returns the protocol of the last tag read. This method will only return a valid protocol after a tag has been seen. This method can be used even after a tag has been removed from the reader

Returns:
protocol
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getTagStatus

public boolean getTagStatus()
                     throws PhidgetException
Returns the state of whether or not a tag is being read by the reader. True indicated that a tag is on (or near) the reader, false indicates that one is not.

Returns:
tag read state
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

write

public void write(java.lang.String tag,
                  int protocol,
                  boolean lock)
           throws PhidgetException
Writes a tag.

Parameters:
tag - tag string
protocol - tag protocol
lock - lock tag from futher writes
Throws:
PhidgetException - If this Phidget is not opened and attached, if the string is too malformed, or the protocol is invalid. See open for information on determining if a device is attached.

addTagGainListener

public final void addTagGainListener(TagGainListener l)
Adds a tag gained listener. The tag gaiend handler is a method that will be called when a new tag is seen by the reader. The event is only fired one time for a new tag, so the tag has to be removed and then replaced before another tag gained event will fire.

There is no limit on the number of tag gained change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the TagGainListener interface

removeTagGainListener

public final void removeTagGainListener(TagGainListener l)

addTagLossListener

public final void addTagLossListener(TagLossListener l)
Adds a tag lost listener. The tag lost handler is a method that will be called when a tag is removed from the reader.

There is no limit on the number of tag lost change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the TagLossListener interface

removeTagLossListener

public final void removeTagLossListener(TagLossListener l)

addOutputChangeListener

public final void addOutputChangeListener(OutputChangeListener l)
Adds an output change listener. The output change handler is a method that will be called when an output has changed.

There is no limit on the number of output change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the OutputChangeListener interface

removeOutputChangeListener

public final void removeOutputChangeListener(OutputChangeListener l)