com.unitech.lib.transport

## Class TransportUART

- java.lang.Object
- - com.unitech.lib.transport.BaseTransport
  - - com.unitech.lib.transport.TransportUART

-     public class TransportUART
      extends BaseTransport

- - ### Field Summary

    - ### Fields inherited from class com.unitech.lib.transport.BaseTransport

      `_address, _byteQueue, _connState, _connType, _devName, _devType, _macAddress, DUMP, INFO, IO, TAG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransportUART(DeviceType deviceType, java.lang.String path, int baudRate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()` Returns the length of data that can be read with the read method.
    `void` | `changeState(ConnectState state, java.lang.Object params)`
    `boolean` | `connect()` Attempts to connect to the appliance using an instance of the Transport class.
    `void` | `destroy()` Destroys the instance and returns the resource.
    `void` | `disconnect()` An instance of the Transport class closes the connection to the device to which the device is connected.
    `int` | `getBaudRate()`
    `java.lang.String` | `getPath()`
    `void` | `listen()` An instance of the BaseTransport class waits for the device to connect.
    `int` | `read(byte[] data, int offset, int length)` Read data received from the device.
    `int` | `read(byte[] data, int offset, int length, int timeout)` Read data received from the device.
    `int` | `write(byte[] data, int offset, int length)` Transfer data to the device.
    `int` | `write(byte[] data, int offset, int length, int timeout)` Transfer data to the device.

    - ### Methods inherited from class com.unitech.lib.transport.BaseTransport

      `checkBufferSize, getAddress, getConnectType, getDeviceName, getDeviceType, getMacAddress, getState, read, read, setAddress, setDeviceName, setDeviceType, setMacAddress, setState, setStateListener, toString, write, write`

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

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

- - ### Constructor Detail

    - #### TransportUART

          public TransportUART(DeviceType deviceType,
                               java.lang.String path,
                               int baudRate)

  - ### Method Detail

    - #### connect

          public boolean connect()

      Description copied from class: `BaseTransport`
      Attempts to connect to the appliance using an instance of the Transport class.
      Specified by:
        `connect` in class `BaseTransport`
      Returns:
        Returns true if the connection attempt with the device is successful, false if it fails.

    - #### disconnect

          public void disconnect()

      Description copied from class: `BaseTransport`
      An instance of the Transport class closes the connection to the device to which the device is connected.
      Specified by:
        `disconnect` in class `BaseTransport`

    - #### listen

          public void listen()

      Description copied from class: `BaseTransport`
      An instance of the BaseTransport class waits for the device to connect.
      Specified by:
        `listen` in class `BaseTransport`

    - #### destroy

          public void destroy()

      Description copied from class: `BaseTransport`
      Destroys the instance and returns the resource.
      Specified by:
        `destroy` in class `BaseTransport`

    - #### write

          public int write(byte[] data,
                           int offset,
                           int length)

      Description copied from class: `BaseTransport`
      Transfer data to the device.
      Specified by:
        `write` in class `BaseTransport`
      Parameters:
        `data` - A byte array that specifies the data to transfer to the Device.
        `offset` - An integer indicating the start address of the data to be transferred to the Device.
        `length` - An integer indicating the length of the data to be transferred to the Device.
      Returns:
        Returns the length of the data transferred to the Device.

    - #### write

          public int write(byte[] data,
                           int offset,
                           int length,
                           int timeout)

      Description copied from class: `BaseTransport`
      Transfer data to the device.
      Specified by:
        `write` in class `BaseTransport`
      Parameters:
        `data` - A byte array that specifies the data to transfer to the Device.
        `offset` - An integer indicating the start address of the data to be transferred to the Device.
        `length` - An integer indicating the length of the data to be transferred to the Device.
        `timeout` - An integer specifying the timeout of data transmission to the device.
      Returns:
        Returns the length of the data transferred to the Device.

    - #### available

          public int available()

      Description copied from class: `BaseTransport`
      Returns the length of data that can be read with the read method.
      Specified by:
        `available` in class `BaseTransport`
      Returns:
        Returns the length of data received from the device.

    - #### read

          public int read(byte[] data,
                          int offset,
                          int length)

      Description copied from class: `BaseTransport`
      Read data received from the device.
      Specified by:
        `read` in class `BaseTransport`
      Parameters:
        `data` - A byte array to store the data received from the device.
        `offset` - Integer specifying the start address at which data received from device will begin to be stored in a byte array.
        `length` - An integer specifying the maximum length at which data received from the device can be stored in a byte array.
      Returns:
        Returns the length of data received from device and stored in a byte array.

    - #### read

          public int read(byte[] data,
                          int offset,
                          int length,
                          int timeout)

      Description copied from class: `BaseTransport`
      Read data received from the device.
      Specified by:
        `read` in class `BaseTransport`
      Parameters:
        `data` - A byte array to store the data received from the device.
        `offset` - Integer specifying the start address at which data received from device will begin to be stored in a byte array.
        `length` - An integer specifying the maximum length at which data received from the device can be stored in a byte array.
        `timeout` - An integer that specifies the timeout for reading data received from the device.
      Returns:
        Returns the length of data received from device and stored in a byte array.

    - #### getPath

          public java.lang.String getPath()

    - #### getBaudRate

          public int getBaudRate()

    - #### changeState

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