com.alien.enterpriseRFID.reader
Class AlienClass01Reader

java.lang.Object
  extended bycom.alien.enterpriseRFID.reader.AbstractReader
      extended bycom.alien.enterpriseRFID.reader.AlienClass1Reader
          extended bycom.alien.enterpriseRFID.reader.AlienClass01Reader
All Implemented Interfaces:
java.lang.Runnable

public class AlienClass01Reader
extends AlienClass1Reader
implements java.lang.Runnable

This class allows the host to interact with Alien readers which use the RQL (Reader Query Language) protocol.

Once a valid reader object is instantiated, the user would first open a connection to it, then use any of the simple methods that implement the full command set described by the Reader Interface Guide. Without having the benefit of an ASCII-based interface controller on the reader, much of the autonomous mode functionality found on Alien's full-sized readers must be emulated (partially) by this class. Basically, this class supports autonomous operation only in that it can read tags constantly on it's own, maintaining its own TagList.

This class inherits from AlienClass1Reader, which supports readers with much more functionality than the Class 0/1 readers provide. As such, the sendString() and receiveString() methods are overridden so that commands designed to work only with ASCII-based readers are not sent to OEM readers.

Version:
1.0 Aug 2004
Author:
David Krull

Field Summary
 int lastCommandByteCount
           
 byte[] lastCommandBytes
           
 int lastResponseByteCount
           
 byte[] lastResponseBytes
           
 TagTable tagTable
           
 
Fields inherited from class com.alien.enterpriseRFID.reader.AlienClass1Reader
ALL_MASK, CLASS0, CLASS1GEN1_64BITS, CLASS1GEN1_96BITS, CLASS1GEN1_ALL, CLASS1GEN1_LEPTON, CLASS1GEN1_OMEGA, CLASS1GEN1_QUARK, CLASS1GEN2, CUSTOM_FORMAT, DATA_INC_ALWAYS, DATA_INC_FAIL, DATA_INC_OFF, DATA_INC_SUCCESS, DATA_INC_WRITE, DATE_FORMATTER, FUNCTION_PROGRAMMER, FUNCTION_READER, G2TARGET_A, G2TARGET_AB, G2TARGET_B, GLOBAL_SCROLL, INVENTORY, LOCKTYPE_LOCK, LOCKTYPE_PERMALOCK, LOCKTYPE_PERMAUNLOCK, LOG_OFF, LOG_ON, OFF, ON, PROG_CLASS0, PROG_CLASS1GEN1, PROG_CLASS1GEN2, RFMOD_DRM, RFMOD_HS, RFMOD_STD, TERSE_FORMAT, TEXT_FORMAT, XML_FORMAT
 
Fields inherited from class com.alien.enterpriseRFID.reader.AbstractReader
DEBUG_BYTES, DEBUG_OFF, DEBUG_TEXT, DEFAULT_TIMEOUT, TIMEOUTMODE_CHARACTER, TIMEOUTMODE_COMMAND
 
Constructor Summary
AlienClass01Reader()
          Constructs a new AlienClass01Reader object, initializing an internal TagTable, and setting AutoMode off.
AlienClass01Reader(java.lang.String address)
          Constructs a new AlienClass01Reader object, specifying the address.
AlienClass01Reader(java.lang.String ipAddress, int port)
           
 
Method Summary
 void autoModeReset()
          Reset all autonomous mode values to their default states, including turning autonomous mode off.
 void clearTagList()
          Clears all the tags from the internal TagList.
 void eraseTag()
          Erases the data in the tag's ID space, using default loop-control parameters.
 java.lang.String getAcquireMode()
          Returns the method that the reader uses to scan for tags.
 int getActiveAntenna()
          Returns the number of the active antenna.
 java.lang.String getAntennaSequence()
          Returns the Antenna Sequence, as a comma-separated String of hex values.
 int getAutoMode()
          Returns the ON/OFF status of Autonomous mode.
 int getPersistTime()
          Returns the time, in seconds, that tags on the internal TagList will persist without having been read, before being purged from the list.
 int getProgAntenna()
          Returns the number of the programming antenna.
 java.lang.String getReaderName()
          Returns the reader name.
 java.lang.String getReaderType()
          Returns the reader type.
 java.lang.String getReaderVersion()
          Returns the firmware version of this reader.
 Tag getTag()
          Acquires one Tag, once.
 Tag getTag(int multiplier)
          Acquires one Tag, using a multiplier.
 java.lang.String getTagID()
          Acquires tags, and returns the TagID of the first tag on the TagList.
 Tag[] getTagList()
          Returns an array of tags known to the reader, once.
 Tag[] getTagList(int multiplier)
          Fetches and returns the tag list, using a multiplier count.
 Tag[] getTagList(long readMillis)
          Reads tags for the specified number of milliseconds.
 int getTagType()
          High Level functions
 java.lang.String getTimer()
          Returns the Timer text for the most recent acquire.
 java.lang.String issueReaderCommand(java.lang.String commandString)
          Issues a string command to the reader, and returns the reader's response.
 void killTag(java.lang.String tagIDAndPassCode)
          Kills a tag by erasing the data in a locked tag's ID space, using default loop-control parameters.
 void lockTag(java.lang.String passCode)
          Locks a Tag, using default loop-control parameters and tagID length.
 void parseTagListString(java.lang.String tagListString)
           
 void programTag(java.lang.String tagID)
          Writes data to the tag ID space, using default loop-control parameters.
 java.lang.String readerCommandCLI()
          Enables raw RQL-based command sequences to be sent to the reader.
 void reboot()
          Causes the reader module to reboot.
 byte[] receiveBytes()
          Receives and entire response message from the reader.
 java.lang.String receiveString(boolean blockForInput)
          Returns the response string prepared by the sendString() method, as it if came from a reader sporting an ASCII-based interface.
 void run()
          Run the automode function for this reader.
 void sendBytes(byte[] bytes)
          Sends an arbitrary sequence of bytes to the reader.
 void sendString(java.lang.String command)
          Intercepts a command string intended for the RQL-based reader, and attempts to handle the command using methods from this class.
 void setAcquireMode(java.lang.String acquireMode)
          Specifies the method the reader uses to scan for tags.
 void setActiveAntenna(int antennaNumber)
          Sets the active antenna to the specified value.
 void setAntennaSequence(java.lang.String sequenceString)
          Sets the sequence of antenna ports, using a comma-separated String of integer values, that is used by the reader when responding to an Inventory command.
 void setAutoMode(int autoMode)
          Sets the ON/OFF status of Autonomous mode.
 void setDebugLevel(int level)
          Sets the current Debug Level.
 void setPersistTime(int persistTime)
          Sets the time, in seconds, that tags on the internal TagList will persist without having been read, before being purged from the list.
 void setProgAntenna(int antennaNumber)
          Sets the programming antenna to the specified value.
 void setTagType(int tagType)
          Sets the bitmap indicating which Alien RFID tag types the reader should look for.
 java.lang.String toString()
          Returns a String representation of this reader object (it's ReaderType).
 java.lang.String verifyTag()
          Interrogates the state of a tag that may or may not be readable by the Acquire commands.
 
Methods inherited from class com.alien.enterpriseRFID.reader.AlienClass1Reader
autoModeTriggerNow, clearIOList, g2Erase, g2Read, g2Wake, g2Wake, g2Write, getAcqC1Mask, getAcqG2AccessPwd, getAcqG2Mask, getAcqG2MaskAction, getAcqG2MaskAntenna, getAcqG2SL, getAcqMask, getAcquireC0Count, getAcquireC0Cycles, getAcquireC1Count, getAcquireC1Cycles, getAcquireC1EnterWakeCount, getAcquireC1ExitWakeCount, getAcquireC1SleepCount, getAcquireCount, getAcquireCycles, getAcquireEnterWakeCount, getAcquireExitWakeCount, getAcquireG2Count, getAcquireG2Cycles, getAcquireG2Ops, getAcquireG2Ops, getAcquireG2OpsMode, getAcquireG2Q, getAcquireG2Selects, getAcquireG2Session, getAcquireG2TagData, getAcquireG2Target, getAcquireSleep, getAcquireSleepCount, getAcquireTime, getAcquireWakeCount, getAutoAction, getAutoErrorOutput, getAutoFalseOutput, getAutoFalsePause, getAutoModeStatus, getAutoProgError, getAutoStartPause, getAutoStartTrigger, getAutoStopPause, getAutoStopTimer, getAutoStopTrigger, getAutoTrueOutput, getAutoTruePause, getAutoWaitOutput, getAutoWorkOutput, getCommandPort, getCustomTagList, getCustomTagList, getDHCP, getDNS, getExternalInput, getExternalOutput, getGateway, getHeartbeatAddress, getHeartbeatCount, getHeartbeatPort, getHeartbeatTime, getHostname, getInfo, getInitExternalOutput, getInvertExternalInput, getInvertExternalOutput, getIOList, getIOListCustomFormat, getIOListDump, getIOListFormat, getIOStreamAddress, getIOStreamCustomFormat, getIOStreamFormat, getIOStreamKeepAliveTime, getIOStreamMode, getIOType, getIPAddress, getLBT, getLBTLimit, getLBTValue, getMACAddress, getMailFrom, getMailServer, getMask, getMaxAntenna, getMyData, getNetmask, getNetworkTimeout, getNetworkUpgrade, getNotifyAddress, getNotifyFormat, getNotifyHeader, getNotifyInclude, getNotifyKeepAliveTime, getNotifyMode, getNotifyQueueLimit, getNotifyRetryCount, getNotifyRetryPause, getNotifyTime, getNotifyTrigger, getPassword, getProgAlienImageMap, getProgAlienImageNSI, getProgAttempts, getProgBlockAlign, getProgBlockSize, getProgC1KillPwd, getProgDataUnit, getProgEPCData, getProgEPCDataInc, getProgEPCDataIncCount, getProgEraseAttempts, getProgG2AccessPwd, getProgG2KillPwd, getProgG2LockType, getProgG2NSI, getProgIncrementOnFail, getProgProtocol, getProgramID, getProgramPassCode, getProgReadAttempts, getProgSingulate, getProgUserData, getProgUserDataInc, getProgUserDataIncCount, getReaderBaudRate, getReaderFunction, getReaderNumber, getReaderPassword, getReaderUsername, getRFAttenuation, getRFAttenuation, getRFAttenuations, getRFAttenuations, getRFLevel, getRFLevel, getRFLevels, getRFLevels, getRFModulation, getRSSIFilter, getSpeedFilter, getStreamHeader, getTagAuth, getTagID, getTagInfo, getTagListAntennaCombine, getTagListCustomFormat, getTagListFormat, getTagListMillis, getTagStreamAddress, getTagStreamCountFilter, getTagStreamCountFilterMinimum, getTagStreamCustomFormat, getTagStreamFormat, getTagStreamKeepAliveTime, getTagStreamMode, getTime, getTimeServer, getTimeZone, getUpgradeAddress, getUpgradeIPAddress, getUpgradePort, getUptime, getUsername, getWWWPort, heartbeatNow, hideAlienUserBlocks, lockAccessPwd, lockAccessPwd, lockEPC, lockEPC, lockKillPwd, lockKillPwd, lockUser, lockUser, lockUserBlocks, macroDel, macroDelAll, macroList, macroRun, macroStartRec, macroStopRec, macroView, notifyNow, ping, ping, programAccessPwd, programAccessPwd, programAlienImage, programAndLockEPC, programAndLockEPC, programAndLockUser, programAndLockUser, programEPC, programEPC, programKillPwd, programKillPwd, programUser, programUser, reboot, resetAutoMode, saveSettings, setAcqC1Mask, setAcqC1Mask, setAcqG2AccessPwd, setAcqG2Mask, setAcqG2Mask, setAcqG2MaskAction, setAcqG2MaskAntenna, setAcqG2SL, setAcqMask, setAcqMask, setAcquireC0Count, setAcquireC0Cycles, setAcquireC1Count, setAcquireC1Cycles, setAcquireC1EnterWakeCount, setAcquireC1ExitWakeCount, setAcquireC1SleepCount, setAcquireCount, setAcquireCycles, setAcquireEnterWakeCount, setAcquireExitWakeCount, setAcquireG2Count, setAcquireG2Cycles, setAcquireG2Ops, setAcquireG2Ops, setAcquireG2Ops, setAcquireG2OpsMode, setAcquireG2Q, setAcquireG2Selects, setAcquireG2Session, setAcquireG2TagData, setAcquireG2TagData, setAcquireG2Target, setAcquireSleep, setAcquireSleepCount, setAcquireTime, setAcquireWakeCount, setAutoAction, setAutoErrorOutput, setAutoFalseOutput, setAutoFalsePause, setAutoProgError, setAutoStartPause, setAutoStartTrigger, setAutoStartTrigger, setAutoStopPause, setAutoStopTimer, setAutoStopTrigger, setAutoStopTrigger, setAutoTrueOutput, setAutoTruePause, setAutoWaitOutput, setAutoWorkOutput, setC1MaskBits, setC1TagMask, setCommandPort, setDefaultIOListFormat, setDefaultTagListFormat, setDHCP, setDNS, setExternalOutput, setFactorySettings, setFactorySettings, setG2MaskBits, setG2TagMask, setGateway, setHeartbeatAddress, setHeartbeatCount, setHeartbeatPort, setHeartbeatTime, setHostname, setInitExternalOutput, setInvertExternalInput, setInvertExternalOutput, setIOListCustomFormat, setIOListFormat, setIOStreamAddress, setIOStreamAddress, setIOStreamCustomFormat, setIOStreamFormat, setIOStreamKeepAliveTime, setIOStreamMode, setIOType, setIPAddress, setLBT, setLBTLimit, setLogLevel, setMailFrom, setMailServer, setMask, setMask, setMaskBits, setMyData, setNetmask, setNetworkTimeout, setNetworkUpgrade, setNotifyAddress, setNotifyAddress, setNotifyFormat, setNotifyHeader, setNotifyInclude, setNotifyKeepAliveTime, setNotifyMode, setNotifyQueueLimit, setNotifyRetryCount, setNotifyRetryPause, setNotifyTime, setNotifyTrigger, setPassword, setProgAlienImageMap, setProgAlienImageNSI, setProgAttempts, setProgBlockAlign, setProgBlockSize, setProgC1KillPwd, setProgDataUnit, setProgEPCData, setProgEPCDataInc, setProgEPCDataIncCount, setProgEraseAttempts, setProgG2AccessPwd, setProgG2KillPwd, setProgG2LockType, setProgG2NSI, setProgIncrementOnFail, setProgProtocol, setProgramID, setProgramPassCode, setProgReadAttempts, setProgSingulate, setProgUserData, setProgUserDataInc, setProgUserDataIncCount, setReaderBaudRate, setReaderFunction, setReaderName, setReaderNumber, setReaderPassword, setReaderUsername, setRFAttenuation, setRFAttenuation, setRFAttenuations, setRFLevel, setRFLevel, setRFLevels, setRFModulation, setRSSIFilter, setRSSIFilter, setSpeedFilter, setSpeedFilter, setStreamHeader, setTagAuth, setTagListAntennaCombine, setTagListCustomFormat, setTagListFormat, setTagListMillis, setTagMask, setTagStreamAddress, setTagStreamAddress, setTagStreamCountFilter, setTagStreamCountFilter, setTagStreamCustomFormat, setTagStreamFormat, setTagStreamKeepAliveTime, setTagStreamMode, setTime, setTime, setTime, setTimeServer, setTimeZone, setUpgradeAddress, setUpgradeIPAddress, setUpgradePort, setUsername, setWWWPort, sleep, sleepTag, unlockAccessPwd, unlockAccessPwd, unlockEPC, unlockEPC, unlockKillPwd, unlockKillPwd, unlockUser, unlockUser, upgradeNow, upgradeNow, upgradeNowList, upgradeNowList, waitForReboot, wake, wakeTag
 
Methods inherited from class com.alien.enterpriseRFID.reader.AbstractReader
bringIntoRange, clearInputBuffer, close, doReaderCommand, getAddress, getDebugLevel, getInputStream, getOutputStream, getReaderReply, getReaderReplyKeyword, getReaderReplyValueInt, getReaderReplyValueString, getTimeOutMilliseconds, getTimeOutMode, isOpen, isValidateOpen, open, receiveLine, setAddress, setConnection, setConnection, setInputStream, setNetworkConnection, setOutputStream, setSerialBaudRate, setSerialConnection, setTimeOutMilliseconds, setTimeOutMode, setValidateOpen, test
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tagTable

public TagTable tagTable

lastResponseBytes

public byte[] lastResponseBytes

lastCommandBytes

public byte[] lastCommandBytes

lastResponseByteCount

public int lastResponseByteCount

lastCommandByteCount

public int lastCommandByteCount
Constructor Detail

AlienClass01Reader

public AlienClass01Reader(java.lang.String address)
Constructs a new AlienClass01Reader object, specifying the address.

Parameters:
address - the IP Address where the reader is connected

AlienClass01Reader

public AlienClass01Reader()
Constructs a new AlienClass01Reader object, initializing an internal TagTable, and setting AutoMode off.


AlienClass01Reader

public AlienClass01Reader(java.lang.String ipAddress,
                          int port)
Method Detail

setDebugLevel

public void setDebugLevel(int level)
Description copied from class: AbstractReader
Sets the current Debug Level.

Setting the Debug Level to DEBUG_TEXT causes the text of every reader command/response to be echoed to stdout. For example, calling getReaderName() with Debug Level set to DEBUG_TEXT displays the following:

      Write: Get ReaderName
      Read: ReaderName = Alien RFID Reader
 
Setting the Debug Level to DEBUG_BYTES causes the raw hex data of every reader command/response to be echoed to stdout. For example, the same getReaderName() call with Debug Level set to DEBUG_BYTES displays the following:
      Write: 01 47 65 74 20 52 65 61 64 65 72 4E 61 6D 65 0D 0A
      Read: 52 65 61 64 65 72 4E 61
      Read: 6D 65 20 3D 20 41 6C 69
      Read: 65 6E 20 52 46 49 44 20
      Read: 52 65 61 64 65 72 0D 0A
      Read: 00
 
This Debug Level shows the additional bytes sent to and received from the reader that are used to prefix and terminate commands and responses.

Setting the Debug Level to DEBUG_OFF turns off these diagnostic messages, which is the default state.

Overrides:
setDebugLevel in class AbstractReader
Parameters:
level - the new Debug Level setting

issueReaderCommand

public java.lang.String issueReaderCommand(java.lang.String commandString)
                                    throws AlienReaderConnectionException,
                                           AlienReaderTimeoutException,
                                           AlienReaderCommandErrorException
Issues a string command to the reader, and returns the reader's response.

Any responses from the reader which indicate an error cause this class to generate an exception, which must be handled by the object which made the original call.

Parameters:
commandString - the command to send
Throws:
AlienReaderConnectionException - if communication fails
AlienReaderTimeoutException - if the communication times out
AlienReaderCommandErrorException - if the reader returns an error response to the command

getTagType

public int getTagType()
High Level functions

Overrides:
getTagType in class AlienClass1Reader
Returns:
the bitmap indicating the tag types the reader is looking for

setTagType

public void setTagType(int tagType)
Description copied from class: AlienClass1Reader
Sets the bitmap indicating which Alien RFID tag types the reader should look for. There are currently three types of Alien RFID tags: "Quark", "Omega", and "Lepton". By asking the reader to ignore certain tag types, the reader can, under some circumstances, acquire tags at a higher speed.

This is primarily due to the fact that "Lepton" tags have longer id spaces (128 bits) than "Quark" and "Omega" tags (96 bits). If the reader is looking only for Leptons, or only for Quarks and Omegas, it knows beforehand how many bits of ID to expect from a tag, and can therefore operate more quickly.

The value returned is a bit map, where each bit enables a certain tag type:

    Bit 0 : 64-bit Class1 (Quark)
    Bit 1 : 64-bit Class1 (Omega)
    Bit 2 : 96-bit Class1 (Lepton)
    Bit 3 : Class0/Class0+
    Bit 4 : Class1 Gen2
    Bit 5 : reserved
    Bit 6 : reserved
    Bit 7 : reserved
 
So, to have the reader look only for Quark and Omega tag types, use a TagType of 3 ("011" decimal). Similarly, use a TagType of 7 to specify looking for all Class1 Gen1 tag types, and a TagType of 4 to specify Lepton tags only.

The allowable range for TagType depends on the reader, and it's list of supported tag protocols.

For convenience, a series of constants are defined in this class: CLASS1GEN1_QUARK, CLASS1GEN1_OMEGA, CLASS1GEN1_64BITS, CLASS1GEN1_LEPTON, CLASS1GEN1_96BITS CLASS1GEN1_ALL, CLASS0, CLASS1GEN2. These constants facilitate selecting specific tag types or combinations of tag types, by ORing ( | ) the constants together in the call to setTagType().

Overrides:
setTagType in class AlienClass1Reader
Parameters:
tagType - the bitmap indicating the tag types the reader should look for

setPersistTime

public void setPersistTime(int persistTime)
Sets the time, in seconds, that tags on the internal TagList will persist without having been read, before being purged from the list.

Overrides:
setPersistTime in class AlienClass1Reader
Parameters:
persistTime - the time (secs) to wait before purging unseen tags
See Also:
AlienClass1Reader.getPersistTime()

getPersistTime

public int getPersistTime()
Returns the time, in seconds, that tags on the internal TagList will persist without having been read, before being purged from the list.

Overrides:
getPersistTime in class AlienClass1Reader
Returns:
the time (secs) to wait before purging unseen tags
See Also:
AlienClass1Reader.setPersistTime(int)

clearTagList

public void clearTagList()
Clears all the tags from the internal TagList.

Overrides:
clearTagList in class AlienClass1Reader
See Also:
AlienClass1Reader.getTagList(int), AlienClass1Reader.getTagList(int), AlienClass1Reader.getTag(int), AlienClass1Reader.getTag(int)

getTagList

public Tag[] getTagList()
                 throws AlienReaderException
Returns an array of tags known to the reader, once.

Overrides:
getTagList in class AlienClass1Reader
Returns:
an array of Tags, or null if no tags
Throws:
AlienReaderException - if reader communication fails
See Also:
getTagList(int)

getTagList

public Tag[] getTagList(int multiplier)
                 throws AlienReaderException
Fetches and returns the tag list, using a multiplier count. If AutoMode is ON, the TagList compiled so far is simply returned, then cleared. If AutoMode is OFF, the current compiled TagList is cleared, the reader acquires tags (using the supplied acquire multiplier, and the new TagList is returned.

Overrides:
getTagList in class AlienClass1Reader
Parameters:
multiplier - the number of times to acquire tags
Returns:
an array of Tags, or null if no tags
Throws:
AlienReaderException - if reader communication fails
See Also:
AlienClass1Reader.getTagList(int), AlienClass1Reader.getTag(int), AlienClass1Reader.getTag(int), AlienClass1Reader.clearTagList()

getTagList

public Tag[] getTagList(long readMillis)
                 throws AlienReaderException
Reads tags for the specified number of milliseconds.

Parameters:
readMillis - the amount of time to spend reading tags
Returns:
array of Tag objects
Throws:
AlienReaderException - if reader communication fails

getTag

public Tag getTag()
           throws AlienReaderException
Acquires one Tag, once. Returns the first Tag on the TagList, performing an acquire first, if necessary.

Overrides:
getTag in class AlienClass1Reader
Returns:
the first Tag on the TagList
Throws:
AlienReaderException - if reader communication fails
See Also:
getTag(int), getTagList(), getTagList(int)

getTag

public Tag getTag(int multiplier)
           throws AlienReaderException
Acquires one Tag, using a multiplier. Returns the first Tag on the TagList, performing an acquire first (multiple times), if necessary.

Overrides:
getTag in class AlienClass1Reader
Parameters:
multiplier - the number of times to acquire tags
Returns:
the first Tag on the TagList
Throws:
AlienReaderException - if reader communication fails
See Also:
getTag(), getTagList(), getTagList(int)

getTagID

public java.lang.String getTagID()
                          throws AlienReaderException
Acquires tags, and returns the TagID of the first tag on the TagList.

Overrides:
getTagID in class AlienClass1Reader
Returns:
the TagID of the tag in the field
Throws:
AlienReaderException - if reader communication fails
See Also:
getTag()

getAutoMode

public int getAutoMode()
Returns the ON/OFF status of Autonomous mode.

Overrides:
getAutoMode in class AlienClass1Reader
Returns:
the ON/OFF status of AutoMode
See Also:
setAutoMode(int), AlienClass1Reader.resetAutoMode()

setAutoMode

public void setAutoMode(int autoMode)
Sets the ON/OFF status of Autonomous mode.

In the interests of future compatibility, you should use AlienClass1Reader.ON and AlienClass1Reader.OFF constants to set and test this parameter.

Overrides:
setAutoMode in class AlienClass1Reader
Parameters:
autoMode - the new ON/OFF status of AutoMode
See Also:
getAutoMode(), AlienClass1Reader.resetAutoMode()

autoModeReset

public void autoModeReset()
Reset all autonomous mode values to their default states, including turning autonomous mode off.

Overrides:
autoModeReset in class AlienClass1Reader
See Also:
getAutoMode(), setAutoMode(int)

getAcquireMode

public java.lang.String getAcquireMode()
Returns the method that the reader uses to scan for tags. May be "Inventory" or "Global Scroll".

Overrides:
getAcquireMode in class AlienClass1Reader
Returns:
the method this reader uses to read tags
See Also:
setAcquireMode(String)

setAcquireMode

public void setAcquireMode(java.lang.String acquireMode)
Specifies the method the reader uses to scan for tags. Whenever the reader is called upon to read a tag, it does so using the current AcquireMode. Currently the allowable modes are as follows: The default setting is Inventory. For the sake of future compatibility, it is suggested you use AlienClass1Reader.INVENTORY and AlienClass1Reader.GLOBAL_SCROLL to specify and test for this parameter.

Inventory
The Inventory acquire mode performs a full anti-collision search on tags in the reader's field of view. This method will locate and distinguish multiple tags in front of the reader at the same time.

Global Scroll
The Global Scroll acquire mode instructs the reader to read a single tag repeatedly. This is a very fast tag reading method which is most effective when only one tag at a time is expected to be within reader range, as in conveyor belt applications. Under such circumstances, the performance for single tag reading is considerably faster than repeatedly doing a full tag search using the Inventory mode.

NOTE: If multiple tags are in range of the reader when Global Scroll is used, the reader will either select one of the tags (usually the "strongest" or "loudest") to read and report it, or will read none of the tags.

Overrides:
setAcquireMode in class AlienClass1Reader
Parameters:
acquireMode - the method this reader uses to read tags
See Also:
getAcquireMode()

getReaderName

public java.lang.String getReaderName()
Returns the reader name. Since Alien OEM readers don't have the concept of a ReaderName built into them, this method simply returns "Alien Class 1/0 Reader".

Overrides:
getReaderName in class AlienClass1Reader
Returns:
the name of this AlienClassOEMReader
See Also:
AlienClass1Reader.setReaderName(String)

getReaderType

public java.lang.String getReaderType()
Returns the reader type. This string contains a textual type for the reader, the reader model#, and bit describing how many antennas, the EPC tag classes it readers, the frequency, and interface type.

Overrides:
getReaderType in class AlienClass1Reader
Returns:
the type of this AlienClassOEMReader

getReaderVersion

public java.lang.String getReaderVersion()
                                  throws AlienReaderException
Returns the firmware version of this reader.

Overrides:
getReaderVersion in class AlienClass1Reader
Returns:
a String representation of this reader's firmware version
Throws:
AlienReaderException - if reader communication fails

reboot

public void reboot()
            throws AlienReaderException
Causes the reader module to reboot. This operation can take up to 50 milliseconds.

Throws:
AlienReaderException - if reader communication fails

setActiveAntenna

public void setActiveAntenna(int antennaNumber)
Sets the active antenna to the specified value. Antennas are numbered 0 through N, where N is hardware dependent.

Parameters:
antennaNumber - the number of the antenna to use
Throws:
AlienReaderException - if reader communication fails
See Also:
getActiveAntenna(), setAntennaSequence(String), getAntennaSequence()

getActiveAntenna

public int getActiveAntenna()
                     throws AlienReaderException
Returns the number of the active antenna. The result is between 0 and N, where N is the hardware-dependant maximum antenna number.

Returns:
the number of the active antenna
Throws:
AlienReaderException - if reader communication fails
See Also:
setActiveAntenna(int), setAntennaSequence(String), getAntennaSequence()

setProgAntenna

public void setProgAntenna(int antennaNumber)
                    throws AlienReaderException
Sets the programming antenna to the specified value. Antennas are numbered 0 through N, where N is hardware dependent.

Overrides:
setProgAntenna in class AlienClass1Reader
Parameters:
antennaNumber - the number of the antenna to program on
Throws:
AlienReaderException - if reader communication fails
See Also:
getProgAntenna()

getProgAntenna

public int getProgAntenna()
                   throws AlienReaderException
Returns the number of the programming antenna. The result is between 0 and N, where N is the hardware-dependant maximum antenna number.

Overrides:
getProgAntenna in class AlienClass1Reader
Returns:
the number of the programming antenna
Throws:
AlienReaderException - if reader communication fails
See Also:
setProgAntenna(int)

setAntennaSequence

public void setAntennaSequence(java.lang.String sequenceString)
                        throws AlienReaderException
Sets the sequence of antenna ports, using a comma-separated String of integer values, that is used by the reader when responding to an Inventory command. The Antenna Sequence can be up to eight values long, and each value is examined sequentially during the Inventory command. If the antenna value indexes a valid antenna number between 0 and N (N being hardware dependant) the inventory is executed from this antenna port.

It should be noted that any array element can be set to any valid antenna number, thus allowing the sequence of antennas to be executed in any order, and the same antenna can be used multiple times in response to one Inventory command.

Overrides:
setAntennaSequence in class AlienClass1Reader
Parameters:
sequenceString - a comma-separated list of antenna ports
Throws:
AlienReaderException - if reader communication fails
See Also:
getAntennaSequence()

getAntennaSequence

public java.lang.String getAntennaSequence()
                                    throws AlienReaderException
Returns the Antenna Sequence, as a comma-separated String of hex values.

Overrides:
getAntennaSequence in class AlienClass1Reader
Returns:
a comma-separated String of antenna values
Throws:
AlienReaderException - if reader communication fails
See Also:
setAntennaSequence(String)

verifyTag

public java.lang.String verifyTag()
                           throws AlienReaderException
Interrogates the state of a tag that may or may not be readable by the Acquire commands. A Verify command will return the complete tag memory WITHOUT validating the tag ID against the checksum. The tag memory returned by the Verify command is not guaranteed to be correct; it may or may not be valid.

A Verify command cannot sort multiple tags; it should only be used on one tag at a time.

Overrides:
verifyTag in class AlienClass1Reader
Returns:
the complete, unverified tag data
Throws:
AlienReaderException - if reader communication fails

programTag

public void programTag(java.lang.String tagID)
                throws AlienReaderException
Writes data to the tag ID space, using default loop-control parameters. This command takes a string with the ID data and otherwise uses default values for the number of verify, erase, and program attempts. The tagID string may be in the format "X X X X X X X X", "XX XX XX XX", "XXXX XXXX", or "XXXXXXXX", where "X" is one byte.

The reader automatically generates the CRC for the supplied tag ID data and programs it into the first two bytes of ID space. This command does not lock the tag or program a lock code.

Overrides:
programTag in class AlienClass1Reader
Parameters:
tagID - the string representation of the 8- or 12-byte tag ID to program
Throws:
AlienReaderException - if reader communication fails
See Also:
AlienClass1Reader.programEPC(String), AlienClass1Reader.programEPC()

eraseTag

public void eraseTag()
              throws AlienReaderException
Erases the data in the tag's ID space, using default loop-control parameters. A locked or unprogrammed tag cannot be erased.

Overrides:
eraseTag in class AlienClass1Reader
Throws:
AlienReaderException - if reader communication fails

killTag

public void killTag(java.lang.String tagIDAndPassCode)
             throws AlienReaderException
Kills a tag by erasing the data in a locked tag's ID space, using default loop-control parameters. This command takes a string representing the tagID (including PassCode) of the tag to kill. The tagID+PassCode string may be in the format "X X X X X X X X X", "XX XX XX XX X", "XXXX XXXX X", or "XXXXXXXXX", where "X" is one byte. An unlocked or unprogrammed tag cannot be killed.

Overrides:
killTag in class AlienClass1Reader
Parameters:
tagIDAndPassCode - a string representing the tag's ID, followed by its PassCode
Throws:
AlienReaderException - if reader communication fails

lockTag

public void lockTag(java.lang.String passCode)
             throws AlienReaderException
Locks a Tag, using default loop-control parameters and tagID length. This command takes a string argument specifying the PassCode that can be used later to kill the tag. An unprogrammed tag cannot be locked.

Overrides:
lockTag in class AlienClass1Reader
Parameters:
passCode - a String representing the byte value used to lock and kill the tag
Throws:
AlienReaderException - if reader communication fails
See Also:
AlienClass1Reader.lockEPC(String), AlienClass1Reader.lockEPC()

run

public void run()
Run the automode function for this reader. Autonomous mode is turned on with the setAutoMode() method, and simply acquires tags over and over again, storing tag data in the tagTable. The TagList can be retrived while this reader is in autonomous mode by calling and of the getTag or getTagList methods.

Specified by:
run in interface java.lang.Runnable

parseTagListString

public void parseTagListString(java.lang.String tagListString)

getTimer

public java.lang.String getTimer()
Returns the Timer text for the most recent acquire. The timer data is calculated based on data recorded within the getTagList(n) method.

Returns:
the timer data

readerCommandCLI

public java.lang.String readerCommandCLI()
Enables raw RQL-based command sequences to be sent to the reader.

Returns:
the RQL exchange with the reader

sendString

public void sendString(java.lang.String command)
                throws AlienReaderConnectionException
Intercepts a command string intended for the RQL-based reader, and attempts to handle the command using methods from this class. A response is formulated from the reader's reply and stored in String format in a local field, which is then returned by receiveString() when it is called.

This gives the illusion that the reader is accepting and returning ASCII-based communications.

Furthermore, if the command string is not preceeded by a \1 character (which doReaderCommand() adds automatically, then it is assumed that the command is coming from a command line interface, and appropriate "Alien>" prompts are attached to the response string.

Overrides:
sendString in class AbstractReader
Parameters:
command - the text string to send
Throws:
AlienReaderConnectionException - if communication fails
See Also:
receiveString(boolean)

receiveString

public java.lang.String receiveString(boolean blockForInput)
Returns the response string prepared by the sendString() method, as it if came from a reader sporting an ASCII-based interface. The blockForInput parameter is ignored in this implementation.

Overrides:
receiveString in class AbstractReader
Parameters:
blockForInput - ignored
Returns:
the text string prepared after performing the reader command
See Also:
sendString(String)

sendBytes

public void sendBytes(byte[] bytes)
               throws AlienReaderConnectionException
Sends an arbitrary sequence of bytes to the reader. No attempt is made to validate the sequence, or read and return the reader's response.

Parameters:
bytes - the array of bytes to send to the reader
Throws:
AlienReaderConnectionException - if reader communication fails
See Also:
receiveBytes()

receiveBytes

public byte[] receiveBytes()
                    throws AlienReaderConnectionException,
                           AlienReaderTimeoutException
Receives and entire response message from the reader. If the data received from the reader is not consistent with the DLE-packetization rules, the data is ignored (likely resulting in a timeout exception). This method is inventory-aware, meaning that it is aware that inventory responses comprise more than one complete DLE-packetized message. The returned bytes will be for the entire inventory response.

Returns:
the reader's response the the last command send
Throws:
AlienReaderConnectionException - if reader communication fails
AlienReaderTimeoutException - if a timely response is not received
See Also:
sendBytes(byte[])

toString

public java.lang.String toString()
Returns a String representation of this reader object (it's ReaderType).

Overrides:
toString in class AlienClass1Reader
Returns:
the reader's type