tuwien.auto.calimero.knxnetip.util
Class TunnelCRD

java.lang.Object
  extended by tuwien.auto.calimero.knxnetip.util.CRD
      extended by tuwien.auto.calimero.knxnetip.util.TunnelCRD

public class TunnelCRD
extends CRD

Connection response data used for KNX tunneling connection.


Constructor Summary
TunnelCRD(byte[] data, int offset)
          Creates a new CRD for tunnel connection type out of a byte array.
TunnelCRD(IndividualAddress addr)
          Creates a new CRD for tunnel connection type containing the given address information.
 
Method Summary
 IndividualAddress getAssignedAddress()
          Returns the assigned address for the tunneling connection.
 short getConnectionType()
          Returns the used connection type code.
 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 CRD.
 
Methods inherited from class tuwien.auto.calimero.knxnetip.util.CRD
createResponse, createResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TunnelCRD

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

The CRD structure has a length of 4 bytes.

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

TunnelCRD

public TunnelCRD(IndividualAddress addr)
Creates a new CRD for tunnel connection type containing the given address information.

Parameters:
addr - individual address assigned to the tunneling connection
Method Detail

getAssignedAddress

public final IndividualAddress getAssignedAddress()
Returns the assigned address for the tunneling connection.

Returns:
individual address as IndividualAddress

toString

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

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