|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.cemi.CEMILData
public class CEMILData
A cEMI link layer data message (L-Data).
Only standard frame formats are supported, with a transport layer protocol data unit of 16 bytes maximum. Additional information in the message structure is not supported.
Objects of this L-Data type are immutable.
Field Summary | |
---|---|
protected short |
ctrl1
Control field 1, the lower 8 bits contain control information. |
protected short |
ctrl2
Control field 2, the lower 8 bits contain control information. |
protected short |
mc
Message code of this message. |
static short |
MC_LDATA_CON
Message code for L-Data confirmation, code = 46. |
static short |
MC_LDATA_IND
Message code for L-Data indication, code = 41. |
static short |
MC_LDATA_REQ
Message code for L-Data request, code = 17. |
Constructor Summary | |
---|---|
|
CEMILData(byte[] data,
int offset)
Creates a new L-Data message from a byte stream. |
|
CEMILData(int msgCode,
IndividualAddress src,
KNXAddress dst,
byte[] tpdu,
Priority p)
Creates a L-Data message with most control information set to default values. |
|
CEMILData(int msgCode,
IndividualAddress src,
KNXAddress dst,
byte[] tpdu,
Priority p,
boolean confirm)
Creates a L-Data message, mainly for confirmation. |
protected |
CEMILData(int msgCode,
IndividualAddress src,
KNXAddress dst,
byte[] tpdu,
Priority p,
boolean repeat,
boolean broadcast,
boolean ack,
int hopCount)
Creates a L-Data message with full customization for control information. |
|
CEMILData(int msgCode,
IndividualAddress src,
KNXAddress dst,
byte[] tpdu,
Priority p,
boolean repeat,
int hopCount)
Creates a L-Data message, mainly for TP1 media. |
Method Summary | |
---|---|
KNXAddress |
getDestination()
Returns the KNX destination address. |
byte |
getHopCount()
Returns the hop count set in the control information. |
short |
getMessageCode()
Returns the cEMI message code. |
byte[] |
getPayload()
Returns the L-Data TPDU. |
Priority |
getPriority()
Returns the message priority. |
IndividualAddress |
getSource()
Returns the KNX individual source address. |
short |
getStructLength()
Returns the length of this cEMI message frame. |
boolean |
isAckRequested()
Returns whether L2 acknowledge was requested. |
boolean |
isPositiveConfirmation()
Returns if confirmation indicates success or error in a confirmation message. |
boolean |
isRepetition()
Returns whether frame repetition is requested, or this is a repeated frame. |
byte[] |
toByteArray()
Returns the byte representation of the whole cEMI message structure. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected short ctrl1
protected short ctrl2
protected short mc
public static final short MC_LDATA_CON
public static final short MC_LDATA_IND
public static final short MC_LDATA_REQ
Constructor Detail |
---|
public CEMILData(byte[] data, int offset) throws KNXFormatException
data
- byte stream containing a cEMI L-Data messageoffset
- start offset of cEMI frame in data
KNXFormatException
- if no (valid) frame was found or the provided frame is
not a standard framepublic CEMILData(int msgCode, IndividualAddress src, KNXAddress dst, byte[] tpdu, Priority p)
The initialized message has send repetitions according to default medium behavior
(for indication message this equals "not repeated frame"), broadcast is "don't
care", acknowledge request is default medium behavior, hop count is 6 and
confirmation request is "don't care" in the control field.
msgCode
- a message code value specified in the L-Data typesrc
- individual address of sourcedst
- destination addresstpdu
- data array, starting with the TPCI / APCI (transport / application
layer protocol control information), i.e. the NPDU without the length field,
tpdu.length <= 16p
- message priority, priority set in the control fieldpublic CEMILData(int msgCode, IndividualAddress src, KNXAddress dst, byte[] tpdu, Priority p, boolean confirm)
The message hop count is set to 6, send repetitions according to default medium
behavior, broadcast and acknowledge request are set to "don't care" in the control
field.
msgCode
- a message code value specified in the L-Data typesrc
- individual address of sourcedst
- destination addresstpdu
- data array, starting with the TPCI / APCI (transport / application
layer protocol control information); i.e. the NPDU without the length field,
tpdu.length <= 16p
- message priority, priority set in the control fieldconfirm
- confirm flag in the control field, true
to set error,
false
for no errorprotected CEMILData(int msgCode, IndividualAddress src, KNXAddress dst, byte[] tpdu, Priority p, boolean repeat, boolean broadcast, boolean ack, int hopCount)
The confirmation flag of the control field is left out, since it is mutual
exclusive with the rest of the control information and set to "don't care" (refer
to
CEMILData(int, IndividualAddress, KNXAddress, byte[], Priority, boolean)
).
msgCode
- a message code value specified in the L-Data typesrc
- individual address of sourcedst
- destination addresstpdu
- data array, starting with the TPCI / APCI (transport / application
layer protocol control information), i.e. the NPDU without the length field,
tpdu.length <= 16p
- message priority, priority set in the control fieldrepeat
- for request messages, send repetitions on the medium -
false
for do not repeat if error, true
for
default repeat behavior;true
if is repeated frame,
false
otherwisebroadcast
- system / domain broadcast behavior, applicable on open media only:
false
for system broadcast, true
for
broadcast; on closed media set true
for "don't care"ack
- acknowledge request, true
if acknowledge is requested,
false
for default behavior;hopCount
- hop count starting value set in control field, in the range 0 <=
value <= 7public CEMILData(int msgCode, IndividualAddress src, KNXAddress dst, byte[] tpdu, Priority p, boolean repeat, int hopCount)
msgCode
- a message code value specified in the L-Data typesrc
- individual address of sourcedst
- destination addresstpdu
- data array, starting with the TPCI / APCI (transport / application
layer protocol control information), i.e. the NPDU without the length field,
tpdu.length <= 16p
- message priority, priority set in the control fieldrepeat
- for request message, send repetitions on the medium -
false
for do not repeat if error, true
for
default repeat behavior;true
if is repeated frame,
false
otherwisehopCount
- hop count starting value set in control field, in the range 0 <=
value <= 7Method Detail |
---|
public final KNXAddress getDestination()
public final byte getHopCount()
The hop count value is in the range 0 <= value <= 7.
public final short getMessageCode()
CEMI
The codes of the different cEMI message types can be looked up in the according subtype implementations.
getMessageCode
in interface CEMI
public final byte[] getPayload()
The returned array is the NPDU without the length field of the message structure, starting with the TPCI / APCI field.
getPayload
in interface CEMI
public final Priority getPriority()
Priority
public final IndividualAddress getSource()
public short getStructLength()
CEMI
getStructLength
in interface CEMI
public final boolean isAckRequested()
This information is valid in L-Data requests and partially in L-Data indications; for L-Data confirmations the value behavior is undefined (it might have the same value like the corresponding request).
For requests the following returns apply:
If true
, acknowledge was requested explicitly, false
for "don't care" (default medium behavior).
Default behavior on media for L2 ack:
For indication messages following media behavior applies:
public final boolean isPositiveConfirmation()
If return is true
(confirmation bit in control field is 0 for no
error), the associated request message to this confirmation was transmitted
successfully, false
otherwise (confirmation bit in control field is
1 for error).
On messages types other than confirmation, this information is "don't care" and
always returns true
.
public final boolean isRepetition()
For request messages, returns false
for do not repeat if error,
true
for default repeat behavior.
Meaning of default behavior on media:
For indication messages, returns false
if this is not a repeated
frame, true
if repeated frame.
For L-Data confirmations the value behavior is undefined (it might have the same value like the corresponding request).
public byte[] toByteArray()
CEMI
toByteArray
in interface CEMI
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 |