fix async port receive

This commit is contained in:
Alexander Nozik 2023-05-27 22:55:21 +03:00
parent 22359a5570
commit 9c39f44897

View File

@ -2,6 +2,7 @@ package space.kscience.controls.serial
import jssc.SerialPort.*
import jssc.SerialPortEventListener
import kotlinx.coroutines.launch
import space.kscience.controls.ports.AbstractPort
import space.kscience.controls.ports.Port
import space.kscience.controls.ports.PortFactory
@ -27,7 +28,7 @@ public class SerialPort private constructor(
if (event.isRXCHAR) {
val chars = event.eventValue
val bytes = jssc.readBytes(chars)
receive(bytes)
scope.launch { receive(bytes) }
}
}