Reader.startreading(), Reader.startreading() 26 – ThingMagic Mercury API v1.23.0 User Manual

Page 26

Advertising
background image

Reading Tags - The Basics

26

Level 1 API



duration - The number of milliseconds to read for. In general, especially with

readers of type

SerialReader

, the duration should be kept short (a few seconds) to

avoid filling up the tag buffer. Maximum value is 65535 (65 seconds).

It performs the operation synchronously, and then returns an array of

TagReadData

objects resulting from the search. If no tags were found then the array will be empty; this
is not an error condition.

When performing a synchronous read() operation the tags being read are buffered on the
reader and stored in the reader’s Tag Buffer. During a single read() operation tag de-
duplication will occur on the reader so re-reads of the same tag will result in the tag’s
ReadCount metadata field to be incremented, a new

TagReadData

instance will not be

created for each. The reader specific hardware guide should be referenced for
information on the size of the Tag Buffer.

Note

The C-API read() implementation takes 3 arguments, reader pointer,
duration in milliseconds and the reference to the tag count. The third
parameter is an output parameter which gets filled by the read() method.
Upon successful completion of read() the method returns TMR_SUCCESS
status with the number of tags found. The

C Read Iterator

methods need to be

used to retrieve the tags.

Reader.startReading()

The

startReading() method is an asynchronous reading method. It does not take a

parameter.

void Reader.startReading()

It returns immediately to the calling thread and begins a sequence of reads or a
continuous read, depending on the reader, in a separate thread. The reading behavior is
controlled by the

Reader Configuration Parameters

:



/reader/read/asyncOnTime

- sets duration of those reads,



/reader/read/asyncOffTime

- sets the delay between the reads.

The results of each read is passed to the application via the

ReadListener

interface; each

listener registered with the

addReadListener() method is called with a

TagReadData

object for each read that has occurred. In the event of an error during these reads, the

ReadExceptionListener

interface is used, and each listener registered with the

addReadExceptionListener() method is called with a ReaderException
argument.

The reads are repeated until the

stopReading() method is called.

Advertising