|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.cemi.CEMIDevMgmt
public class CEMIDevMgmt
A cEMI device management message.
Function properties are not supported for the time being.
Objects of this type are immutable.
Field Summary | |
---|---|
static short |
MC_PROPINFO_IND
Message code for property info indication, code = 247. |
static short |
MC_PROPREAD_CON
Message code for property read confirmation, code = 251. |
static short |
MC_PROPREAD_REQ
Message code for property read request, code = 252. |
static short |
MC_PROPWRITE_CON
Message code for property write confirmation, code = 245. |
static short |
MC_PROPWRITE_REQ
Message code for property write request, code = 246. |
static short |
MC_RESET_IND
Message code for property reset indication, code = 240. |
static short |
MC_RESET_REQ
Message code for property reset request, code = 241. |
Constructor Summary | |
---|---|
CEMIDevMgmt(byte[] data,
int offset,
int length)
Creates a new device management message from a byte stream. |
|
CEMIDevMgmt(int msgCode)
Creates a new device management message with the given message code. |
|
CEMIDevMgmt(int msgCode,
int objType,
int objInstance,
int propID,
int startIndex,
int elements)
Creates a new device management message. |
|
CEMIDevMgmt(int msgCode,
int objType,
int objInstance,
int propID,
int startIndex,
int elements,
byte[] data)
Creates a new device management message. |
Method Summary | |
---|---|
byte |
getElementCount()
Returns the number of elements field from the message. |
java.lang.String |
getErrorMessage()
Returns a descriptive error message on a negative response, as determined by isNegativeResponse() . |
short |
getMessageCode()
Returns the cEMI message code. |
short |
getObjectInstance()
Returns the object instance field from the message. |
int |
getObjectType()
Returns the interface object type. |
byte[] |
getPayload()
Returns the data part, i.e. the property data or error information following the start index in the message structure. |
short |
getPID()
Returns the property identifier used in the message. |
short |
getStartIndex()
Returns the start index in the data array of the property. |
short |
getStructLength()
Returns the length of this cEMI message frame. |
boolean |
isNegativeResponse()
Returns if the message contains a negative response. |
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 |
---|
public static final short MC_PROPINFO_IND
public static final short MC_PROPREAD_CON
public static final short MC_PROPREAD_REQ
public static final short MC_PROPWRITE_CON
public static final short MC_PROPWRITE_REQ
public static final short MC_RESET_IND
public static final short MC_RESET_REQ
Constructor Detail |
---|
public CEMIDevMgmt(byte[] data, int offset, int length) throws KNXFormatException
data
- byte stream containing a cEMI device management messageoffset
- start offset of cEMI frame in data
length
- length in bytes of the whole device management message
KNXFormatException
- if no device management frame found or invalid frame
structurepublic CEMIDevMgmt(int msgCode)
The message structure (and resulting frame) will only consist of the message code field. All other device management methods are not used (and will consequently return 0 or empty fields by default).
Used for reset messages.
msgCode
- a message code value specified by this classpublic CEMIDevMgmt(int msgCode, int objType, int objInstance, int propID, int startIndex, int elements)
Used for messages without a data (or error information) part in the message structure (like read request).
msgCode
- a message code constant declared by this classobjType
- interface object type, value in the range 0 <= value <= 0xFFFFobjInstance
- object instance, value in the range 1 <= value <= 0xFFpropID
- property identifier (PID), in the range 0 <= PID <= 0xFFstartIndex
- start index into the property array, first element value has
index 1, index 0 in the property contains the current number of valid
elements (read only)elements
- number of elements in the array of the property, in the range 1
<= elements <= 0xFF;public CEMIDevMgmt(int msgCode, int objType, int objInstance, int propID, int startIndex, int elements, byte[] data)
Used for messages containing a data (or error information) part in the message structure (like read confirmation).
msgCode
- a message code constant declared by this classobjType
- interface object type, value in the range 0 <= value <= 0xFFFFobjInstance
- object instance, value in the range 1 <= value <= 0xFFpropID
- property identifier (PID), in the range 0 <= PID <= 0xFFstartIndex
- start index in the property, first element has index 1, index 0
in the property contains the current number of valid elements (read only)elements
- number of elements in the array of the property, in the range 0
<= elements <= 0xFF; the number 0 is used to indicate a negative
responsedata
- contains the data (or the error information, if numElems = 0) as byte
arrayMethod Detail |
---|
public final byte getElementCount()
An element count in the range 1 to 15 indicates the presence of element data. A
value of 0 indicates a negative response.
If the message structure does not contain this field, 0 is returned.
public java.lang.String getErrorMessage()
isNegativeResponse()
.
A negative response contains an error information code, which is used to find the
associated message.
If invoked on positive response, "no error" will be returned.
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 short getObjectInstance()
The instance value is in the range 1 to 0xFF.
If the message structure does not contain this field, 0 is returned.
public final int getObjectType()
For example,
public final byte[] getPayload()
The property content depends on the property data type, and in case of an array structured property value also on the accessed number of array elements.
In case of a message carrying a negative response, the payload holds error
information. To determine whether the returned array contains error information,
use isNegativeResponse()
.
If the message does not contain any data (or error information), a byte array with
length 0 is returned.
getPayload
in interface CEMI
public final short getPID()
If the message structure does not contain this field, 0 is returned.
public final short getStartIndex()
If the message structure does not contain this field, 0 is returned.
public final short getStructLength()
CEMI
getStructLength
in interface CEMI
public final boolean isNegativeResponse()
A message contains a negative response, iff the message code equals
MC_PROPREAD_CON
or MC_PROPWRITE_CON
and number of elements is 0.
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 All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |