public abstract class BaseReader
extends java.lang.Object
implements com.unitech.lib.device.IReader, com.unitech.lib.transport.event.IConnectStateEventListener
Modifier and Type | Field and Description |
---|---|
protected ActionState |
_actionState |
protected com.unitech.lib.reader.device.BaseDevice |
_baseDevice |
protected BaseTransport |
_baseTransport |
protected BaseUHF |
_baseUHF |
protected int |
_checkInterval |
protected int |
_failCount |
protected java.lang.String |
_fwVersion |
protected boolean |
_isDisconnecting |
protected ResultCode |
_lastError |
protected java.lang.String |
_serialNo |
protected static int |
DEFAULT_BATTERY_CHECK_INTERVAL |
protected long |
mLastTime |
protected static int |
RETRY_COUNT |
protected java.lang.String |
TAG |
Constructor and Description |
---|
BaseReader(BaseTransport baseTransport)
Creates an instance of BaseReader.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(IReaderEventListener listener)
Adds a Listener to receive events on an instance of the BaseReader class.
|
void |
checkError()
Use only within the SDK.
|
void |
clearListener()
Removes all listeners registered on an instance of the BaseReader class.
|
boolean |
connect()
An instance of the BaseReader class tries to connect to the configured address
|
void |
destroy()
Destroys an instance of the BaseReader class and cleans up resources.
|
void |
disconnect()
Causes an instance of the BaseReader class to disconnect from the connected device.
|
abstract ResultCode |
factoryReset()
Reset the device to factory default.
|
ActionState |
getAction()
Returns the current behavior of the device associated with an instance of the BaseReader class.
|
java.lang.String |
getAddress()
Returns the address of the device associated with an instance of the BaseReader class.
|
abstract int |
getAutoOffTime()
Returns the time which the instrument automatically turns off.
|
abstract int[] |
getAutoOffTimeList()
Returns the equipment supports auto off time list, the unit is minutes
|
abstract int |
getBatteryState()
Returns the battery state of the equipment.
|
abstract BeeperState |
getBeeper()
Returns the beeper operation status of the equipment.
|
int |
getCheckInterval()
Returns the time period for checking the battery status of the device associated with an
instance of the BaseReader class.
|
ConnectType |
getConnectType()
Returns the instance of BaseReader associated with device.
|
abstract DataFormat |
getDataFormat()
Returns the data format setting of the equipment.
|
abstract DataInfo |
getDataInfo()
Returns the data info setting of the equipment.
|
abstract DataRange |
getDataRange()
Returns the data range setting of the equipment.
|
abstract DataTerminator |
getDataTerminator()
Returns the data terminator setting of the equipment.
|
java.lang.String |
getDeviceName()
Returns the name of the Device associated with an instance of the BaseReader class.
|
DeviceType |
getDeviceType()
Returns the type of Device to which the instance is connected.
|
abstract FindDevice |
getFindDevice()
Returns the find device status of the equipment.
|
ResultCode |
getLastError()
Returns the result code for the last action.
|
abstract OperatingMode |
getOperatingMode()
Returns the operating mode status of the equipment.
|
abstract PowerDutyLimitationMap |
getPowerAndDutyLimitationMapInfo()
Returns the Power Duty Limitation Map setting of the equipment.
|
com.unitech.lib.protocol.IProtocol |
getProtocol()
Use only within the SDK.
|
abstract ReadMode |
getReadMode()
Returns the read mode status of the equipment.
|
BaseUHF |
getRfidUhf()
If the BaseReader instance supports the RFID UHF module, it returns an interface object that
can control the RFID UHF module.
|
abstract ScreenOffTime |
getScreenOffTime()
Returns the time which the instrument automatically screen off.
|
java.lang.String |
getSerialNo()
Returns the serial number of the device.
|
abstract SKUType |
getSKU()
Returns the SKU type of the equipment.
|
ConnectState |
getState()
Returns the connection status of the device with the instance of the BaseReader class.
|
abstract double |
getTemperature()
Returns the temperature of the equipment.
|
abstract java.util.Date |
getTime()
Returns the system time of the device.
|
BaseTransport |
getTransport()
Returns an instance of the BaseTransport class that connects an instance of the BaseReader class
to the Device.
|
java.lang.String |
getVersion()
Returns the firmware version of the device associated with the instance of the BaseReader class.
|
abstract VibratorState |
getVibrator()
Returns the vibrator operation status of the equipment.
|
abstract boolean |
initReader()
Initializes an BaseReader instance after the BaseReader instance is associated with the device.
|
void |
listen()
Allows the BaseReader class to wait for connection until the connection is made from the device.
|
protected void |
onReaderActionChanged(ResultCode code,
ActionState action,
java.lang.Object params) |
protected void |
onReaderBatteryState(int batteryState,
java.lang.Object params) |
protected void |
onReaderKeyChanged(KeyType type,
KeyState state,
java.lang.Object params) |
protected void |
onReaderNotificationState(NotificationState state,
java.lang.Object params) |
protected void |
onReaderStateChanged(ConnectState state,
java.lang.Object params) |
protected void |
onReaderTemperatureState(double temperature,
java.lang.Object params) |
abstract void |
onStateChanged(ConnectState state,
java.lang.Object params)
Called when the connection state of the BaseTransport instance and the device changes.
|
void |
removeListener(IReaderEventListener listener)
Removes the Listener that is listening for events on an instance of the BaseReader class.
|
void |
resetError()
Use only within the SDK.
|
void |
setAction(ActionState state)
Sets the operational state of the device associated with the instance.
|
void |
setAddress(java.lang.String address)
Sets the address of the device to which the instance of BaseReader is connected.
|
abstract void |
setAutoOffTime(int time)
Sets the time which the equipment automatically turns off.
|
abstract void |
setBeeper(BeeperState state)
Sets the beeper operation status of the equipment.
|
void |
setCheckInterval(int interval)
Sets the time period for checking the battery status of the device associated with the
BaseReader class instance.
|
abstract void |
setDataFormat(DataFormat dataFormat)
Sets the data format setting of the equipment.
|
abstract void |
setDataInfo(DataInfo dataInfo)
Sets the data info setting of the equipment.
|
abstract void |
setDataRange(DataRange dataRange)
Sets the data range setting of the equipment.
|
abstract void |
setDataTerminator(DataTerminator dataTerminator)
Sets the data terminator setting of the equipment.
|
void |
setDeviceName(java.lang.String name)
Sets the name of the device to which the instance of BaseReader is connected.
|
void |
setDeviceType(DeviceType type)
Sets the type of device to which instance of BaseReader will be connected.
|
abstract void |
setDisplayOutput(DisplayOutput displayOut)
Sets the display output setting of the equipment.
|
abstract void |
setDisplayTags(DisplayTags displayTags)
Sets the display tags setting of the equipment output.
|
abstract void |
setFindDevice(FindDevice mode)
Sets the find device status of the equipment.
|
void |
setLastError(ResultCode code)
Use only within the SDK.
|
abstract void |
setOperatingMode(OperatingMode mode)
Sets the operating mode status of the equipment.
|
abstract void |
setReadMode(ReadMode mode)
Sets the read mode status of the equipment.
|
abstract void |
setScreenOffTime(ScreenOffTime time)
Sets the time which the equipment automatically screen off.
|
abstract void |
setSoftWareScan(boolean softwareScan)
Sets the software scan setting of the equipment.
|
abstract void |
setTime(java.util.Date time)
Sets the system time of the instrument.
|
abstract void |
setVibrator(VibratorState state)
Sets the vibrator operation status of the equipment.
|
java.lang.String |
toString() |
protected static final int DEFAULT_BATTERY_CHECK_INTERVAL
protected static final int RETRY_COUNT
protected java.lang.String TAG
protected BaseTransport _baseTransport
protected com.unitech.lib.reader.device.BaseDevice _baseDevice
protected BaseUHF _baseUHF
protected volatile ActionState _actionState
protected java.lang.String _serialNo
protected java.lang.String _fwVersion
protected ResultCode _lastError
protected int _checkInterval
protected int _failCount
protected boolean _isDisconnecting
protected long mLastTime
public BaseReader(BaseTransport baseTransport)
baseTransport
- An instance of an inherited class of the BaseTransport class that defines
how an instance is associated with a Device.public boolean connect()
public void listen()
public void disconnect()
public DeviceType getDeviceType()
getDeviceType
in interface com.unitech.lib.device.IReader
public void setDeviceType(DeviceType type)
setDeviceType
in interface com.unitech.lib.device.IReader
type
- The DeviceType enumeration indicating the type of device.public java.lang.String getDeviceName()
getDeviceName
in interface com.unitech.lib.device.IReader
public void setDeviceName(java.lang.String name)
setDeviceName
in interface com.unitech.lib.device.IReader
name
- A string representing the name of the Device.public void addListener(IReaderEventListener listener)
listener
- An instance of IReaderEventListener to receive events fired by instances of
the BaseReader class.public void removeListener(IReaderEventListener listener)
listener
- An instance of IReaderEventListener that is receiving events fired by
instances of the BaseReader class.public void clearListener()
public java.lang.String getSerialNo()
getSerialNo
in interface com.unitech.lib.device.IReader
public BaseTransport getTransport()
public java.lang.String getAddress()
getAddress
in interface com.unitech.lib.device.IReader
public void setAddress(java.lang.String address)
setAddress
in interface com.unitech.lib.device.IReader
address
- A string representing the address of the Device.public ConnectType getConnectType()
public ConnectState getState()
public BaseUHF getRfidUhf()
public void destroy()
public ResultCode getLastError()
getLastError
in interface com.unitech.lib.device.IReader
public java.lang.String getVersion()
getVersion
in interface com.unitech.lib.device.IReader
public ActionState getAction()
getAction
in interface com.unitech.lib.device.IReader
public void setAction(ActionState state)
setAction
in interface com.unitech.lib.device.IReader
state
- ActionState enumeration indicating the state of the action.public int getCheckInterval()
public void setCheckInterval(int interval)
interval
- Integer type indicating the battery check cycle time of the equipment. The unit is ms.public java.lang.String toString()
toString
in class java.lang.Object
protected void onReaderStateChanged(ConnectState state, java.lang.Object params)
protected void onReaderActionChanged(ResultCode code, ActionState action, java.lang.Object params)
protected void onReaderBatteryState(int batteryState, java.lang.Object params)
protected void onReaderKeyChanged(KeyType type, KeyState state, java.lang.Object params)
protected void onReaderNotificationState(NotificationState state, java.lang.Object params)
protected void onReaderTemperatureState(double temperature, java.lang.Object params)
public abstract boolean initReader()
public abstract BeeperState getBeeper() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setBeeper(BeeperState state) throws ReaderException
state
- To specify the status of the beeper BeeperState enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract VibratorState getVibrator() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setVibrator(VibratorState state) throws ReaderException
state
- To specify the status of the vibrator VibratorState enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract int getBatteryState() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract java.util.Date getTime() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setTime(java.util.Date time) throws ReaderException
time
- An instance of Date representing the current date and time on the device.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void onStateChanged(ConnectState state, java.lang.Object params)
onStateChanged
in interface com.unitech.lib.transport.event.IConnectStateEventListener
state
- A ConnectState enumeration that indicates the device and its connection status.params
- This parameter is used to transmit additional information that is generatedpublic abstract int[] getAutoOffTimeList()
public abstract int getAutoOffTime() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setAutoOffTime(int time) throws ReaderException
time
- An integer that indicates how long the device will automatically turn itself off.
The time unit is specified in minutes. If you set the time to 0, the instrument
will not turn off automatically.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract ResultCode factoryReset() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract SKUType getSKU() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract double getTemperature() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract ReadMode getReadMode() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setReadMode(ReadMode mode) throws ReaderException
mode
- To specify the status of the read mode ReadMode enumeration.ReaderException
public abstract FindDevice getFindDevice() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setFindDevice(FindDevice mode) throws ReaderException
mode
- To specify the status of the find device FindDevice class.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract OperatingMode getOperatingMode() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setOperatingMode(OperatingMode mode) throws ReaderException
mode
- To specify the status of the operating mode OperatingMode enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract DataFormat getDataFormat() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setDataFormat(DataFormat dataFormat) throws ReaderException
dataFormat
- To specify the setting of the data format DataFormat enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract DataInfo getDataInfo() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setDataInfo(DataInfo dataInfo) throws ReaderException
dataInfo
- To specify the setting of the data info DataInfo enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract DataRange getDataRange() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setDataRange(DataRange dataRange) throws ReaderException
dataRange
- To specify the setting of the data range DataRange enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract DataTerminator getDataTerminator() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setDataTerminator(DataTerminator dataTerminator) throws ReaderException
dataTerminator
- To specify the setting of the data terminator DataTerminator enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract PowerDutyLimitationMap getPowerAndDutyLimitationMapInfo()
public abstract void setSoftWareScan(boolean softwareScan)
softwareScan
- To specify the setting of the software scan SoftWareScan enumeration.public abstract void setDisplayTags(DisplayTags displayTags)
displayTags
- To specify the setting of the display tags DisplayTags enumeration.public abstract void setDisplayOutput(DisplayOutput displayOut) throws ReaderException
displayOut
- To specify the setting of the display output DisplayOutput enumeration.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract ScreenOffTime getScreenOffTime() throws ReaderException
ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public abstract void setScreenOffTime(ScreenOffTime time) throws ReaderException
time
- It indicates how long the device will automatically screen off.
The time is specified in minutes and seconds. If you set the minutes to 0
and seconds to 0, the instrument will not screen off automatically.ReaderException
- An ReaderException exception is thrown if a failure occurs while
setting data on the instrument or returning data.public void resetError()
resetError
in interface com.unitech.lib.device.IReader
public void setLastError(ResultCode code)
setLastError
in interface com.unitech.lib.device.IReader
code
- public com.unitech.lib.protocol.IProtocol getProtocol()
getProtocol
in interface com.unitech.lib.device.IReader
public void checkError()
checkError
in interface com.unitech.lib.device.IReader