## com.thingmagic
Interface SerialTransport

All Known Implementing Classes:
  AndroidUsbCdcAcmTransport, AndroidUSBTransport, BluetoothTransportAndroid, BluetoothTransportBluecove, BluetoothTransportNative, SerialTransportTCP

    public interface SerialTransport

Method Summary
`void` `flush()` Take any actions necessary (possibly none) to remove unsent data from the output path.
`int` `getBaudRate()` Get the current baud rate of the communication channel.
`void` `open()` Causes the communication interface to be opened but does not transmit any serial-layer data.
`byte[]` `receiveBytes(int length, byte[] messageSpace, int offset, int timeoutMillis)` Receive a number of bytes on the serial transport.
`void` `sendBytes(int length, byte[] message, int offset, int timeoutMs)` Send bytes down the serial transport layer.
`void` `setBaudRate(int rate)` Set the current baud rate of the communication channel.
`void` `shutdown()` Close the communication channel.

Method Detail

### open

    void open()
              throws ReaderException

  Causes the communication interface to be opened but does not transmit any serial-layer data. This should perform actions such as opening a serial port device or establishing a network connection within a wrapper protocol.

  Throws:
    `ReaderException`

### sendBytes

    void sendBytes(int length,
                   byte[] message,
                   int offset,
                   int timeoutMs)
                   throws ReaderException

  Send bytes down the serial transport layer. No interpretation or modification occurs.

  Parameters:
    `message` - array containing the bytes to be sent
    `length` - number of bytes to send
    `offset` - position in array to send from
    `timeoutMs` - The duration to wait for the operation to complete.
  Throws:
    `ReaderException`

### receiveBytes

    byte[] receiveBytes(int length,
                        byte[] messageSpace,
                        int offset,
                        int timeoutMillis)
                        throws ReaderException

  Receive a number of bytes on the serial transport.

  Parameters:
    `length` - number of bytes to receive
    `messageSpace` - byte array to store the message in, or null to have one allocated
    `offset` - location in messageSpace to store bytes
    `timeoutMillis` - maximum duration to wait for a message
  Returns:
    the byte array with the number of bytes added
  Throws:
    `TimeoutException` - if timeoutMillis pass without a message being received
    `ReaderException`

### getBaudRate

    int getBaudRate()
                    throws ReaderException

  Get the current baud rate of the communication channel.

  Returns:
    the baud rate
  Throws:
    `ReaderException`

### setBaudRate

    void setBaudRate(int rate)
                     throws ReaderException

  Set the current baud rate of the communication channel.

  Parameters:
    `rate` - the baud rate to set
  Throws:
    `java.lang.IllegalArgumentException` - if the channel does not support the rate
    `ReaderException`

### flush

    void flush()
               throws ReaderException

  Take any actions necessary (possibly none) to remove unsent data from the output path.

  Throws:
    `ReaderException`

### shutdown

    void shutdown()
                  throws ReaderException

  Close the communication channel.

  Throws:
    `ReaderException`