|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.process.ProcessListenerEx
public abstract class ProcessListenerEx
Extended process listener interface with additional group read event handler methods, as well as basic ASDU type translation capabilities.
This listener contains predefined methods equal to the ones in the ProcessCommunicator
interface to convert received ASDUs into common java data types.
Usage example for group reads from datapoints with DPT main number 1:
public void groupWrite(ProcessEvent e) { // the member variable model (of type DatapointModel, declared by the user) // contains datapoints of light switch objects in the KNX network (boolean type) if (model.contains(e.getDestination())) try { final boolean switch = asBool(e); System.out.println(model.get(e.getDestination()).getName() + " state = " + switch); if (switch) { // light switch is in position on // do some visual feedback for the user ... } } catch (KNXFormatException kfe) { /* DPT not found ... *<!-- -->/ } }
ProcessCommunicator
Constructor Summary | |
---|---|
ProcessListenerEx()
|
Method Summary | |
---|---|
boolean |
asBool(ProcessEvent e)
Returns the ASDU of the received process event as boolean datapoint value. |
byte |
asControl(ProcessEvent e)
Returns the ASDU of the received process event as 3 Bit controlled datapoint value. |
float |
asFloat(ProcessEvent e)
Returns the ASDU of the received process event as 2 byte KNX float datapoint value. |
java.lang.String |
asString(ProcessEvent e)
Returns the ASDU of the received process event as string datapoint value. |
java.lang.String |
asString(ProcessEvent e,
int dptMainNumber,
java.lang.String dptID)
Returns the ASDU of the received process event as datapoint value of the requested DPT in String representation. |
short |
asUnsigned(ProcessEvent e,
java.lang.String scale)
Returns the ASDU of the received process event as unsigned 8 Bit datapoint value. |
abstract void |
groupReadRequest(ProcessEvent e)
Indicates that a KNX group read request message was received from the KNX network. |
abstract void |
groupReadResponse(ProcessEvent e)
Indicates that a KNX group read response message was received from the KNX network. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface tuwien.auto.calimero.process.ProcessListener |
---|
detached, groupWrite |
Constructor Detail |
---|
public ProcessListenerEx()
Method Detail |
---|
public boolean asBool(ProcessEvent e) throws KNXFormatException
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translate
KNXFormatException
- on not supported or not available boolean DPTpublic byte asControl(ProcessEvent e) throws KNXFormatException
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translate
KNXFormatException
- on not supported or not available 3 Bit controlled DPTpublic float asFloat(ProcessEvent e) throws KNXFormatException
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translate
KNXFormatException
- on not supported or not available float DPTpublic java.lang.String asString(ProcessEvent e) throws KNXFormatException
The used character set is ISO-8859-1 (Latin 1), with an allowed string length of 14 characters.
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translate
KNXFormatException
- on not supported or not available ISO-8859-1 DPTpublic java.lang.String asString(ProcessEvent e, int dptMainNumber, java.lang.String dptID) throws KNXException
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translatedptMainNumber
- datapoint type main number, number >= 0; use 0 to infer
translator type from dptID
argument onlydptID
- datapoint type ID for selecting a particular kind of value translation
KNXException
- on not supported or not available DPTTranslatorTypes.createTranslator(int, String)
public short asUnsigned(ProcessEvent e, java.lang.String scale) throws KNXFormatException
This method has to be invoked manually by the user (either in
groupReadResponse(ProcessEvent)
or
ProcessListener.groupWrite(ProcessEvent)
), depending on the received
datapoint type.
e
- the process event with the ASDU to translatescale
- see ProcessCommunicator.readUnsigned(
tuwien.auto.calimero.GroupAddress, String)
KNXFormatException
- on not supported or not available 8 Bit unsigned DPTpublic abstract void groupReadRequest(ProcessEvent e)
e
- process event objectpublic abstract void groupReadResponse(ProcessEvent e)
e
- process event object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |