public class SynchronousCommunication extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
SynchronousCommunication.Builder
Builder
|
static interface |
SynchronousCommunication.CheckResultInterface
Check result interface
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isUp()
Is communication up
|
void |
open()
Open the Serial Port
|
List<String> |
read(long timeout)
Read with timeout
|
List<String> |
read(long timeout,
@NonNull String receiveDelimiter)
Directly read from the serial port in case of asynchronous inputs
|
List<String> |
sendReceive(String msg,
long timeout)
Send and Receive Messages over Serial Port synchronously
|
String |
sendReceiveSingleLine(String msg,
long timeout)
Send and Receive Messages when a single line response is expected
|
void |
startHeartbeat(int samplingTime,
@NonNull Supplier<Boolean> connectionTester)
Start Heartbeat that probes the connection and reestablishes it
|
public void startHeartbeat(int samplingTime,
@NonNull
@NonNull Supplier<Boolean> connectionTester)
samplingTime - Minimum time interval to check if connection is upconnectionTester - Boolean check that indicates if connection nis healthypublic void close()
close in interface AutoCloseablepublic void open()
throws IOException
IOExceptionpublic boolean isUp()
public String sendReceiveSingleLine(String msg, long timeout) throws IOException
msg - Message to serialse and sendtimeout - timeout Timeout in [ms]IOExceptionpublic List<String> sendReceive(String msg, long timeout) throws IOException
msg - Message to serialise and sendtimeout - Timeout in [ms]IOExceptionpublic List<String> read(long timeout) throws IOException
timeout - the timeoutIOExceptionpublic List<String> read(long timeout, @NonNull @NonNull String receiveDelimiter) throws IOException
timeout - Timeout in [ms]IOExceptionCopyright © 2023 SiLA Java Developers. All rights reserved.