## com.thingmagic
Class Reader

    java.lang.Object
      com.thingmagic.Reader

Direct Known Subclasses:
  LLRPReader, RqlReader, SerialReader

    public abstract class Reader

extends java.lang.Object

The Reader class encapsulates a connection to a ThingMagic RFID reader device and provides an interface to perform RFID operations such as reading tags and writing tag IDs. Reads can be done on demand, with the `read(long)` method, or continuously in the background with the `startReading()` method. Background reads notify a listener objects of tags that are read. Methods which communicate with the reader can throw ReaderException if the communication breaks down. Other reasons for throwing ReaderException are documented in the individual methods. Operations which take an argument for a tag to operate on may optionally be passed a null argument. This lets the reader choose what tag to use, but may not work if multiple tags are present. This use is recommended only when exactly one tag is known to be in range.

Nested Class Summary
`static class` `Reader.GpioPin`
`static class` `Reader.LicenseOperation` Class for License key operation
`static class` `Reader.LicenseOption` Enum values for License key operations
`static class` `Reader.Region` RFID regulatory regions

Field Summary
`boolean` `hasContinuousReadStarted`
`static TransportListener` `simpleTransportListener`

Method Summary
`void` `addReadAuthenticationListener(ReadAuthenticationListener listener)` Register a listener to be notified of asynchronous RFID authentication exceptions.
`void` `addReadExceptionListener(ReadExceptionListener listener)` Register a listener to be notified of asynchronous RFID read exceptions.
`void` `addReadListener(ReadListener listener)` Register a listener to be notified of asynchronous RFID read events.
`abstract void` `addStatsListener(StatsListener listener)` Register a listener to be notified about the read stats
`abstract void` `addStatusListener(StatusListener listener)` Register a listener to be notified about the read statistics
`abstract void` `addTransportListener(TransportListener listener)` Register a listener to be notified of message packets.
`abstract void` `connect()` Open the communication channel and initialize the session with the reader.
`static Reader` `create(java.lang.String uriString)` Return an instance of a Reader class that is associated with a RFID reader on a particular communication channel.
`abstract void` `destroy()` Shuts down the connection with the reader device.
`abstract java.lang.Object` `executeTagOp(TagOp tagOP, TagFilter target)` execute a TagOp
`abstract void` `firmwareLoad(java.io.InputStream firmware)` Load a new firmware image into the device's nonvolatile memory.
`abstract void` `firmwareLoad(java.io.InputStream firmware, FirmwareLoadOptions loadOptions)` Load a new firmware image into the device's nonvolatile memory.
`abstract Reader.GpioPin[]` `gpiGet()` Get the state of all of the reader's GPI pins.
`abstract void` `gpoSet(Reader.GpioPin[] state)` Set the state of some GPO pins.
`abstract void` `killTag(TagFilter target, TagAuthentication auth)` Kill a tag.
`void` `loadConfig(java.lang.String filePath)` Loads the reader configuration parameters from file and applies to module
`abstract void` `lockTag(TagFilter target, TagLockAction lock)` Perform a lock or unlock operation on a tag.
`java.lang.Object` `paramGet(java.lang.String key)` Get the value of a Reader parameter.
`java.lang.String[]` `paramList()` Get a list of the parameters available
`void` `paramSet(java.lang.String key, java.lang.Object value)` Set the value of a Reader parameter.
`abstract TagReadData[]` `read(long duration)` Read RFID tags for a fixed duration.
`abstract byte[]` `readTagMemBytes(TagFilter target, int bank, int address, int count)` Read data from the memory bank of a tag.
`abstract short[]` `readTagMemWords(TagFilter target, int bank, int address, int count)` Read data from the memory bank of a tag.
`abstract void` `reboot()` reboots the reader device.
`abstract void` `receiveAutonomousReading()`
`void` `removeReadAuthenticationListener(ReadAuthenticationListener listener)` Remove a listener from the list of listeners notified of asynchronous RFID authentication events.
`void` `removeReadExceptionListener(ReadExceptionListener listener)` Remove a listener from the list of listeners notified of asynchronous RFID read events.
`void` `removeReadListener(ReadListener listener)` Remove an listener from the list of listeners notified of asynchronous RFID read events.
`abstract void` `removeStatsListener(StatsListener listener)` remove a listener from the list of listeners to be notified of read stats
`abstract void` `removeStatusListener(StatusListener listener)` remove a listener from the list of listeners to be notified of read statistics
`abstract void` `removeTransportListener(TransportListener listener)` Remove a listener from the list of listeners to be notified of message packets.
`void` `saveConfig(java.lang.String filePath)` Saves the current reader configuration parameters and its values to a file
`static void` `setSerialTransport(java.lang.String scheme, ReaderFactory factory)`
`abstract void` `startReading()` Start reading RFID tags in the background.
`abstract boolean` `stopReading()` Stop reading RFID tags in the background.
`abstract void` `writeTag(TagFilter target, TagData newID)` Write a new ID to a tag.
`abstract void` `writeTagMemBytes(TagFilter target, int bank, int address, byte[] data)` Write data to the memory bank of a tag.
`abstract void` `writeTagMemWords(TagFilter target, int bank, int address, short[] data)` Write data to the memory bank of a tag.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### simpleTransportListener

    public static TransportListener simpleTransportListener

### hasContinuousReadStarted

    public boolean hasContinuousReadStarted

Method Detail

### create

    public static Reader create(java.lang.String uriString)
                         throws ReaderException

  Return an instance of a Reader class that is associated with a RFID reader on a particular communication channel. The communication channel is not established until the connect() method is called. Note that some readers may need parameters (such as the regulatory region) set before the connect will succeed.

  Parameters:
    `uriString` - an identifier for the reader to connect to, with a URI syntax. The scheme can be `eapi` for the embedded module protocol, `rql` for the request query language, or `tmr` to guess. The remainder of the URI identifies the stream that the protocol will be spoken over, either a local host serial port device or a TCP network port. Examples include:`
    - "eapi:///dev/ttyUSB0"
    - "eapi:///com1"
    - "rql://reader.example.com/"
    - "rql://proxy.example.com:2500/"
    - "tmr:///dev/ttyS0"
    - "tmr://192.168.1.101/"
    `
  Returns:
    the `Reader` object connected to the specified device
  Throws:
    `ReaderException` - if reader initialization failed

### receiveAutonomousReading

    public abstract void receiveAutonomousReading()

### setSerialTransport

    public static void setSerialTransport(java.lang.String scheme,
                                          ReaderFactory factory)
                                   throws ReaderException

  Throws:
    `ReaderException`

### connect

    public abstract void connect()
                          throws ReaderException

  Open the communication channel and initialize the session with the reader.

  Throws:
    `ReaderException`

### loadConfig

    public void loadConfig(java.lang.String filePath)
                    throws ReaderException

  Loads the reader configuration parameters from file and applies to module

  Parameters:
    `filePath` -
  Throws:
    `ReaderException`

### saveConfig

    public void saveConfig(java.lang.String filePath)
                    throws ReaderException

  Saves the current reader configuration parameters and its values to a file

  Parameters:
    `filePath` -
  Throws:
    `ReaderException`

### destroy

    public abstract void destroy()

  Shuts down the connection with the reader device.

### reboot

    public abstract void reboot()
                         throws ReaderException

  reboots the reader device.

  Throws:
    `ReaderException`

### read

    public abstract TagReadData[] read(long duration)
                                throws ReaderException

  Read RFID tags for a fixed duration.

  Parameters:
    `duration` - the time to spend reading tags, in milliseconds
  Returns:
    the tags read
  Throws:
    `ReaderException`
  See Also:
    `TagReadData`

### readTagMemBytes

    public abstract byte[] readTagMemBytes(TagFilter target,
                                           int bank,
                                           int address,
                                           int count)
                                    throws ReaderException

  Read data from the memory bank of a tag.

  Parameters:
    `target` - the tag to read from, or null
    `bank` - the tag memory bank to read from
    `address` - the byte address to start reading at
    `count` - the number of bytes to read
  Returns:
    the bytes read
  Throws:
    `ReaderException`

### readTagMemWords

    public abstract short[] readTagMemWords(TagFilter target,
                                            int bank,
                                            int address,
                                            int count)
                                     throws ReaderException

  Read data from the memory bank of a tag.

  Parameters:
    `target` - the tag to read from, or null
    `bank` - the tag memory bank to read from
    `address` - the word address to start reading from
    `count` - the number of words to read
  Returns:
    the words read
  Throws:
    `ReaderException`

### writeTagMemBytes

    public abstract void writeTagMemBytes(TagFilter target,
                                          int bank,
                                          int address,
                                          byte[] data)
                                   throws ReaderException

  Write data to the memory bank of a tag.

  Parameters:
    `target` - the tag to write to, or null
    `bank` - the tag memory bank to write to
    `address` - the byte address to start writing to
    `data` - the bytes to write
  Throws:
    `ReaderException`

### writeTagMemWords

    public abstract void writeTagMemWords(TagFilter target,
                                          int bank,
                                          int address,
                                          short[] data)
                                   throws ReaderException

  Write data to the memory bank of a tag.

  Parameters:
    `target` - the tag to read from, or null
    `bank` - the tag memory bank to write to
    `address` - the word address to start writing to
    `data` - the words to write
  Throws:
    `ReaderException`

### writeTag

    public abstract void writeTag(TagFilter target,
                                  TagData newID)
                           throws ReaderException

  Write a new ID to a tag.

  Parameters:
    `target` - the tag to write to, or null
    `newID` - the new tag ID to write
  Throws:
    `ReaderException`

### lockTag

    public abstract void lockTag(TagFilter target,
                                 TagLockAction lock)
                          throws ReaderException

  Perform a lock or unlock operation on a tag. The first tag seen is operated on - the singulation parameter may be used to control this. Note that a tag without an access password set may not accept a lock operation or remain locked.

  Parameters:
    `target` - the tag to lock, or null
    `lock` - the locking action to take.
  Throws:
    `ReaderException`

### killTag

    public abstract void killTag(TagFilter target,
                                 TagAuthentication auth)
                          throws ReaderException

  Kill a tag. The first tag seen is killed.

  Parameters:
    `target` - the tag kill, or null
    `auth` - the authentication needed to kill the tag
  Throws:
    `ReaderException`

### addReadListener

    public void addReadListener(ReadListener listener)

  Register a listener to be notified of asynchronous RFID read events.

  Parameters:
    `listener` - the ReadListener to add

### removeReadListener

    public void removeReadListener(ReadListener listener)

  Remove an listener from the list of listeners notified of asynchronous RFID read events.

  Parameters:
    `listener` - the ReadListener to remove

### addReadExceptionListener

    public void addReadExceptionListener(ReadExceptionListener listener)

  Register a listener to be notified of asynchronous RFID read exceptions.

  Parameters:
    `listener` - the ReadExceptionListener to add

### removeReadExceptionListener

    public void removeReadExceptionListener(ReadExceptionListener listener)

  Remove a listener from the list of listeners notified of asynchronous RFID read events.

  Parameters:
    `listener` - The ReadExceptionListener to remove

### addReadAuthenticationListener

    public void addReadAuthenticationListener(ReadAuthenticationListener listener)

  Register a listener to be notified of asynchronous RFID authentication exceptions.

  Parameters:
    `listener` - the ReadAuthenticationListener to add

### removeReadAuthenticationListener

    public void removeReadAuthenticationListener(ReadAuthenticationListener listener)

  Remove a listener from the list of listeners notified of asynchronous RFID authentication events.

  Parameters:
    `listener` - The ReadAuthenticationListener to remove

### startReading

    public abstract void startReading()

  Start reading RFID tags in the background. The tags found will be passed to the registered read listeners, and any exceptions that occur during reading will be passed to the registered exception listeners. Reading will continue until stopReading() is called.

  See Also:
    `addReadListener(com.thingmagic.ReadListener)`, `addReadExceptionListener(com.thingmagic.ReadExceptionListener)`

### stopReading

    public abstract boolean stopReading()

  Stop reading RFID tags in the background.

  Returns:
    stop reading success or failure

### gpiGet

    public abstract Reader.GpioPin[] gpiGet()
                                     throws ReaderException

  Get the state of all of the reader's GPI pins.

  Returns:
    array of GpioPin objects representing the state of all input pins
  Throws:
    `ReaderException`

### gpoSet

    public abstract void gpoSet(Reader.GpioPin[] state)
                         throws ReaderException

  Set the state of some GPO pins.

  Parameters:
    `state` - Array of GpioPin objects
  Throws:
    `ReaderException`

### paramList

    public java.lang.String[] paramList()

  Get a list of the parameters available

  Supported Parameters:

  - /reader/antenna/checkPort
  - /reader/antenna/checkport
  - /reader/antenna/connectedPortList
  - /reader/antenna/portList
  - /reader/antenna/portSwitchGpos
  - /reader/antenna/returnLoss
  - /reader/antenna/settlingTimeList
  - /reader/antenna/txRxMap
  - /reader/antennaMode
  - /reader/baudRate
  - /reader/commandTimeout
  - /reader/currentTime
  - /reader/description
  - /reader/extendedEPC
  - /reader/extendedepc
  - /reader/gen2/BLF
  - /reader/gen2/accessPassword
  - /reader/gen2/accesspassword
  - /reader/gen2/bap
  - /reader/gen2/blf
  - /reader/gen2/protocolExtension
  - /reader/gen2/protocolextension
  - /reader/gen2/q
  - /reader/gen2/session
  - /reader/gen2/t4
  - /reader/gen2/tagEncoding
  - /reader/gen2/tagencoding
  - /reader/gen2/target
  - /reader/gen2/tari
  - /reader/gen2/writeEarlyExit
  - /reader/gen2/writeMode
  - /reader/gen2/writeReplyTimeout
  - /reader/gen2/writeearlyexit
  - /reader/gpio/inputList
  - /reader/gpio/outputList
  - /reader/hostname
  - /reader/iso180006b/BLF
  - /reader/iso180006b/delimiter
  - /reader/iso180006b/modulationDepth
  - /reader/licenseKey
  - /reader/manageLicenseKey
  - /reader/metadata
  - /reader/powerMode
  - /reader/powermode
  - /reader/probeBaudRates
  - /reader/radio/enablePowerSave
  - /reader/radio/enableSJC
  - /reader/radio/enablepowersave
  - /reader/radio/enablesjc
  - /reader/radio/portReadPowerList
  - /reader/radio/portWritePowerList
  - /reader/radio/powerMax
  - /reader/radio/powerMin
  - /reader/radio/readPower
  - /reader/radio/temperature
  - /reader/radio/writePower
  - /reader/read/asyncOffTime
  - /reader/read/asyncOnTime
  - /reader/read/plan
  - /reader/read/trigger/gpi
  - /reader/region/hopTable
  - /reader/region/hopTime
  - /reader/region/id
  - /reader/region/lbt/enable
  - /reader/region/minimumFrequency
  - /reader/region/quantizationStep
  - /reader/region/supportedRegions
  - /reader/statistics
  - /reader/stats
  - /reader/stats/enable
  - /reader/status/antennaEnable
  - /reader/status/antennaenable
  - /reader/status/frequencyEnable
  - /reader/status/frequencyenable
  - /reader/status/temperatureEnable
  - /reader/status/temperatureenable
  - /reader/tagReadData/enableReadFilter
  - /reader/tagReadData/readFilterTimeout
  - /reader/tagReadData/recordHighestRssi
  - /reader/tagReadData/reportRssiInDbm
  - /reader/tagReadData/tagopFailures
  - /reader/tagReadData/tagopSuccesses
  - /reader/tagReadData/uniqueByAntenna
  - /reader/tagReadData/uniqueByData
  - /reader/tagReadData/uniqueByProtocol
  - /reader/tagop/antenna
  - /reader/tagop/protocol
  - /reader/tagreaddata/enablereadfilter
  - /reader/tagreaddata/recordhighestrssi
  - /reader/tagreaddata/reportrssiIndbm
  - /reader/tagreaddata/reportrssiindbm
  - /reader/tagreaddata/uniquebyantenna
  - /reader/tagreaddata/uniquebydata
  - /reader/tagreaddata/uniquebyprotocol
  - /reader/transportTimeout
  - /reader/uri
  - /reader/userConfig
  - /reader/userMode
  - /reader/version/hardware
  - /reader/version/model
  - /reader/version/productGroup
  - /reader/version/productGroupID
  - /reader/version/productID
  - /reader/version/serial
  - /reader/version/software
  - /reader/version/supportedProtocols

  Returns:
    an array of the parameter names

### executeTagOp

    public abstract java.lang.Object executeTagOp(TagOp tagOP,
                                                  TagFilter target)
                                           throws ReaderException

  execute a TagOp

  Throws:
    `ReaderException`

### paramGet

    public java.lang.Object paramGet(java.lang.String key)
                              throws ReaderException

  Get the value of a Reader parameter.

  Parameters:
    `key` - the parameter name
  Returns:
    the value of the parameter, as an Object
  Throws:
    `java.lang.IllegalArgumentException` - if the parameter does not exist
    `ReaderException`

### paramSet

    public void paramSet(java.lang.String key,
                         java.lang.Object value)
                  throws ReaderException

  Set the value of a Reader parameter.

  Parameters:
    `key` - the parameter name
    `value` - value of the parameter, as an Object
  Throws:
    `java.lang.IllegalArgumentException` - if the parameter does not exist, is read-only, or if the Object is the wrong type for the parameter.
    `ReaderException`

### firmwareLoad

    public abstract void firmwareLoad(java.io.InputStream firmware)
                               throws ReaderException,
                                      java.io.IOException

  Load a new firmware image into the device's nonvolatile memory. This installs the given image data onto the device and restarts it with that image. The firmware must be of an appropriate type for the device. Interrupting this operation may damage the reader.

  Parameters:
    `firmware` - a data stream of the firmware contents
  Throws:
    `ReaderException`
    `java.io.IOException`

### firmwareLoad

    public abstract void firmwareLoad(java.io.InputStream firmware,
                                      FirmwareLoadOptions loadOptions)
                               throws ReaderException,
                                      java.io.IOException

  Load a new firmware image into the device's nonvolatile memory. This installs the given image data onto the device and restarts it with that image. The firmware must be of an appropriate type for the device. Interrupting this operation may damage the reader.

  Parameters:
    `firmware` - a data stream of the firmware contents
  Throws:
    `ReaderException`
    `java.io.IOException`

### addTransportListener

    public abstract void addTransportListener(TransportListener listener)

  Register a listener to be notified of message packets.

  Parameters:
    `listener` - the TransportListener to add

### removeTransportListener

    public abstract void removeTransportListener(TransportListener listener)

  Remove a listener from the list of listeners to be notified of message packets.

  Parameters:
    `listener` - the TransportListener to add

### addStatusListener

    public abstract void addStatusListener(StatusListener listener)

  Register a listener to be notified about the read statistics

  Parameters:
    `listener` - - StatusLisenter to add

### removeStatusListener

    public abstract void removeStatusListener(StatusListener listener)

  remove a listener from the list of listeners to be notified of read statistics

  Parameters:
    `listener` - - StatusListener to remove

### addStatsListener

    public abstract void addStatsListener(StatsListener listener)

  Register a listener to be notified about the read stats

  Parameters:
    `listener` - - StatsLisenter to add

### removeStatsListener

    public abstract void removeStatsListener(StatsListener listener)

  remove a listener from the list of listeners to be notified of read stats

  Parameters:
    `listener` - - StatsListener to remove