tuwien.auto.eicl.struct.cemi

Class CEMI_L_DATA

Implemented Interfaces:
CEMI

public class CEMI_L_DATA
extends java.lang.Object
implements CEMI

This class encapsulates a CEMI_L_DATA message. It has all necessary get and set methods for creating or extracting a CEMI_L_DATA message. Note that this class handles only standard frame formats, with application layer data up to 16 bytes. Frames with additional information are not supported. CEMI_L_DATA messages are typically sent and received through tunnelling connections.

Field Summary

static short
MC_L_DATACON
cEMI L_DATA_Confirmation
static short
MC_L_DATAIND
cEMI L_DATA_Indication
static short
MC_L_DATAREQ
cEMI L_DATA_Request
static byte
PRIORITY_LOW
cEMI Message with low priority
static byte
PRIORITY_NORMAL
cEMI Message with normal priority
static byte
PRIORITY_SYSTEM
cEMI Message with system priority
static byte
PRIORITY_URGENT
cEMI Message with urgent priority

Constructor Summary

CEMI_L_DATA(byte[] _CEMI)
Creates and parses a new CEMI_L_DATA frame out of a byte array.
CEMI_L_DATA(short _Messagecode, EIB_Address _Source, EIB_Address _Dest, byte[] _Data)
Creates a new CEMI_L_DATA frame.

Method Summary

boolean
getAcknowledgeRequested()
Checks whether the message was acknowledged by an endpoint.
byte[]
getData()
Get the CEMI_L_DATA application layer data (Message body).
EIB_Address
getDestinationAddress()
Get the CEMI_L_DATA destination address.
byte
getHopCount()
Get the message hop count.
short
getMessageCode()
Returns the CEMI_L_DATA message code.
byte
getPriority()
Get the message priority
EIB_Address
getSourceAddress()
Get the CEMI_L_DATA source address.
int
getStructLength()
Get the length of the message in bytes
boolean
isExtendedFrame()
Checks whether the frame is an extended or normal frame.
boolean
isPositiveConfirmation()
Returns bit 0 of control field 1 inverted.
boolean
isRepeatedFrame()
Returns the state of the repeat flag.
void
setAcknowledgeRequest(boolean _Boolean)
Sets the acknowledge requesting flag
void
setHopCount(byte _hopcount)
Set the message hop count.
void
setPriority(byte _Priority)
Set the message priority.
void
setRepeatFlag(boolean _Repeat)
Sets the repeat flag.
byte[]
toByteArray()
Returns the byte representation of this message.

Field Details

MC_L_DATACON

public static final short MC_L_DATACON
cEMI L_DATA_Confirmation
Field Value:
46

MC_L_DATAIND

public static final short MC_L_DATAIND
cEMI L_DATA_Indication
Field Value:
41

MC_L_DATAREQ

public static final short MC_L_DATAREQ
cEMI L_DATA_Request
Field Value:
17

PRIORITY_LOW

public static final byte PRIORITY_LOW
cEMI Message with low priority
Field Value:
-64

PRIORITY_NORMAL

public static final byte PRIORITY_NORMAL
cEMI Message with normal priority
Field Value:
64

PRIORITY_SYSTEM

public static final byte PRIORITY_SYSTEM
cEMI Message with system priority
Field Value:
0

PRIORITY_URGENT

public static final byte PRIORITY_URGENT
cEMI Message with urgent priority
Field Value:
-128

Constructor Details

CEMI_L_DATA

public CEMI_L_DATA(byte[] _CEMI)
            throws EICLException
Creates and parses a new CEMI_L_DATA frame out of a byte array. Only standard frames are supported
Parameters:
_CEMI - UDP message body
Throws:
EICLException - If the provided frame is not a standard frame an exception is thrown.

CEMI_L_DATA

public CEMI_L_DATA(short _Messagecode,
                   EIB_Address _Source,
                   EIB_Address _Dest,
                   byte[] _Data)
            throws EICLException
Creates a new CEMI_L_DATA frame. Only standard frames are accepted.
Parameters:
_Messagecode - CEMI_L_DATA message code
_Source - individual Source address
_Dest - destination address
_Data - message body (starting with transport layer control information)
Throws:
EICLException - if the TPDU byte array is larger than 16 bytes.
See Also:
EIB_Address

Method Details

getAcknowledgeRequested

public boolean getAcknowledgeRequested()
Checks whether the message was acknowledged by an endpoint.
Returns:
the acknowledge bit

getData

public byte[] getData()
Get the CEMI_L_DATA application layer data (Message body).
Specified by:
getData in interface CEMI
Returns:
application layer data

getDestinationAddress

public EIB_Address getDestinationAddress()
Get the CEMI_L_DATA destination address.
Returns:
Returns the destination address.

getHopCount

public byte getHopCount()
Get the message hop count.
Returns:
hop count

getMessageCode

public short getMessageCode()
Returns the CEMI_L_DATA message code. See constants.
Specified by:
getMessageCode in interface CEMI
Returns:
CEMI_L_DATA message code.

getPriority

public byte getPriority()
Get the message priority
Returns:
Returns the message priority

getSourceAddress

public EIB_Address getSourceAddress()
Get the CEMI_L_DATA source address.
Returns:
Returns the source address

getStructLength

public int getStructLength()
Get the length of the message in bytes
Specified by:
getStructLength in interface CEMI
Returns:
the message length

isExtendedFrame

public boolean isExtendedFrame()
Checks whether the frame is an extended or normal frame. In the current implementation this method always returns false.
Returns:
Is the current frame in extended frame format?

isPositiveConfirmation

public boolean isPositiveConfirmation()
Returns bit 0 of control field 1 inverted. Check this for a L_DATA_CON, to see whether the associated request was processed successfully.
Returns:
the confirmation bit

isRepeatedFrame

public boolean isRepeatedFrame()
Returns the state of the repeat flag. Especially relevant for L_Data indications. Note that a cEMI server should not pass incoming repeated frames to clients when it has already received (and passed on) the corresponding original, non-repeated frame.
Returns:
True if the repeat flag is 0 (zero), false otherwise.

setAcknowledgeRequest

public void setAcknowledgeRequest(boolean _Boolean)
Sets the acknowledge requesting flag
Parameters:
_Boolean - The flag value.

setHopCount

public void setHopCount(byte _hopcount)
Set the message hop count.
Parameters:
_hopcount - The routing counter value.

setPriority

public void setPriority(byte _Priority)
Set the message priority. See constants.
Parameters:
_Priority - Sets the message priority.

setRepeatFlag

public void setRepeatFlag(boolean _Repeat)
Sets the repeat flag. The repeat flag is considered a request for automatic retransmission on L_Data requests.
Parameters:
_Repeat - True to set the repeat flag 0 (repeated on medium/do not repeat on error). False to set the repeat flag 1 (not repeated on medium/don't care).

toByteArray

public byte[] toByteArray()
            throws EICLException
Returns the byte representation of this message. If an IOException occurred the EICLExcepiton is thrown.
Specified by:
toByteArray in interface CEMI
Throws:
EICLException - If an IOException occurs.