|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.KNXAddress
tuwien.auto.calimero.GroupAddress
public class GroupAddress
Represents an immutable KNX group address.
Both 2- and 3-level formats are supported. Available groups are
Note, that the most significant bit of the main group (i.e. bit 15 in the unstructured address) is reserved, but not in use for now. Hence this bit is not checked for, but nevertheless stored and returned by this implementation.
Constructor Summary | |
---|---|
GroupAddress(byte[] address)
Creates a KNX group address from a byte array value. |
|
GroupAddress(int address)
Creates a KNX group address from a 16 Bit address value. |
|
GroupAddress(int mainGroup,
int subGroup)
Creates a KNX group address from the 2-level notation main- and sub-group. |
|
GroupAddress(int mainGroup,
int middleGroup,
int subGroup)
Creates a KNX group address from the 3-level notation main-, middle- and sub-group. |
|
GroupAddress(java.lang.String address)
Creates a KNX group address from a string address representation. |
|
GroupAddress(XMLReader r)
Creates a KNX group address from XML input. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Returns whether obj is equal to this KNX address (type). |
byte |
getMainGroup()
Returns the main group value. |
byte |
getMiddleGroup()
Returns the middle group value for the 3-level group notation. |
short |
getSubGroup11()
Returns the sub group value for the 2-level group notation. |
short |
getSubGroup8()
Returns the sub group value for the 3-level group notation. |
java.lang.String |
getType()
Returns the KNX address type, identifying a group or individual address. |
int |
hashCode()
|
static boolean |
is3LevelPresentation()
Returns the current presentation of group addresses. |
static void |
setLevelPresentation(boolean format3Level)
Specifies the level presentation for KNX group addresses. |
java.lang.String |
toString()
Returns the address as string using the '/' separator. |
Methods inherited from class tuwien.auto.calimero.KNXAddress |
---|
create, create, getRawAddress, save, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GroupAddress(byte[] address)
The address is read out of the first 2 byte fields, while the address array itself
might be longer. The content of address
is not modified.
address
- the address byte array in big-endian format, with address.length > 1public GroupAddress(int address)
address
- the address value in the range 0 <= value <= 0xFFFFpublic GroupAddress(int mainGroup, int subGroup)
mainGroup
- main group value, in the range 0 <= value <= 0x1FsubGroup
- sub group value, in the range 0 <= value <= 0x7FFpublic GroupAddress(int mainGroup, int middleGroup, int subGroup)
mainGroup
- main group value, in the range 0 <= value <= 0x1FmiddleGroup
- middle group value, in the range 0 <= value <= 0x7subGroup
- sub group value, in the range 0 <= value <= 0xFFpublic GroupAddress(java.lang.String address) throws KNXFormatException
address
representation.
The address might be formatted in 2- or 3-level groups. Allowed separators are '.' or '/', mutually exclusive.
address
- string containing the KNX address
KNXFormatException
- on unknown address type, wrong address syntax,
group values out of range, or wrong separator usedpublic GroupAddress(XMLReader r) throws KNXMLException
If the current XML element position is no start tag, the next element tag is read. The KNX address element is then expected to be the current element in the reader.
r
- a XML reader
KNXMLException
- if the xml element is no KNX address or the
address couldn't be read in correctlyMethod Detail |
---|
public boolean equals(java.lang.Object obj)
obj
is equal to this KNX address (type).
equals
in class java.lang.Object
obj
- KNX address object
true
iff obj
is of this type and contains the
same address (raw), false
otherwisepublic final byte getMainGroup()
The main group is equal for both the 2- and 3-level group address notation (see class header specification).
public final byte getMiddleGroup()
The middle group consists of 3 bits, starting with bit 8 to 10 in the address field.
public final short getSubGroup11()
The sub group consists of the lower 11 bits in the address field.
public final short getSubGroup8()
The sub group consists of the low byte of the address field.
public java.lang.String getType()
KNXAddress
getType
in class KNXAddress
public int hashCode()
hashCode
in class java.lang.Object
public static boolean is3LevelPresentation()
true
for 3-level formatting, false
otherwisepublic static void setLevelPresentation(boolean format3Level)
Note that, since this notation of levels only affects visual presentation and not internal operation, this is a class setting.
format3Level
- true
for 3-level group format,
false
for 2-level group formatpublic java.lang.String toString()
Depending on is3LevelPresentation()
, the address is formatted in 2- or
3-level group notation.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |