org.openmuc.jsml.tl
public class SML_TConnection extends java.lang.Object
Constructor and Description |
---|
SML_TConnection(java.net.Socket socket,
int messageTimeout,
int messageFragmentTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static int |
crc16(byte[] bytes)
calculates crc16 as specified by DIN EN 62056-46
|
static int |
crc16(byte[] bytes,
int length)
calculates crc16 from element 0 to length-1 as specified by DIN EN 62056-46
|
void |
disconnect() |
SML_File |
receive() |
void |
send(byte[] smlPackage) |
void |
sendAttentionResponse(OctetString attentionType,
java.lang.String message,
OctetString serverID,
SML_Message faultyMessage,
java.net.Socket socket)
sends an SML_AttentionRes with sock
|
void |
setMessageFragmentTimeout(int messageFragmentTimeout)
Set the TConnection timeout for receiving data once the beginning of a message has been received.
|
void |
setMessageTimeout(int messageTimeout)
Set the TConnection timeout for waiting for the first byte of a new message.
|
public SML_TConnection(java.net.Socket socket, int messageTimeout, int messageFragmentTimeout) throws java.io.IOException
java.io.IOException
public static int crc16(byte[] bytes)
bytes
- public static int crc16(byte[] bytes, int length)
bytes
- length
- bytes in array to take for calculationpublic void send(byte[] smlPackage) throws java.io.IOException
java.io.IOException
public void sendAttentionResponse(OctetString attentionType, java.lang.String message, OctetString serverID, SML_Message faultyMessage, java.net.Socket socket)
attentionType
- see SML_AttentionResmessage
- OPTIONAL human readable messageserverID
- id of this machinefaultyMessage
- the SML_Message which caused this attentionResponsesocket
- socket from which the faulty message was received, to answer on the samepublic SML_File receive() throws java.io.IOException
java.io.IOException
public void disconnect()
public void setMessageTimeout(int messageTimeout) throws java.net.SocketException
messageTimeout
- in millisecondsjava.net.SocketException
public void setMessageFragmentTimeout(int messageFragmentTimeout) throws java.net.SocketException
messageFragmentTimeout
- in millisecondsjava.net.SocketException
public void close()