public class Iec21Port
extends java.lang.Object
Iec21Port.Builder
.Modifier and Type | Class and Description |
---|---|
static class |
Iec21Port.Builder
A builder for Iec21Ports.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this communication port.
|
boolean |
isClosed()
Returns true if this port has been closed.
|
void |
listen(ModeDListener listener)
Listen for mode D messages.
|
DataMessage |
read()
Requests meter data and returns the response.
|
public void close()
The port cannot be opened again but has to be recreated.
public DataMessage read() throws java.io.IOException, java.io.InterruptedIOException
Requests a data message from the remote device using IEC 62056-21 Mode A, B or C. The data message received is parsed and returned. The returned data message also contains some information fields from the identification message sent by the meter.
java.io.IOException
- if any kind of IO error occursjava.io.InterruptedIOException
- if a timeout is thrown while waiting for the meter responsepublic boolean isClosed()
public void listen(ModeDListener listener) throws java.io.IOException
listener
- A listener for mode D messagesjava.io.IOException
- throws IOException