public final class UniversalReader
extends java.lang.Object
Any instance of class is object associated with a given
InputStream
and OutputStream
, which are used to
transmit data. The InputStream
instance must provide a proper
implementation of InputStream.available()
method.
Modifier and Type | Class and Description |
---|---|
static interface |
UniversalReader.BarcodeListener
Interface definition for a callbacks to notify for barcode event.
|
class |
UniversalReader.BarcodeReader
This class provides functionality for Barcode reader.
|
static interface |
UniversalReader.ButtonListener
Interface definition for a callbacks to notify for button event.
|
static interface |
UniversalReader.CardListener
Interface definition for a callbacks to notify for card event.
|
static interface |
UniversalReader.ConnectionListener
Interface definition for a Printer event callback.
|
class |
UniversalReader.MifareReader
This class provides functionality for the Mifare reader.
|
class |
UniversalReader.SmartCardReader
This class provides functionality for the Smart Card reader.
|
class |
UniversalReader.TouchScreen
This class provides functionality for the Touchscreen.
|
Modifier and Type | Field and Description |
---|---|
static int |
BUTTON_MODE_BARCODE |
static int |
BUTTON_MODE_NONE |
static int |
BUTTON_MODE_STATUS |
static int |
CAPABILITY_BARCODE
Barcode reader capability.
|
static int |
CAPABILITY_BUTTON
Button capability.
|
static int |
CAPABILITY_DEBUG
Debug version capability.
|
static int |
CAPABILITY_EV15
Barcode reader EV15 capability.
|
static int |
CAPABILITY_FIRMWARE
Firmware download capability.
|
static int |
CAPABILITY_GSM
GSM module capability.
|
static int |
CAPABILITY_LCD2X16
LCD 2x16 capability.
|
static int |
CAPABILITY_MAGNETIC
Magnetic reader capability.
|
static int |
CAPABILITY_MIFARE
Mifare reader capability.
|
static int |
CAPABILITY_SMARTCARD
Smart card reader capability.
|
static int |
CAPABILITY_TOUCHSCREEN
Touch screen capability.
|
static int |
ERROR_0K
Operation successful.
|
static int |
ERROR_BARCODE
Barcode reader communication error.
|
static int |
ERROR_BARCODE_INVALID
Barcode reader invalid command.
|
static int |
ERROR_BARCODE_NODATA
No barcode read.
|
static int |
ERROR_BARCODE_NOTPRESENT
Barcode reader not present.
|
static int |
ERROR_CARD
Card error.
|
static int |
ERROR_INVALID
Invalid command code.
|
static int |
ERROR_MIFARE_ACCESS
Mifare access error.
|
static int |
ERROR_MIFARE_AUTHENTICATION
Mifare authentication error.
|
static int |
ERROR_MIFARE_BIT
Mifare bit count error.
|
static int |
ERROR_MIFARE_CODE
Mifare code error.
|
static int |
ERROR_MIFARE_COLLISION
Mifare collision error.
|
static int |
ERROR_MIFARE_CRC
Mifare CRC error.
|
static int |
ERROR_MIFARE_EEPROM
Mifare EEPROM error.
|
static int |
ERROR_MIFARE_FIFO
Mifare FIFO overflow.
|
static int |
ERROR_MIFARE_FRAME
Mifare frame error.
|
static int |
ERROR_MIFARE_GENERIC
Mifare generic error.
|
static int |
ERROR_MIFARE_KEY
Mifare invalid key.
|
static int |
ERROR_MIFARE_PARITY
Mifare parity error.
|
static int |
ERROR_MIFARE_TIMEOUT
Mifare timeout error.
|
static int |
ERROR_MIFARE_VALUE
Mifare value error.
|
static int |
ERROR_NODATA
No data available.
|
static int |
ERROR_NORESPONCE
No response from device.
|
static int |
ERROR_NOTPERMITTED
Command not permitted.
|
static int |
ERROR_SYNTAX
Syntax error.
|
Constructor and Description |
---|
UniversalReader(java.io.InputStream in,
java.io.OutputStream out)
Constructs a new instance of this class from a given
InputStream and OutputStream . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the streams and release all associated resources.
|
void |
displayText(java.lang.String first,
java.lang.String second)
Display text.
|
void |
enableMagneticCardReader(boolean enable)
Enables magnetic card reader.
|
void |
enableMagneticCardReaderEvents(boolean enable) |
UniversalReader.BarcodeReader |
getBarcodeReader()
Returns an instance of
BarcodeReader class. |
int |
getCapabilities()
Gets device capabilities.
|
java.lang.String |
getIdentification()
Gets the device identification string.
|
UniversalReader.MifareReader |
getMifareReader()
Returns an instance of
MifareReader class. |
java.lang.String |
getSerialNumber()
Gets the device serial number.
|
UniversalReader.SmartCardReader |
getSmartCardReader()
Returns an instance of
SmartCardReader class. |
UniversalReader.TouchScreen |
getTouchScreen()
Returns an instance of
Touchscreen class. |
boolean |
isButtonPressed()
Gets the current state of the button.
|
boolean |
isButtonPressed(boolean update)
Gets the current state of the button.
|
void |
playSound(int frequency,
int duration)
Plays sound via device buzzer.
|
byte[] |
readTrackData(int track)
Read track data.
|
void |
setAutoOff(int time)
Set auto off time.
|
void |
setBarcodeListener(UniversalReader.BarcodeListener listener)
Set a callback listener to notify for barcode event.
|
void |
setButton(int mode)
Set button function mode
|
void |
setButtonListener(UniversalReader.ButtonListener listener)
Set a callback listener to notify for button state changed.
|
void |
setCardListener(UniversalReader.CardListener listener)
Set a callback listener to notify for card event.
|
void |
setConnectionListener(UniversalReader.ConnectionListener listener)
Set a callback listener to notify the connection state is changed.
|
static void |
setDebug(boolean on)
Specify whether the object can output debug information
|
void |
turnOff()
Turn off the device.
|
public static final int ERROR_0K
public static final int ERROR_INVALID
public static final int ERROR_NOTPERMITTED
public static final int ERROR_CARD
public static final int ERROR_SYNTAX
public static final int ERROR_NORESPONCE
public static final int ERROR_NODATA
public static final int ERROR_BARCODE
public static final int ERROR_BARCODE_NODATA
public static final int ERROR_BARCODE_INVALID
public static final int ERROR_BARCODE_NOTPRESENT
public static final int ERROR_MIFARE_TIMEOUT
public static final int ERROR_MIFARE_COLLISION
public static final int ERROR_MIFARE_PARITY
public static final int ERROR_MIFARE_FRAME
public static final int ERROR_MIFARE_CRC
public static final int ERROR_MIFARE_FIFO
public static final int ERROR_MIFARE_EEPROM
public static final int ERROR_MIFARE_KEY
public static final int ERROR_MIFARE_GENERIC
public static final int ERROR_MIFARE_AUTHENTICATION
public static final int ERROR_MIFARE_CODE
public static final int ERROR_MIFARE_BIT
public static final int ERROR_MIFARE_ACCESS
public static final int ERROR_MIFARE_VALUE
public static final int CAPABILITY_DEBUG
public static final int CAPABILITY_SMARTCARD
public static final int CAPABILITY_BARCODE
public static final int CAPABILITY_TOUCHSCREEN
public static final int CAPABILITY_GSM
public static final int CAPABILITY_MIFARE
public static final int CAPABILITY_BUTTON
public static final int CAPABILITY_LCD2X16
public static final int CAPABILITY_FIRMWARE
public static final int CAPABILITY_MAGNETIC
public static final int CAPABILITY_EV15
public static final int BUTTON_MODE_NONE
public static final int BUTTON_MODE_BARCODE
public static final int BUTTON_MODE_STATUS
public UniversalReader(java.io.InputStream in, java.io.OutputStream out)
InputStream
and OutputStream
.
The InputStream
and OutputStream
must provides
direct row data access to hardware device.
If in
or out
is null
, a
NullPointerException
is thrown.
in
- the input stream.out
- the output stream.public void close()
public static void setDebug(boolean on)
on
- True to enable debbuging; otherwise false.public void setBarcodeListener(UniversalReader.BarcodeListener listener)
listener
- the listener.public void setCardListener(UniversalReader.CardListener listener)
listener
- the listener.public void setButtonListener(UniversalReader.ButtonListener listener)
listener
- the listener.public void setConnectionListener(UniversalReader.ConnectionListener listener)
listener
- the listener.public void enableMagneticCardReader(boolean enable) throws java.io.IOException, UniversalReaderException
enable
- true to enable; otherwise disable it.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public void enableMagneticCardReaderEvents(boolean enable) throws java.io.IOException, UniversalReaderException
java.io.IOException
UniversalReaderException
public void setButton(int mode) throws java.io.IOException, UniversalReaderException
mode
- the function mode. It can be one of BUTTON_MODE_* constant values.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public byte[] readTrackData(int track) throws java.io.IOException, UniversalReaderException
track
- the track mode.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public java.lang.String getIdentification() throws java.io.IOException, UniversalReaderException
java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public boolean isButtonPressed() throws java.io.IOException, UniversalReaderException
true
if the button is pressed; otherwise returns
false.UniversalReaderException
- if an error occurs during execution.java.io.IOException
public boolean isButtonPressed(boolean update) throws java.io.IOException, UniversalReaderException
update
- the flag indicates where to update button status from or
returns using the status from last operation.true
if the button is pressed; otherwise returns
false.UniversalReaderException
- if an error occurs during execution.java.io.IOException
public void turnOff() throws java.io.IOException, UniversalReaderException
java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public void setAutoOff(int time) throws java.io.IOException, UniversalReaderException
time
- the new auto off time in seconds.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public void playSound(int frequency, int duration) throws java.io.IOException, UniversalReaderException
frequency
- the frequency of sound in Hz.duration
- the duration of sound in milliseconds.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public void displayText(java.lang.String first, java.lang.String second) throws java.io.IOException, UniversalReaderException
first
- the text on first line.second
- the text on second line.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public java.lang.String getSerialNumber() throws java.io.IOException, UniversalReaderException
java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public int getCapabilities() throws java.io.IOException, UniversalReaderException
CAPABILITIES_
* constant field values.java.io.IOException
- if an I/O error occurs.UniversalReaderException
- if an error occurs during execution.public UniversalReader.BarcodeReader getBarcodeReader()
BarcodeReader
class.BarcodeReader
class.public UniversalReader.SmartCardReader getSmartCardReader()
SmartCardReader
class.SmartCardReader
class.public UniversalReader.TouchScreen getTouchScreen()
Touchscreen
class.Touchscreen
class.public UniversalReader.MifareReader getMifareReader()
MifareReader
class.MifareReader
class.