Package org.openmuc.j62056
Class Iec21Port
java.lang.Object
org.openmuc.j62056.Iec21Port
Represents a serial communication port that can be used to read meters using IEC 62056-21 modes A, B, C or D. Create
and open a port using
Iec21Port.Builder
.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this communication port.final DataInputStream
final DataOutputStream
final org.openmuc.jrxtx.SerialPort
boolean
isClosed()
Returns true if this port has been closed.void
listen
(ModeDListener listener) Listen for mode D messages.read()
Requests meter data and returns the response.
-
Method Details
-
getSerialPort
public final org.openmuc.jrxtx.SerialPort getSerialPort() -
getOutputStream
-
getInputStream
-
close
public void close()Closes this communication port. Also closes the associated serial port, input stream and output stream.The port cannot be opened again but has to be recreated.
-
read
Requests meter data and returns the response.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.
- Returns:
- The response data message.
- Throws:
IOException
- if any kind of IO error occurs
-
isClosed
public boolean isClosed()Returns true if this port has been closed.- Returns:
- true if this port has been closed
-
listen
Listen for mode D messages.- Parameters:
listener
- A listener for mode D messages- Throws:
IOException
- throws IOException
-