-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class SerialPortConnection implements Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSerialPortConnection.Companion
-
Field Summary
Fields Modifier and Type Field Description private final FileInputStreaminputStreamprivate final FileOutputStreamoutputStreamprivate final Flow<ByteArray>readFlow
-
Constructor Summary
Constructors Constructor Description SerialPortConnection(FileDescriptor fd)
-
Method Summary
Modifier and Type Method Description final FileInputStreamgetInputStream()final FileOutputStreamgetOutputStream()final Flow<ByteArray>getReadFlow()A hot flow that emits data as it arrives from the serial port. final <ERROR CLASS>write(ByteArray data)Writes data to the serial port in a thread-safe manner (handled by OS/Stream). Unitclose()-
-
Constructor Detail
-
SerialPortConnection
SerialPortConnection(FileDescriptor fd)
-
-
Method Detail
-
getInputStream
final FileInputStream getInputStream()
-
getOutputStream
final FileOutputStream getOutputStream()
-
getReadFlow
final Flow<ByteArray> getReadFlow()
A hot flow that emits data as it arrives from the serial port. This flow runs on Dispatchers.IO.
Note: This is a hot flow - collectors that join after data has been emitted will miss that data. Consider using SharedFlow if you need multiple collectors.
-
write
final <ERROR CLASS> write(ByteArray data)
Writes data to the serial port in a thread-safe manner (handled by OS/Stream). This function suspends to offload the blocking I/O to Dispatchers.IO.
-
-
-
-