Class Iec21Layer
- java.lang.Object
-
- org.openmuc.jdlms.transportlayer.client.Iec21Layer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,TransportLayer
,StreamAccessor
public class Iec21Layer extends java.lang.Object implements TransportLayer
This class represents a connection on the physical layer according to IEC 62056-21 in protocol mode E.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Iec21Layer.DataFlowControl
-
Constructor Summary
Constructors Constructor Description Iec21Layer(SerialSettings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.io.DataInputStream
getInputStream()
Returns the input stream for this stream accessor.java.io.DataOutputStream
getOutpuStream()
Returns the output stream for this stream accessor.boolean
isClosed()
Status of the connection/transport layer.void
open()
Opens the physical layer.void
setTimeout(int timeout)
Enable/disable TIMEOUT with the specified timeout, in milliseconds.
-
-
-
Constructor Detail
-
Iec21Layer
public Iec21Layer(SerialSettings settings)
-
-
Method Detail
-
setTimeout
public void setTimeout(int timeout) throws java.io.IOException
Description copied from interface:StreamAccessor
Enable/disable TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on theInputStream
m associated with this StreamAcessor will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be> 0
. A timeout of zero is interpreted as an infinite timeout.- Specified by:
setTimeout
in interfaceStreamAccessor
- Parameters:
timeout
- the specified timeout, in milliseconds.- Throws:
java.io.IOException
- if there is an error in the underlying protocol, such as a TCP error.
-
getInputStream
public java.io.DataInputStream getInputStream() throws java.io.IOException
Description copied from interface:StreamAccessor
Returns the input stream for this stream accessor.- Specified by:
getInputStream
in interfaceStreamAccessor
- Returns:
- the input stream.
- Throws:
java.io.IOException
- an I/O error accessing the input stream, the stream accessor is closed, the stream accessor is not connected.
-
getOutpuStream
public java.io.DataOutputStream getOutpuStream() throws java.io.IOException
Description copied from interface:StreamAccessor
Returns the output stream for this stream accessor.- Specified by:
getOutpuStream
in interfaceStreamAccessor
- Returns:
- the output stream.
- Throws:
java.io.IOException
- an I/O error accessing the output stream, the stream accessor is closed, the stream accessor is not connected.
-
isClosed
public boolean isClosed()
Description copied from interface:TransportLayer
Status of the connection/transport layer.- Specified by:
isClosed
in interfaceTransportLayer
- Returns:
true
if the connection is closesfalse
otherwhise.
-
open
public void open() throws java.io.IOException
Description copied from interface:TransportLayer
Opens the physical layer.- Specified by:
open
in interfaceTransportLayer
- Throws:
java.io.IOException
- if an error occurred opening the stream.
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceStreamAccessor
-
-