|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.DataUnitBuilder
public final class DataUnitBuilder
Creates, extracts and decodes information of protocol data units.
The methods focus on transport layer and application layer data units.
Field Summary | |
---|---|
static java.lang.String |
LOG_SERVICE
Name of the log service used by data-unit builder methods. |
Method Summary | |
---|---|
static byte[] |
createAPDU(int service,
byte[] asdu)
Creates an application layer protocol data unit out of a service code and a service data unit. |
static byte[] |
createCompactAPDU(int service,
byte[] asdu)
Creates a compact application layer protocol data unit out of a service code and a service data unit. |
static java.lang.String |
decode(byte[] tpdu,
KNXAddress dst)
Decodes a protocol data unit into a textual representation. |
static java.lang.String |
decodeAPCI(int apci)
Decodes an application layer protocol control information into a textual representation. |
static java.lang.String |
decodeTPCI(int tpci,
KNXAddress dst)
Decodes a transport layer protocol control information into a textual representation. |
static byte[] |
extractASDU(byte[] apdu)
Returns a copy of the ASDU contained in the supplied APDU. |
static int |
getAPDUService(byte[] apdu)
Returns the application layer service of a given protocol data unit. |
static int |
getTPDUService(byte[] tpdu)
Returns the transport layer service of a given protocol data unit. |
static java.lang.String |
toHex(byte[] data,
java.lang.String sep)
Returns the content of data as unsigned bytes in hexadecimal string
representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LOG_SERVICE
Method Detail |
---|
public static byte[] createAPDU(int service, byte[] asdu)
The transport layer bits in the first byte (TL / AL control field) are set 0. For
creating a compact APDU, refer to createCompactAPDU(int, byte[])
.
service
- application layer service codeasdu
- application layer service data unit, asdu.length
<
255
public static byte[] createCompactAPDU(int service, byte[] asdu)
The transport layer bits in the first byte (TL / AL control field) are set 0. If
the compact APDU shall not contain any ASDU information, asdu
can be
left null
.
service
- application layer service codeasdu
- application layer service data unit, asdu.length
<
255; or null
for no ASDU
public static java.lang.String decode(byte[] tpdu, KNXAddress dst)
Currently, the transport layer protocol control information (TPCI) and the
application layer protocol control information (APCI) is decoded. Decoding might be
extended in the future.
The optional KNX destination address helps to determine the exact transport layer
service.
tpdu
- transport layer protocol data unit to decodedst
- KNX destination address belonging to the TPDU, might be
null
public static java.lang.String decodeAPCI(int apci)
apci
- application layer protocol control information
public static java.lang.String decodeTPCI(int tpci, KNXAddress dst)
tpci
- transport layer protocol control informationdst
- KNX destination address belonging to the tpci, might be
null
public static byte[] extractASDU(byte[] apdu)
The application layer service data unit (ASDU) is the APDU with the application layer service code removed.
apdu
- application layer protocol data unit for which to get the ASDU
public static int getAPDUService(byte[] apdu)
apdu
- application layer protocol data unit
public static int getTPDUService(byte[] tpdu)
tpdu
- transport layer protocol data unit
public static java.lang.String toHex(byte[] data, java.lang.String sep)
data
as unsigned bytes in hexadecimal string
representation.
This method does not add hexadecimal prefixes (like 0x).
data
- data array to formatsep
- separator to insert between 2 formatted data bytes, null
or "" for no gap between byte tokens
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |