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.
    `FindDevice` | `getFindDevice()` Returns the find device status of the equipment.
    `OperatingMode` | `getOperatingMode()` Returns the operating mode status of the equipment.
    `ReadMode` | `getReadMode()` Returns the read mode status of the equipment.
    `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` | `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` | `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.

    - #### 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