write

open override fun write(bytes: ByteArray, scope: CoroutineScope): Deferred<Int>

Writes the provided bytes to the serial port in an asynchronous manner.

Return

Deferred result containing the total bytes which were written to the serial port. May throw a cancellation exception

Parameters

bytes

Bytes to write to the serial port

scope

Coroutine scope within which to run this operation


open override fun write(bytes: ByteArray, timeout: Long, scope: CoroutineScope): Deferred<Int>

Writes the provided bytes to the serial port in an asynchronous manner.

Return

Deferred result containing the total bytes which were written to the serial port. May throw a cancellation exception

Parameters

bytes

Bytes to write to the serial port

timeout

Time to wait in milliseconds before aborting the request prematurely

scope

Coroutine scope within which to run this operation


open suspend override fun write(bytes: ByteArray): Int

Writes the provided bytes to the serial port.

Parameters

bytes

Bytes to write to the serial port

Throws

CancellationException

If operation takes longer than the time specified by defaultWriteTimeout


open suspend override fun write(bytes: ByteArray, timeout: Long): Int

Writes the provided bytes to the serial port.

Parameters

bytes

Bytes to write to the serial port

timeout

Time to wait in milliseconds before aborting the request prematurely

Throws

CancellationException

If operation takes longer than the time specified by timeout