Class Iec21Port

java.lang.Object
org.openmuc.j62056.Iec21Port

public class Iec21Port extends Object
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.
  • Method Details

    • getSerialPort

      public final org.openmuc.jrxtx.SerialPort getSerialPort()
    • getOutputStream

      public final DataOutputStream getOutputStream()
    • getInputStream

      public final DataInputStream 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

      public DataMessage read() throws IOException
      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

      public void listen(ModeDListener listener) throws IOException
      Listen for mode D messages.
      Parameters:
      listener - A listener for mode D messages
      Throws:
      IOException - throws IOException