Connect, Connect 21 – ThingMagic Mercury API v1.23.0 User Manual
Page 21
Connecting to Readers
Level 1 API
21
– Astra-EX
Connect
The communication channel is not established until the
connect() method is called.
Calling:
void connect()
will establish a connection and initialize the device with any pre-configured settings.
Calling
connect() on an already connected device has no effect.
Note
SerialReaders require the
, to be set using
Level 2
connect(), in order for any RF operations to
succeed.
When attempting to open a connection the API will wait for
the reader to respond. If a response isn’t received in that period of time an exception will
be thrown. Certain transport layers, such as Bluetooth, may require a longer
transportTimeout, especially during initial connect.
For RQLReader connections this opens a TCP connection to port 8080 (or another port if
specified in the URI). For the SerialReaders when the specified serial device is opened
the baud rate is “auto-detected”. Once connected the serial device is set to the preferred
baud rate (115200 by default, for maximum compatibility with host serial devices). The
baud rate can also be manually set, prior to calling Connect(), using the
, this can avoid attempts using the wrong baud
rate during “auto-detect” for certain types of serial readers.
The connected reader is then queried for information that affects further communication,
such as the device model. After the
connect() succeeds the
be set (unless the hardware only supports one) and is checked for validity, and the default
protocol is set to Gen2.
Existing configuration on the device is not otherwise altered.
Note
It is the user’s responsibility to handle device restarts. If a device is restarted
it is recommended that the previously existing Reader object be destroyed,
and a new Reader object created.