public class Iec21Layer extends java.lang.Object implements TransportLayer
Modifier and Type | Class and Description |
---|---|
static class |
Iec21Layer.DataFlowControl |
Constructor and Description |
---|
Iec21Layer(SerialSettings settings) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.io.InputStream |
getInputStream()
Returns the input stream for this stream accessor.
|
java.io.OutputStream |
getOutpuStream()
Returns the output stream for this stream accessor.
|
boolean |
isClosed()
Status of the connection/transport layer.
|
void |
open()
Opens the physical layer.
|
void |
send(byte[] data) |
void |
setTimeout(int timeout)
Enable/disable TIMEOUT with the specified timeout, in milliseconds.
|
public Iec21Layer(SerialSettings settings)
public void setTimeout(int timeout) throws java.io.IOException
StreamAccessor
InputStream
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.setTimeout
in interface StreamAccessor
timeout
- the specified timeout, in milliseconds.java.io.IOException
- if there is an error in the underlying protocol, such as a TCP error.public java.io.InputStream getInputStream() throws java.io.IOException
StreamAccessor
getInputStream
in interface StreamAccessor
java.io.IOException
- an I/O error accessing the input stream, the stream accessor is closed, the stream accessor is not
connected.public java.io.OutputStream getOutpuStream() throws java.io.IOException
StreamAccessor
getOutpuStream
in interface StreamAccessor
java.io.IOException
- an I/O error accessing the output stream, the stream accessor is closed, the stream accessor is not
connected.public boolean isClosed()
TransportLayer
isClosed
in interface TransportLayer
true
if the connection is closes false
otherwhise.public void open() throws java.io.IOException
TransportLayer
open
in interface TransportLayer
java.io.IOException
- if an error occurred opening the stream.public void send(byte[] data) throws java.io.IOException
java.io.IOException
public void close()
close
in interface java.lang.AutoCloseable
close
in interface StreamAccessor