|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alien.enterpriseRFID.reader.AbstractReader
com.alien.enterpriseRFID.reader.AlienClass1Reader
com.alien.enterpriseRFID.reader.AlienClassBPTReader
This class allows the system to interact with an Alien Class BPT (Battery Powered Tag) Reader. The Reader classes are the primary classes for communicating with a reader either over the network or serial port.
The AlienClassBPTReader class extends the AlienClass1Reader class, since BPT readers have the same functionality as the passive readers, with the addition of memory, sensor, and logging functions:
DiscoveryItem
object, which is
acquired through one of the reader discovery mechanisms
(NetworkDiscoveryListenerService
and SerialDiscoveryListenerService
).
However if the location (either serial port name or network address) is
known, a Reader object can be instantiated directly without the need of any
discovery classes.
The discovery commands are the same regardless of the reader type. A discovery item supports one method to turn a discovery object into an Alien reader object:
public AlienClass1Reader getReader() throws Exception
If the reader is actually a 2450Mhz Battery Powered Reader, the reader object that is instanced will be of the type AlienClassBPTReader, and can be cast into this type, i.e.,
AlienClass1Reader class1Reader = discoveryItem.getReader(); if (class1Reader instanceof AlienClassBPTReader) { AlienClassBPTReader classBPTReader = (AlienClassBPTReader)class1Reader; }
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 Nanoscanner Developers Guide.
Field Summary | |
static int |
DEFAULT_TIMEOUT
Specifies the default communication timeout value. |
static short |
NO_READING
Indicates the lack of valid memory data in the communication from the tag. |
static short |
NO_WRITING
Indicates the lack of valid memory data in the communication from the tag. |
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, TIMEOUTMODE_CHARACTER, TIMEOUTMODE_COMMAND |
Constructor Summary | |
AlienClassBPTReader()
Constructs a new AlienClassBPTReader object. |
Method Summary | |
void |
clearMemory(java.lang.String tagID)
Completely erases the memory of a specified tag. |
byte[] |
getLoggingInterval(java.lang.String tagID)
Returns the periodicity at which the tag logs sensor data to tag memory, with timing values returned as a triple byte array. |
short[] |
getMemory(java.lang.String tagID,
int lengthIndex,
int startIndex)
Returns a chunk of tag memory from the specified tag. |
int |
getMemoryPacketSize()
Returns the number of bytes to use in each memory related transmission packet to and from the tag. |
int |
getSensorValue(java.lang.String tagID)
Returns the sensor value of the tag's onboard sensor. |
Tag |
getTagID(java.lang.String tagID)
Returns the ID of a unique tag specified by the mask commands. |
java.lang.String |
getTagInfo(java.lang.String tagID)
Returns information about a single tag being masked. |
boolean |
isLogging(java.lang.String tagID)
Returns the status of Logging Mode for the specified tag. |
void |
setLogging(java.lang.String tagID,
boolean isLogging)
Enables or disables logging for a specified tag. |
void |
setLoggingInterval(java.lang.String tagID,
byte[] byteArray)
Sets the periodicity at which the tag logs sensor data to tag memory, with timing values specified as a triple byte array. |
void |
setLoggingInterval(java.lang.String tagID,
int hours,
int mins,
int secs)
Sets the periodicity at which the tag logs sensor data to tag memory, with timing values specified as individual integers. |
boolean |
setMemory(java.lang.String tagID,
int startIndex,
byte[] byteArray)
Stores a series of bytes into tag memory. |
void |
setMemoryPacketSize(int memoryPacketSize)
Specifies the number of bytes to use in each memory related transmission packet to and from the tag. |
java.lang.String |
toString()
Returns a String representation of this reader object (it's ReaderType). |
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, receiveString, sendString, setAddress, setConnection, setConnection, setDebugLevel, 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 |
public static final short NO_READING
NO_WRITING
,
Constant Field Valuespublic static final short NO_WRITING
NO_READING
,
Constant Field Valuespublic static final int DEFAULT_TIMEOUT
Constructor Detail |
public AlienClassBPTReader()
Method Detail |
public Tag getTagID(java.lang.String tagID) throws java.lang.Exception
tagID
is null the Reader mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get the value for (or null to use the currently masked tag)
Tag
object matching the specified tagID
java.lang.Exception
- if reader communication failspublic java.lang.String getTagInfo(java.lang.String tagID) throws AlienReaderException
Note: Please refer to the Nanoscanner Tag Guide for detailed descriptions of tag types.
tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get the TagInfo for (or null to use the currently masked tag)
AlienReaderException
- if reader communication failspublic int getSensorValue(java.lang.String tagID) throws AlienReaderException
Typically the tag has no knowledge of the type of sensor attached to it. Consequently this command simply returns the raw number as returned by the sensor. No attempt is made to process this number into a humanly understandable form.
Note: Please refer to the Nanoscanner Tag Guide for detailed descriptions of to format of raw sensor values. Because there are many different types of sensors attached to the Nanoscanner tags, the format of the raw sensor values may change due to the type of data being acquired.
tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get the SensorValue for (or null to use the currently masked tag)
AlienReaderException
- if reader communication fails
AlienReaderCommandErrorException
- if the reader does not return a sensor value
AlienReaderNoTagException
- if there is no tag in the fieldpublic boolean isLogging(java.lang.String tagID) throws AlienReaderException
true
if
the tag is set to log sensor data.
The reader will query and return the logging mode of the tagID specified, or the currently-masked tag.
tagID
is null the Reader mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get LoggingMode status from (or null to use the currently masked tag)
true
if the tag is currently logging sensor data, false
otherwise
AlienReaderException
- if reader communication fails
AlienReaderNoTagException
- if there is no tag in the fieldsetLogging(String, boolean)
public void setLogging(java.lang.String tagID, boolean isLogging) throws AlienReaderException
The automatic, time based logging of sensor data to a tag memory is controlled by setting the logging mode of the tag.
false
) - turns off all automatic loggingtrue
) - turns on the automatic logging as defined by the logging
interval command. Turning on the logging mode like this will not
erase the tag's memory; it will simply cause logged data to be
appended to the current memory store. (Use the clear memory
command to erase the memory before logging).tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to set LoggingMode for (or null to use the currently masked tag)isLogging
- true
to turn on logging, false
to stop it.
AlienReaderException
- if reader communication fails
AlienReaderNoTagException
- if there is no tag in the fieldisLogging(java.lang.String)
public byte[] getLoggingInterval(java.lang.String tagID) throws AlienReaderException
tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get LoggingInterval values from (or null to use the currently masked tag)
AlienReaderException
- if reader communication fails
AlienReaderNoTagException
- if there is no tag in the field
AlienReaderCommandErrorException
- if the logInterval is invalidsetLoggingInterval(String, byte[])
,
setLoggingInterval(String, int, int, int)
public void setLoggingInterval(java.lang.String tagID, byte[] byteArray) throws AlienReaderException
Note: The minimum allowable logging interval is 1 minute.
Note: The tag will sleep while not in use, and then will wake up to take a sensor reading and then sleep again. This mode of operation ensures a long battery life.
The logging interval command specifies the interval with three values, of the form hh:mm:ss. These three values are passed into this method as a triple byte array.
The reader will set the loggingInterval for the tagID specified, or the currently-masked tag.
tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to set LoggingInterval values (or null to use the currently masked tag)byteArray
- byte0 = hours, byte1=mins, byte2=secs
AlienReaderException
- if reader communication fails
AlienReaderNoTagException
- if there is no tag in the fieldgetLoggingInterval(String)
public void setLoggingInterval(java.lang.String tagID, int hours, int mins, int secs) throws AlienReaderException
Note: The minimum allowable logging interval is 1 minute.
Note: The tag will sleep while not in use, and then will wake up to take a sensor reading and then sleep again. This mode of operation ensures a long battery life.
The logging interval command takes three parameters, of the form hh:mm:ss.
These three values are passed into this method as the integers hours
,
mins
, and secs
.
The reader will set the loggingInterval for the tagID specified, or the currently-masked tag.
tagID
is null the Reader Mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to set LoggingInterval values (or null to use the currently masked tag)hours
- the number of hours in the intervalmins
- the number of minutes in the intervalsecs
- the number of seconds in the interval
AlienReaderException
- if reader communication fails
AlienReaderNoTagException
- if there is no tag in the fieldgetLoggingInterval(String)
public short[] getMemory(java.lang.String tagID, int lengthIndex, int startIndex) throws AlienReaderException
This method returns an array of shorts. Each item in the array represents a
single byte of memory (value 0-255), or is set to NO_READING
if no
reading could be obtained. (This is equivalent to the command line returning
a '**' for the value. This is usually due to temporary interference, and
repeating the call will often result in readings being returned).
getMemory
takes three parameters:
NO_READING
instead of expected
data – this indicates that the request for a particular block of memory
failed (usually RF communications failure). The data can usually be extracted
by repeating the command after repositioning the tag.
The reader will set the get memory from the tagID specified, or the currently-masked tag.
tagID
is null the Reader mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to get memory from (or null to use the currently masked tag)lengthIndex
- the number of bytes to read (up to max of 4096 bytes per call)startIndex
- the starting address of memory to read
AlienReaderException
- if reader communication failssetMemory(String, int, byte[])
,
getMemoryPacketSize()
,
setMemoryPacketSize(int)
,
clearMemory(String)
public boolean setMemory(java.lang.String tagID, int startIndex, byte[] byteArray)
setMemory
takes three parameters:
The reader will set the get memory from the tagID specified, or the currently-masked tag.
tagID
is null the Reader mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to set memory in (or null to use the currently masked tag)startIndex
- the start address of the memory location to write tobyteArray
- the array of hex bytes to write to memory
true
if all data was written, false
otherwisegetMemory(String, int, int)
,
getMemoryPacketSize()
,
setMemoryPacketSize(int)
,
clearMemory(String)
public void clearMemory(java.lang.String tagID) throws AlienReaderException
tagID
is null the Reader mask will not be changed.tagID
is not null, the Reader mask will be set to the required value.tagID
can be in the format XX XX XX XX or XXXX XXXX or XXXXXXXX.
tagID
- the ID of the tag to clear memory for (or null to use the currently masked tag(s))
AlienReaderException
- if reader communication failspublic int getMemoryPacketSize() throws AlienReaderException
The default setting for this value is 16 bytes. The allowable range is 1 to 16 bytes.
AlienReaderException
- if reader communication failssetMemoryPacketSize(int)
public void setMemoryPacketSize(int memoryPacketSize) throws AlienReaderException
The default setting for this value is 16 bytes. The allowable range is 1 to 16 bytes.
memoryPacketSize
- the number of bytes to transmit when dealing with tag memory
AlienReaderException
- if reader communication failsgetMemoryPacketSize()
public java.lang.String toString()
toString
in class AlienClass1Reader
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |