tuwien.auto.calimero.datapoint
Class Datapoint

java.lang.Object
  extended by tuwien.auto.calimero.datapoint.Datapoint
Direct Known Subclasses:
CommandDP, StateDP

public abstract class Datapoint
extends java.lang.Object

Represents a KNX datapoint configuration.

It stores knowledge about a datapoint in the KNX network, used for communication within Calimero, the KNX network, and the user.
The datapoint is identified through a KNX group address. A name is supplied to allow a more friendly interaction with the user, the selected name does not have to be unique. Information exchanged between datapoints consists of a certain encoding, defined by a datapoint type (DPT). This information exchange is done through messages, which are sent with a Priority associated with the respective datapoint. Every datapoint object can have its own DPT and priority set by using datapoint methods.
Note, only information for how to handle interaction is stored within a datapoint type. Neither datapoint values (states or events), nor any datapoint messages are stored.

A KNX datapoint is either state based StateDP or command based CommandDP.


Method Summary
static Datapoint create(XMLReader r)
          Creates a new datapoint from XML input.
 java.lang.String getDPT()
          Returns the datapoint type ID of a DPT translator to use for datapoint value translation.
 GroupAddress getMainAddress()
          Returns the datapoint main address, a KNX group address identifying this datapoint.
 int getMainNumber()
          Returns the main number of the data type to use for datapoint value translation.
 java.lang.String getName()
          Returns the datapoint name.
 Priority getPriority()
          Returns the KNX message priority assigned to this datapoint.
 boolean isStateBased()
          Returns whether this datapoint is state or command based.
 void save(XMLWriter w)
          Saves this datapoint in XML format to the supplied XML writer.
 void setDPT(int mainNumber, java.lang.String dptID)
          Sets the datapoint type to use for translation of datapoint values.
 void setName(java.lang.String friendlyName)
          Sets the datapoint name.
 void setPriority(Priority p)
          Sets the priority used for KNX messages of this datapoint.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Datapoint create(XMLReader r)
                        throws KNXMLException
Creates a new datapoint from XML input.

If the current XML element position is no start tag, the next element tag is read. The datapoint element is then expected to be the current element in the reader.

Parameters:
r - a XML reader
Returns:
the created datapoint, either of type StateDP or CommandDP
Throws:
KNXMLException - if the XML element is no datapoint or could not be read correctly

getDPT

public final java.lang.String getDPT()
Returns the datapoint type ID of a DPT translator to use for datapoint value translation.

Returns:
the datapoint type ID as string

getMainAddress

public final GroupAddress getMainAddress()
Returns the datapoint main address, a KNX group address identifying this datapoint.

Returns:
KNX group address

getMainNumber

public final int getMainNumber()
Returns the main number of the data type to use for datapoint value translation.

If the DPT (see getDPT()) assigned to this datapoint unambiguously identifies the DPT translator, the returned main number might be left 0 by the user of this datapoint.

Returns:
main number as int or 0

getName

public final java.lang.String getName()
Returns the datapoint name.

Returns:
datapoint name as string

getPriority

public final Priority getPriority()
Returns the KNX message priority assigned to this datapoint.

Returns:
priority value

isStateBased

public final boolean isStateBased()
Returns whether this datapoint is state or command based.

Returns:
true if datapoint is state based, false for command based

save

public void save(XMLWriter w)
          throws KNXMLException
Saves this datapoint in XML format to the supplied XML writer.

Parameters:
w - a XML writer
Throws:
KNXMLException - on error saving this datapoint

setDPT

public final void setDPT(int mainNumber,
                         java.lang.String dptID)
Sets the datapoint type to use for translation of datapoint values.

A datapoint type is used with DPTXlators for value translation.

Parameters:
mainNumber - main number of the data type used for translation of a datapoint value; if the used dptID argument unambiguously identifies a DPT translator, main number might be left 0
dptID - the datapoint type used for translation in a DPT translator

setName

public final void setName(java.lang.String friendlyName)
Sets the datapoint name.

The datapoint name might be any user defined name, it is only used for interaction with the user.

Parameters:
friendlyName - user friendly name of the datapoint

setPriority

public final void setPriority(Priority p)
Sets the priority used for KNX messages of this datapoint.

Parameters:
p - the new priority to assign

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object