SerialCommunication

Wrapper layer for the native serial port communication functions.
For information on how to use {@link SerialCommunication} see {@link Com}.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
open override fun connect(baudRate: Com.BaudRates?): Boolean
open override fun connect(baudRate: Com.BaudRates?, stopBits: Com.StopBits?, dataBits: Com.DataBits?, parity: Com.Parity?): Boolean

Connect to the serial port.

Link copied to clipboard
open override fun disconnect()

Disconnect the connected port.

Link copied to clipboard
open override fun isOpened(): Boolean

Check if serial communication port is open.

Link copied to clipboard
open override fun read(data: ByteArray?, length: Int): Int

Read data from the serial communication port. Timeout default 3 seconds.

open override fun read(data: ByteArray?, length: Int, timeout: Int): Int

Read data from the serial communication port.

Link copied to clipboard
open override fun setDataAvailableCallback(dataAvailable: DataAvailable?)

Set data available callback for the application layer.

Link copied to clipboard
open override fun write(data: ByteArray?, length: Int): Int

Write data to the serial communication port. Timeout default 3 seconds.

open override fun write(data: ByteArray?, length: Int, timeout: Int): Int

Write data to the serial communication port.