|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.knxnetip.util.CRD
public class CRD
Immutable container for connection response data (CRD).
The CRD structure is returned by a connection response, and contains information
regarding the established communication.
It contains description data of a specific connection type. A CRD is built up of host
protocol independent data and host protocol dependent data, both optional. Refer to the
available subtypes for more specific type information.
For now, a plain CRD is returned for management connections, since this connection type doesn't require any additional host protocol data.
Factory methods are provided for creation of CRD objects.
ConnectResponse
Constructor Summary | |
---|---|
CRD(byte[] data,
int offset)
Creates a new CRD out of a byte array. |
|
CRD(short connectionType,
byte[] optionalData)
Creates a new CRD for the given connection type. |
Method Summary | |
---|---|
static CRD |
createResponse(byte[] data,
int offset)
Creates a new CRD out of a byte array. |
static CRD |
createResponse(short connectionType,
byte[] optionalData)
Creates a CRD for the given connection type. |
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 the connection type, length and optional data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CRD(byte[] data, int offset) throws KNXFormatException
data
- byte array containing a CRD structureoffset
- start offset of CRD in data
KNXFormatException
- if no CRD found or invalid structurepublic CRD(short connectionType, byte[] optionalData)
The array of optionalData
is not copied for internal storage. No
additional checks regarding content are done.
connectionType
- connection type the description is intended foroptionalData
- byte array containing optional host protocol independent and
dependent data, this information is located starting at offset 2 in the CRD
structure, optionalData.length
< 254Method Detail |
---|
public static CRD createResponse(byte[] data, int offset) throws KNXFormatException
If possible, a matching, more specific, CRD subtype is returned. Note, that CRD for
specific communication types might expect certain characteristics on
data
(regarding contained data).
data
- byte array containing the CRD structureoffset
- start offset of CRD in data
KNXFormatException
- if no CRD found or invalid structurepublic static CRD createResponse(short connectionType, byte[] optionalData)
If possible, a matching, more specific, CRD subtype is returned. Note, that CRD for
specific communication types might expect certain characteristics on
optionalData
(regarding length and/or content).
connectionType
- connection type this CRD is used for (e.g. tunnel connection)optionalData
- byte array containing optional host protocol independent and
dependent data, this information is located starting at offset 2 in the CRD
structure, optionalData.length
< 254, may be
null
for no optional data
public final short getConnectionType()
public final byte[] getOptionalData()
Optional data starts at offset 2 in the CR structure.
public final short getStructLength()
public byte[] toByteArray()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |