tuwien.auto.calimero.knxnetip.util
Class TunnelCRI

java.lang.Object
  extended by tuwien.auto.calimero.knxnetip.util.CRI
      extended by tuwien.auto.calimero.knxnetip.util.TunnelCRI

public class TunnelCRI
extends CRI

Connection request information used for KNX tunneling connection.


Constructor Summary
TunnelCRI(byte[] data, int offset)
          Creates a new CRI for tunnel connection type out of a byte array.
TunnelCRI(short KNXLayer)
          Creates a new CRI for tunnel connection type on the given KNX layer.
 
Method Summary
 short getConnectionType()
          Returns the used connection type code.
 short getKNXLayer()
          Returns the KNX tunneling layer.
 byte[] getOptionalData()
          Returns a copy of the optional data field.
 short getStructLength()
          Returns the structure length of this CR in bytes.
 byte[] toByteArray()
          Returns the byte representation of the whole CR structure.
 java.lang.String toString()
          Returns a textual representation of this tunnel CRI.
 
Methods inherited from class tuwien.auto.calimero.knxnetip.util.CRI
createRequest, createRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TunnelCRI

public TunnelCRI(byte[] data,
                 int offset)
          throws KNXFormatException
Creates a new CRI for tunnel connection type out of a byte array.

The CRI structure has a length of 4 bytes.

Parameters:
data - byte array containing a CRI structure, data.length - offset = 4
offset - start offset of CRI in data
Throws:
KNXFormatException - if no CRI found or invalid structure

TunnelCRI

public TunnelCRI(short KNXLayer)
Creates a new CRI for tunnel connection type on the given KNX layer.

Parameters:
KNXLayer - KNX layer specifying the kind of tunnel (e.g. link layer tunnel)
Method Detail

getKNXLayer

public final short getKNXLayer()
Returns the KNX tunneling layer.

Returns:
layer value as unsigned byte

toString

public java.lang.String toString()
Returns a textual representation of this tunnel CRI.

Returns:
a string representation of the object

getConnectionType

public final short getConnectionType()
Returns the used connection type code.

Returns:
connection type as unsigned byte

getOptionalData

public final byte[] getOptionalData()
Returns a copy of the optional data field.

Optional data starts at offset 2 in the CR structure.

Returns:
byte array with optional data

getStructLength

public final short getStructLength()
Returns the structure length of this CR in bytes.

Returns:
structure length as unsigned byte

toByteArray

public byte[] toByteArray()
Returns the byte representation of the whole CR structure.

Returns:
byte array containing structure