features:
- new
SerialTimeoutException
class - new
getReadEndpoint()
andgetWriteEndpoint()
methods inCommonUsbSerialPort
class - distinguish generic IO error and timeout in
write()
- Return type of
write()
method changed to void. The return value was redundant before, as it was always the request length or an exception was thrown - If timeout is reached,
write()
now throws aSerialTimeoutException
withex.bytesTransferred
filled with known transferred bytes - Optimal write buffer size can be set with
port.setWriteBufferSize(port.getWriteEndpoint().getMaxPacketSize())
- By default the write buffer size is > MaxPacketSize and the Linux kernel splits writes in chunks. When the timeout occurs, it's unknown how many chunks have already been transferred and 0 is returned in
SerialTimeoutException.bytesTransferred
. With optimal write buffer size, this value is known and returned inSerialTimeoutException.bytesTransferred
as the chunking is done in this library, but due to more kernel round trips write() might take slightly longer and cause more CPU load
- Return type of
- introduced IntDef annotation
@Parity
atsetParameters(..., @Parity int parity)
parameter for better warnings - disable debug logging in
SerialInputOutputManager
by default. Can be enabled withpublic static boolean DEBUG;
fixes:
- set thread priority in
SerialInputOutputManager.run
- improve error handling in
close
changes:
- Return type of
write()
method changed to void. The return value was redundant before, as it was always the request length or an exception was thrown