com.unitech.lib.rpx

## Class RP902Reader

- java.lang.Object
- - com.unitech.lib.reader.BaseReader
  - - com.unitech.lib.rpx.RP902Reader

- All Implemented Interfaces:
    com.unitech.lib.device.IDeviceEventListener, com.unitech.lib.device.IReader, com.unitech.lib.transport.event.IConnectStateEventListener, com.unitech.stuhflBridge.ISerialStream

      public class RP902Reader
      extends BaseReader
      implements com.unitech.lib.device.IDeviceEventListener, com.unitech.stuhflBridge.ISerialStream

  The RP902Reader class is a class that controls RP902 in connection with unitech's equipment, receives data from RP902, and delivers it to the application program.

- - ### Field Summary

    - ### Fields inherited from class com.unitech.lib.reader.BaseReader

      `_actionState, _baseDevice, _baseTransport, _baseUHF, _checkInterval, _failCount, _fwVersion, _isDisconnecting, _lastError, _serialNo, DEFAULT_BATTERY_CHECK_INTERVAL, mLastTime, RETRY_COUNT, TAG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RP902Reader(BaseTransport baseTransport)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Destroys an instance of the BaseReader class and cleans up resources.
    `ResultCode` | `factoryReset()` Reset the device to factory default.
    `int` | `getAutoOffTime()` Returns the time which the instrument automatically turns off.
    `int[]` | `getAutoOffTimeList()` Returns the equipment supports auto off time list, the unit is minutes
    `int` | `getBatteryState()` Returns the battery state of the equipment.
    `BeeperState` | `getBeeper()` Returns the beeper operation status of the equipment.
    `DataFormat` | `getDataFormat()` Returns the data format setting of the equipment.
    `DataInfo` | `getDataInfo()` Returns the data info setting of the equipment.
    `DataRange` | `getDataRange()` Returns the data range setting of the equipment.
    `DataTerminator` | `getDataTerminator()` Returns the data terminator setting of the equipment.
    `FindDevice` | `getFindDevice()` Returns the find device status of the equipment.
    `OperatingMode` | `getOperatingMode()` Returns the operating mode status of the equipment.
    `PowerDutyLimitationMap` | `getPowerAndDutyLimitationMapInfo()` Returns the Power Duty Limitation Map setting of the equipment.
    `ReadMode` | `getReadMode()` Returns the read mode status of the equipment.
    `ScreenOffTime` | `getScreenOffTime()` Returns the time which the instrument automatically screen off.
    `SKUType` | `getSKU()` Returns the SKU type of the equipment.
    `double` | `getTemperature()` Returns the temperature of the equipment.
    `java.util.Date` | `getTime()` Returns the system time of the device.
    `VibratorState` | `getVibrator()` Returns the vibrator operation status of the equipment.
    `boolean` | `initReader()` Initializes an BaseReader instance after the BaseReader instance is associated with the device.
    `void` | `onActionChanged(ResultCode resultCode, ActionType actionType, java.lang.Object params)` Called when the operational state of the Device.
    `void` | `onBatteryState(int batteryState, java.lang.Object params)` Called to report the battery state of the Device.
    `void` | `onEvent(int sub, java.lang.Object data)`
    `void` | `onKeyEvent(KeyType keyType, KeyState keyState, java.lang.Object params)` Called to report the key type and state of the Device.
    `void` | `onNotificationState(NotificationState state, java.lang.Object params)` Called to notify the state of the Device.
    `void` | `onStateChanged(ConnectState state, java.lang.Object params)` Called when the connection state of the BaseTransport instance and the device changes.
    `void` | `onTemperatureState(double temperature, java.lang.Object params)` Called to report the temperature state of the Device.
    `int` | `read(byte[] buff, int length)`
    `void` | `setAutoOffTime(int time)` Sets the time which the equipment automatically turns off.
    `void` | `setBeeper(BeeperState state)` Sets the beeper operation status of the equipment.
    `void` | `setDataFormat(DataFormat dataFormat)` Sets the data format setting of the equipment.
    `void` | `setDataInfo(DataInfo dataInfo)` Sets the data info setting of the equipment.
    `void` | `setDataRange(DataRange dataRange)` Sets the data range setting of the equipment.
    `void` | `setDataTerminator(DataTerminator dataTerminator)` Sets the data terminator setting of the equipment.
    `void` | `setDisplayOutput(DisplayOutput displayOutput)` Sets the display output setting of the equipment.
    `void` | `setDisplayTags(DisplayTags displayTags)` Sets the display tags setting of the equipment output.
    `void` | `setFindDevice(FindDevice mode)` Sets the find device status of the equipment.
    `void` | `setOperatingMode(OperatingMode mode)` Sets the operating mode status of the equipment.
    `void` | `setReadMode(ReadMode mode)` Sets the read mode status of the equipment.
    `void` | `setScreenOffTime(ScreenOffTime time)` Sets the time which the equipment automatically screen off.
    `void` | `setSoftWareScan(boolean softwareScan)` Sets the software scan setting of the equipment.
    `void` | `setTime(java.util.Date time)` Sets the system time of the instrument.
    `void` | `setVibrator(VibratorState state)` Sets the vibrator operation status of the equipment.
    `int` | `write(byte[] buff, int length)`

    - ### Methods inherited from class com.unitech.lib.reader.BaseReader

      `addListener, checkError, clearListener, connect, disconnect, getAction, getAddress, getCheckInterval, getConnectType, getDeviceName, getDeviceType, getLastError, getProtocol, getRfidUhf, getSerialNo, getState, getTransport, getVersion, listen, onReaderActionChanged, onReaderBatteryState, onReaderKeyChanged, onReaderNotificationState, onReaderStateChanged, onReaderTemperatureState, removeListener, resetError, setAction, setAddress, setCheckInterval, setDeviceName, setDeviceType, setLastError, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RP902Reader

          public RP902Reader(BaseTransport baseTransport)

  - ### Method Detail

    - #### read

          public int read(byte[] buff,
                          int length)

      Specified by:
        `read` in interface `com.unitech.stuhflBridge.ISerialStream`

    - #### write

          public int write(byte[] buff,
                           int length)

      Specified by:
        `write` in interface `com.unitech.stuhflBridge.ISerialStream`

    - #### destroy

          public void destroy()

      Description copied from class: `BaseReader`
      Destroys an instance of the BaseReader class and cleans up resources.
      Overrides:
        `destroy` in class `BaseReader`

    - #### factoryReset

          public ResultCode factoryReset()
                                  throws ReaderException

      Description copied from class: `BaseReader`
      Reset the device to factory default.
      Specified by:
        `factoryReset` in class `BaseReader`
      Returns:
        The ResultCode enumeration indicating the result of the method's operation.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getSKU

          public SKUType getSKU()
                         throws ReaderException

      Description copied from class: `BaseReader`
      Returns the SKU type of the equipment.
      Specified by:
        `getSKU` in class `BaseReader`
      Returns:
        An SKUType enumeration that indicates the SKU type of the device.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getTemperature

          public double getTemperature()
                                throws ReaderException

      Description copied from class: `BaseReader`
      Returns the temperature of the equipment.
      Specified by:
        `getTemperature` in class `BaseReader`
      Returns:
        The temperature of the device and the range is ~128 to 127.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getReadMode

          public ReadMode getReadMode()
                               throws ReaderException

      Description copied from class: `BaseReader`
      Returns the read mode status of the equipment.
      Specified by:
        `getReadMode` in class `BaseReader`
      Returns:
        To specify the status of the equipment's read mode ReadMode enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setReadMode

          public void setReadMode(ReadMode mode)
                           throws ReaderException

      Description copied from class: `BaseReader`
      Sets the read mode status of the equipment.
      Specified by:
        `setReadMode` in class `BaseReader`
      Parameters:
        `mode` - To specify the status of the read mode ReadMode enumeration.
      Throws:
        `ReaderException`

    - #### getAutoOffTimeList

          public int[] getAutoOffTimeList()

      Description copied from class: `BaseReader`
      Returns the equipment supports auto off time list, the unit is minutes
      Specified by:
        `getAutoOffTimeList` in class `BaseReader`
      Returns:
        This is an integer list that indicates the time that the device supported auto off time.

    - #### getAutoOffTime

          public int getAutoOffTime()
                             throws ReaderException

      Description copied from class: `BaseReader`
      Returns the time which the instrument automatically turns off.
      Specified by:
        `getAutoOffTime` in class `BaseReader`
      Returns:
        This is an integer that indicates the time that the device is turned off automatically.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setAutoOffTime

          public void setAutoOffTime(int time)
                              throws ReaderException

      Description copied from class: `BaseReader`
      Sets the time which the equipment automatically turns off.
      Specified by:
        `setAutoOffTime` in class `BaseReader`
      Parameters:
        `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.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getFindDevice

          public FindDevice getFindDevice()
                                   throws ReaderException

      Description copied from class: `BaseReader`
      Returns the find device status of the equipment.
      Specified by:
        `getFindDevice` in class `BaseReader`
      Returns:
        To specify the status of the equipment's find device mode FindDevice class.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setFindDevice

          public void setFindDevice(FindDevice mode)
                             throws ReaderException

      Description copied from class: `BaseReader`
      Sets the find device status of the equipment.
      Specified by:
        `setFindDevice` in class `BaseReader`
      Parameters:
        `mode` - To specify the status of the find device FindDevice class.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getOperatingMode

          public OperatingMode getOperatingMode()
                                         throws ReaderException

      Description copied from class: `BaseReader`
      Returns the operating mode status of the equipment.
      Specified by:
        `getOperatingMode` in class `BaseReader`
      Returns:
        To specify the status of the equipment's operating mode OperatingMode enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setOperatingMode

          public void setOperatingMode(OperatingMode mode)
                                throws ReaderException

      Description copied from class: `BaseReader`
      Sets the operating mode status of the equipment.
      Specified by:
        `setOperatingMode` in class `BaseReader`
      Parameters:
        `mode` - To specify the status of the operating mode OperatingMode enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getDataFormat

          public DataFormat getDataFormat()
                                   throws ReaderException

      Description copied from class: `BaseReader`
      Returns the data format setting of the equipment.
      Specified by:
        `getDataFormat` in class `BaseReader`
      Returns:
        To specify the setting of the equipment's data format DataFormat enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setDataFormat

          public void setDataFormat(DataFormat dataFormat)
                             throws ReaderException

      Description copied from class: `BaseReader`
      Sets the data format setting of the equipment.
      Specified by:
        `setDataFormat` in class `BaseReader`
      Parameters:
        `dataFormat` - To specify the setting of the data format DataFormat enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getDataInfo

          public DataInfo getDataInfo()
                               throws ReaderException

      Description copied from class: `BaseReader`
      Returns the data info setting of the equipment.
      Specified by:
        `getDataInfo` in class `BaseReader`
      Returns:
        To specify the setting of the equipment's data info DataInfo enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setDataInfo

          public void setDataInfo(DataInfo dataInfo)
                           throws ReaderException

      Description copied from class: `BaseReader`
      Sets the data info setting of the equipment.
      Specified by:
        `setDataInfo` in class `BaseReader`
      Parameters:
        `dataInfo` - To specify the setting of the data info DataInfo enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getDataRange

          public DataRange getDataRange()
                                 throws ReaderException

      Description copied from class: `BaseReader`
      Returns the data range setting of the equipment.
      Specified by:
        `getDataRange` in class `BaseReader`
      Returns:
        To specify the setting of the equipment's data range DataRange enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setDataRange

          public void setDataRange(DataRange dataRange)
                            throws ReaderException

      Description copied from class: `BaseReader`
      Sets the data range setting of the equipment.
      Specified by:
        `setDataRange` in class `BaseReader`
      Parameters:
        `dataRange` - To specify the setting of the data range DataRange enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getDataTerminator

          public DataTerminator getDataTerminator()
                                           throws ReaderException

      Description copied from class: `BaseReader`
      Returns the data terminator setting of the equipment.
      Specified by:
        `getDataTerminator` in class `BaseReader`
      Returns:
        To specify the setting of the equipment's data terminator DataTerminator enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setDataTerminator

          public void setDataTerminator(DataTerminator dataTerminator)
                                 throws ReaderException

      Description copied from class: `BaseReader`
      Sets the data terminator setting of the equipment.
      Specified by:
        `setDataTerminator` in class `BaseReader`
      Parameters:
        `dataTerminator` - To specify the setting of the data terminator DataTerminator enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getPowerAndDutyLimitationMapInfo

          public PowerDutyLimitationMap getPowerAndDutyLimitationMapInfo()

      Description copied from class: `BaseReader`
      Returns the Power Duty Limitation Map setting of the equipment.
      Specified by:
        `getPowerAndDutyLimitationMapInfo` in class `BaseReader`
      Returns:
        To specify the setting of the equipment's Power Duty Limitation Map.

    - #### setSoftWareScan

          public void setSoftWareScan(boolean softwareScan)

      Description copied from class: `BaseReader`
      Sets the software scan setting of the equipment.
      Specified by:
        `setSoftWareScan` in class `BaseReader`
      Parameters:
        `softwareScan` - To specify the setting of the software scan SoftWareScan enumeration.

    - #### setDisplayTags

          public void setDisplayTags(DisplayTags displayTags)

      Description copied from class: `BaseReader`
      Sets the display tags setting of the equipment output.
      Specified by:
        `setDisplayTags` in class `BaseReader`
      Parameters:
        `displayTags` - To specify the setting of the display tags DisplayTags enumeration.

    - #### setDisplayOutput

          public void setDisplayOutput(DisplayOutput displayOutput)
                                throws ReaderException

      Description copied from class: `BaseReader`
      Sets the display output setting of the equipment.
      Specified by:
        `setDisplayOutput` in class `BaseReader`
      Parameters:
        `displayOutput` - To specify the setting of the display output DisplayOutput enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getScreenOffTime

          public ScreenOffTime getScreenOffTime()
                                         throws ReaderException

      Description copied from class: `BaseReader`
      Returns the time which the instrument automatically screen off.
      Specified by:
        `getScreenOffTime` in class `BaseReader`
      Returns:
        This is an integer that indicates the time that the device is screen off automatically.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setScreenOffTime

          public void setScreenOffTime(ScreenOffTime time)
                                throws ReaderException

      Description copied from class: `BaseReader`
      Sets the time which the equipment automatically screen off.
      Specified by:
        `setScreenOffTime` in class `BaseReader`
      Parameters:
        `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.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getBeeper

          public BeeperState getBeeper()
                                throws ReaderException

      Description copied from class: `BaseReader`
      Returns the beeper operation status of the equipment.
      Specified by:
        `getBeeper` in class `BaseReader`
      Returns:
        To specify the status of the equipment's beeper BeeperState enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setBeeper

          public void setBeeper(BeeperState state)
                         throws ReaderException

      Description copied from class: `BaseReader`
      Sets the beeper operation status of the equipment.
      Specified by:
        `setBeeper` in class `BaseReader`
      Parameters:
        `state` - To specify the status of the beeper BeeperState enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getVibrator

          public VibratorState getVibrator()
                                    throws ReaderException

      Description copied from class: `BaseReader`
      Returns the vibrator operation status of the equipment.
      Specified by:
        `getVibrator` in class `BaseReader`
      Returns:
        To specify the status of the equipment's vibrator VibratorState enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setVibrator

          public void setVibrator(VibratorState state)
                           throws ReaderException

      Description copied from class: `BaseReader`
      Sets the vibrator operation status of the equipment.
      Specified by:
        `setVibrator` in class `BaseReader`
      Parameters:
        `state` - To specify the status of the vibrator VibratorState enumeration.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getBatteryState

          public int getBatteryState()
                              throws ReaderException

      Description copied from class: `BaseReader`
      Returns the battery state of the equipment.
      Specified by:
        `getBatteryState` in class `BaseReader`
      Returns:
        To specify the status of the equipment's battery.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### getTime

          public java.util.Date getTime()
                                 throws ReaderException

      Description copied from class: `BaseReader`
      Returns the system time of the device.
      Specified by:
        `getTime` in class `BaseReader`
      Returns:
        An instance of Date representing the current date and time on the device.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### setTime

          public void setTime(java.util.Date time)
                       throws ReaderException

      Description copied from class: `BaseReader`
      Sets the system time of the instrument.
      Specified by:
        `setTime` in class `BaseReader`
      Parameters:
        `time` - An instance of Date representing the current date and time on the device.
      Throws:
        `ReaderException` - An ReaderException exception is thrown if a failure occurs while setting data on the instrument or returning data.

    - #### onStateChanged

          public void onStateChanged(ConnectState state,
                                     java.lang.Object params)

      Description copied from class: `BaseReader`
      Called when the connection state of the BaseTransport instance and the device changes.
      Specified by:
        `onStateChanged` in interface `com.unitech.lib.device.IDeviceEventListener`
      Specified by:
        `onStateChanged` in interface `com.unitech.lib.transport.event.IConnectStateEventListener`
      Specified by:
        `onStateChanged` in class `BaseReader`
      Parameters:
        `state` - A ConnectState enumeration that indicates the device and its connection status.
        `params` - This parameter is used to transmit additional information that is generated

    - #### onActionChanged

          public void onActionChanged(ResultCode resultCode,
                                      ActionType actionType,
                                      java.lang.Object params)

      Description copied from interface: `com.unitech.lib.device.IDeviceEventListener`
      Called when the operational state of the Device.
      Specified by:
        `onActionChanged` in interface `com.unitech.lib.device.IDeviceEventListener`
      Parameters:
        `resultCode` - ResultCode enumeration type indicating the operation result of the Device.
        `actionType` - An ActionType enumeration indicating the device's operational state.
        `params` - If the event is accompanied by additional information, a non-null value is passed to the instance.

    - #### onBatteryState

          public void onBatteryState(int batteryState,
                                     java.lang.Object params)

      Description copied from interface: `com.unitech.lib.device.IDeviceEventListener`
      Called to report the battery state of the Device.
      Specified by:
        `onBatteryState` in interface `com.unitech.lib.device.IDeviceEventListener`
      Parameters:
        `batteryState` - An integer representing the battery state of the Device.
        `params` - If the event is accompanied by additional information, a non-null value is passed to the instance.

    - #### onKeyEvent

          public void onKeyEvent(KeyType keyType,
                                 KeyState keyState,
                                 java.lang.Object params)

      Description copied from interface: `com.unitech.lib.device.IDeviceEventListener`
      Called to report the key type and state of the Device.
      Specified by:
        `onKeyEvent` in interface `com.unitech.lib.device.IDeviceEventListener`
      Parameters:
        `keyType` - An KeyType enum indicating the Device's Trigger Event.
        `keyState` - An KeyState enum indicating the Device's Key Event.
        `params` - If the event is accompanied by additional information, a non-null value is passed to the instance.

    - #### onNotificationState

          public void onNotificationState(NotificationState state,
                                          java.lang.Object params)

      Description copied from interface: `com.unitech.lib.device.IDeviceEventListener`
      Called to notify the state of the Device.
      Specified by:
        `onNotificationState` in interface `com.unitech.lib.device.IDeviceEventListener`
      Parameters:
        `state` - A NotificationState enumeration indicating the notification status with the Device.
        `params` - If the event is accompanied by additional information, a non-null value is passed to the instance.

    - #### onTemperatureState

          public void onTemperatureState(double temperature,
                                         java.lang.Object params)

      Description copied from interface: `com.unitech.lib.device.IDeviceEventListener`
      Called to report the temperature state of the Device.
      Specified by:
        `onTemperatureState` in interface `com.unitech.lib.device.IDeviceEventListener`
      Parameters:
        `temperature` - An double representing the temperature state of the Device.
        `params` - If the event is accompanied by additional information, a non-null value is passed to the instance.

    - #### onEvent

          public void onEvent(int sub,
                              java.lang.Object data)

      Specified by:
        `onEvent` in interface `com.unitech.lib.device.IDeviceEventListener`

    - #### initReader

          public boolean initReader()

      Description copied from class: `BaseReader`
      Initializes an BaseReader instance after the BaseReader instance is associated with the device.
      Specified by:
        `initReader` in class `BaseReader`
      Returns:
        Returns true if successful, false against failure