Package com.metratec.lib.rfidreader
Class MetratecReaderGen2<T extends RfidTag>
- java.lang.Object
-
- com.metratec.lib.rfidreader.MetratecReader<T>
-
- com.metratec.lib.rfidreader.MetratecReaderGen2<T>
-
- Type Parameters:
T
- rfid tag instance
- Direct Known Subclasses:
UHFReaderGen2
public abstract class MetratecReaderGen2<T extends RfidTag> extends MetratecReader<T>
- Author:
- Matthias Neumann (neumann@metratec.com)
-
-
Field Summary
-
Fields inherited from class com.metratec.lib.rfidreader.MetratecReader
STATE_CONFIGURING, STATE_CONNECTING, STATE_RUNNING, STATE_STOPPED, STATE_WAITING_FOR_RECONNECT
-
-
Constructor Summary
Constructors Constructor Description MetratecReaderGen2(java.lang.String identifier, ICommConnection connection)
Construct a new StandardReader instance with the specified connection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAntennas()
Check the antennavoid
enableInputEvents(boolean enable)
enable or disable the input eventsint
getAntennaPort()
java.lang.String
getFirmwareRevision()
get the Firmware Revisionjava.lang.String
getHardwareRevision()
Gets the hardware revisionboolean
getInput(int pin)
Reads the current state of an input pinjava.util.List<T>
getInventory()
Looks for all tags in range of the reader and get all tags backjava.util.List<T>
getInventoryMultiplex()
Iterate over the configured multiplex antennas and get all tags backjava.util.List<T>
getInventoryMultiplex(boolean throwAntennaErrors)
Iterate over the configured multiplex antennas and get all tags backjava.util.List<java.lang.Integer>
getMultiplexAntennas()
Returns the number of antennas to be switched throughboolean
getOutput(int pin)
Gets the current output pin stateReaderType
getReaderType()
Parse the Firmware Name and return theReaderType
java.lang.String[]
getRevision()
Gets the firmware revisionjava.lang.String
getSerialNumber()
Gets the serial numbervoid
ping()
test if the reader is alivevoid
reset()
Reset the readervoid
setAntennaPort(int port)
Set the antenna port.void
setMultiplexAntennas(int antennas)
In case you want to automatically switch between multiple antennas (e.g.void
setMultiplexAntennas(java.util.List<java.lang.Integer> sequence)
In case you want to automatically switch between multiple antennas (e.g.void
setOutput(int pin, boolean state)
Sets the state of an output pinvoid
standby()
Sets the reader in a power saving modevoid
startInventory(long tagLostTime)
Looks for all tags in range of the reader and call events with founded tags.void
startInventoryReport(long tagLostTime)
Looks for all tags in range of the reader and call events with founded tags.void
stop()
stop the readerjava.util.List<T>
stopInventory()
Stops the current continues inventoryjava.util.List<T>
stopInventoryReport()
Stops the current continues inventoryvoid
wakeUp()
Ends the power saving mode-
Methods inherited from class com.metratec.lib.rfidreader.MetratecReader
connect, connect, disconnect, getIdentifier, getInputDebounceTime, getReceiveTimeout, isConnected, setIdentifier, setInputDebounceTime, setMaxReconnectWaitTime, setMinReconnectWaitTime, setReaderEventListener, setReceiveTimeout, setTagEventListener, start, start, startAndWait, startAndWait, startInventory
-
-
-
-
Constructor Detail
-
MetratecReaderGen2
public MetratecReaderGen2(java.lang.String identifier, ICommConnection connection)
Construct a new StandardReader instance with the specified connection- Parameters:
identifier
- reader identifierconnection
- connection
-
-
Method Detail
-
getInventory
public java.util.List<T> getInventory() throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
Looks for all tags in range of the reader and get all tags back- Specified by:
getInventory
in classMetratecReader<T extends RfidTag>
- Returns:
- List with the founded tags
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
getInventoryMultiplex
public java.util.List<T> getInventoryMultiplex() throws RFIDReaderException, CommConnectionException
Iterate over the configured multiplex antennas and get all tags back- Returns:
- List with the founded tags
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getInventoryMultiplex
public java.util.List<T> getInventoryMultiplex(boolean throwAntennaErrors) throws RFIDReaderException, CommConnectionException
Iterate over the configured multiplex antennas and get all tags back- Parameters:
throwAntennaErrors
- if true, the method throw an error if one or more antennas signaling an error- Returns:
- List with the founded tags
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
reset
public void reset() throws RFIDReaderException, CommConnectionException
Reset the reader- Throws:
RFIDReaderException
- if a error occurs, seeRFIDReaderException.getErrorCode()
andThrowable.getMessage()
for more detailsCommConnectionException
- if a error occurs, seeCommConnectionException.getErrorCode()
andThrowable.getMessage()
for more details
-
enableInputEvents
public void enableInputEvents(boolean enable) throws CommConnectionException, RFIDReaderException
enable or disable the input events- Parameters:
enable
- set to true if the input events should be activated- Throws:
CommConnectionException
- if an error occursRFIDReaderException
- if error occurs
-
checkAntennas
public void checkAntennas() throws RFIDReaderException, CommConnectionException
Check the antenna- Throws:
RFIDReaderException
- if an antenna error occursCommConnectionException
- if an communication error occurs
-
stop
public void stop() throws CommConnectionException
Description copied from class:MetratecReader
stop the reader- Overrides:
stop
in classMetratecReader<T extends RfidTag>
- Throws:
CommConnectionException
- possible ICommConnection Error codes:- UNHANDLED_ERROR
-
standby
public void standby() throws RFIDReaderException, CommConnectionException
Sets the reader in a power saving mode- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
wakeUp
public void wakeUp() throws RFIDReaderException, CommConnectionException
Ends the power saving mode- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getRevision
public java.lang.String[] getRevision() throws RFIDReaderException, CommConnectionException
Gets the firmware revision- Returns:
- the device type, hardware architecture and firmware revision of the reader
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getReaderType
public ReaderType getReaderType() throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
Parse the Firmware Name and return theReaderType
- Specified by:
getReaderType
in classMetratecReader<T extends RfidTag>
- Returns:
- the
ReaderType
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
getFirmwareRevision
public java.lang.String getFirmwareRevision() throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
get the Firmware Revision- Specified by:
getFirmwareRevision
in classMetratecReader<T extends RfidTag>
- Returns:
- the Firmware Revision as String
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
getSerialNumber
public java.lang.String getSerialNumber() throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
Gets the serial number- Specified by:
getSerialNumber
in classMetratecReader<T extends RfidTag>
- Returns:
- the serial number of the reader. The serial number is an ASCII string of 16 characters.
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
getHardwareRevision
public java.lang.String getHardwareRevision() throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
Gets the hardware revision- Specified by:
getHardwareRevision
in classMetratecReader<T extends RfidTag>
- Returns:
- the hardware revision of the reader which corresponds to the PCB layout version printed on the board. The number is an ASCII string of four characters.
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
getInput
public boolean getInput(int pin) throws RFIDReaderException, CommConnectionException
Description copied from class:MetratecReader
Reads the current state of an input pin- Specified by:
getInput
in classMetratecReader<T extends RfidTag>
- Parameters:
pin
- input pin to read- Returns:
- true if input is high, false if input is low
- Throws:
RFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)CommConnectionException
- if an communication exception occurs
-
setOutput
public void setOutput(int pin, boolean state) throws RFIDReaderException, CommConnectionException
Sets the state of an output pin- Specified by:
setOutput
in classMetratecReader<T extends RfidTag>
- Parameters:
pin
- output pinstate
- true for high state, false for low state- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getOutput
public boolean getOutput(int pin) throws RFIDReaderException, CommConnectionException
Gets the current output pin state- Parameters:
pin
- output pin- Returns:
- the current output pin state
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range,
-
ping
public void ping() throws CommConnectionException
test if the reader is alive- Throws:
CommConnectionException
- possible ICommConnection Errorcodes:- NOT_INITIALISE
- CONNECTION_LOST
- RECV_TIMEOUT
- UNHANDLED_ERROR
-
setAntennaPort
public void setAntennaPort(int port) throws CommConnectionException, RFIDReaderException
Description copied from class:MetratecReader
Set the antenna port.- Specified by:
setAntennaPort
in classMetratecReader<T extends RfidTag>
- Parameters:
port
- antenna port for the connected multiplexer [0..15]- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getAntennaPort
public int getAntennaPort() throws CommConnectionException, RFIDReaderException
- Returns:
- antenna port
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
setMultiplexAntennas
public void setMultiplexAntennas(int antennas) throws CommConnectionException, RFIDReaderException
Description copied from class:MetratecReader
In case you want to automatically switch between multiple antennas (e.g. trying to find all tags in a search area that can only be searched using multiple antennas) you can use this automatic switching mode.
Switching always starts with the lowest antenna port (0). Switching to the next antenna port oc- curs automatically with the start of every tag manipulation command. No pin state is changed until the first tag manipulation command.- Specified by:
setMultiplexAntennas
in classMetratecReader<T extends RfidTag>
- Parameters:
antennas
- number of antennas [1..16], 0 for disable; Please note that for this parameter the number given is the counted number of participating antennas, not the antenna port numbers, thus stating a number "X" would stand for "X antennas participating".- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
setMultiplexAntennas
public void setMultiplexAntennas(java.util.List<java.lang.Integer> sequence) throws CommConnectionException, RFIDReaderException
In case you want to automatically switch between multiple antennas (e.g. trying to find all tags in a search area that can only be searched using multiple antennas) you can set the antenna switch sequence.- Parameters:
sequence
- The antenna sequence. E.g. [1,3,2,4]- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
getMultiplexAntennas
public java.util.List<java.lang.Integer> getMultiplexAntennas() throws CommConnectionException, RFIDReaderException
Returns the number of antennas to be switched through- Returns:
- Number of antennas to be switched through
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
startInventory
public void startInventory(long tagLostTime) throws CommConnectionException, RFIDReaderException
Description copied from class:MetratecReader
Looks for all tags in range of the reader and call events with founded tags.- Specified by:
startInventory
in classMetratecReader<T extends RfidTag>
- Parameters:
tagLostTime
- timeout in milliseconds for tag lost event- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
stopInventory
public java.util.List<T> stopInventory() throws CommConnectionException, RFIDReaderException
Description copied from class:MetratecReader
Stops the current continues inventory- Specified by:
stopInventory
in classMetratecReader<T extends RfidTag>
- Returns:
- the current inventory
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs
-
startInventoryReport
public void startInventoryReport(long tagLostTime) throws CommConnectionException, RFIDReaderException
Looks for all tags in range of the reader and call events with founded tags.- Parameters:
tagLostTime
- timeout in milliseconds for tag lost event- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs (e.g. CRC error, value out of range, ..)
-
stopInventoryReport
public java.util.List<T> stopInventoryReport() throws CommConnectionException, RFIDReaderException
Stops the current continues inventory- Returns:
- the current inventory
- Throws:
CommConnectionException
- if an communication exception occursRFIDReaderException
- if an protocol exception occurs
-
-