tuwien.auto.calimero.link
Class KNXNetworkMonitorFT12

java.lang.Object
  extended by tuwien.auto.calimero.link.KNXNetworkMonitorFT12
All Implemented Interfaces:
KNXNetworkMonitor

public class KNXNetworkMonitorFT12
extends java.lang.Object
implements KNXNetworkMonitor

Implementation of the KNX network monitor link based on the FT1.2 protocol, using a FT12Connection.

Once a monitor has been closed, it is not available for further link communication, i.e. it can't be reopened.


Constructor Summary
KNXNetworkMonitorFT12(int portNumber, KNXMediumSettings settings)
          Creates a new network monitor based on the FT1.2 protocol for accessing the KNX network.
KNXNetworkMonitorFT12(java.lang.String portID, KNXMediumSettings settings)
          Creates a new network monitor based on the FT1.2 protocol for accessing the KNX network.
 
Method Summary
 void addMonitorListener(LinkListener l)
          Adds the specified event listener l to receive events from this network monitor.
 void close()
          Ends monitoring the KNX network and closes the network monitor.
 KNXMediumSettings getKNXMedium()
          Returns the KNX medium settings used by this monitor link.
 java.lang.String getName()
          Returns the name of the monitor, a short textual representation to identify a network monitor.
 boolean isOpen()
          Checks for open monitor link.
 void removeMonitorListener(LinkListener l)
          Removes the specified event listener l, so it does no longer receive events from this network monitor.
 void setDecodeRawFrames(boolean decode)
          Sets whether the monitor should decode the raw frame on medium contained in received KNX bus monitor messages.
 void setKNXMedium(KNXMediumSettings settings)
          Supplies medium information necessary for KNX communication.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KNXNetworkMonitorFT12

public KNXNetworkMonitorFT12(int portNumber,
                             KNXMediumSettings settings)
                      throws KNXException
Creates a new network monitor based on the FT1.2 protocol for accessing the KNX network.

The port number is used to choose the serial port for communication. It is mapped to the default port identifier using that number on the platform.

Parameters:
portNumber - port number of the serial communication port to use
settings - medium settings defining the specific KNX medium needed for decoding raw frames received from the KNX network
Throws:
KNXException

KNXNetworkMonitorFT12

public KNXNetworkMonitorFT12(java.lang.String portID,
                             KNXMediumSettings settings)
                      throws KNXException
Creates a new network monitor based on the FT1.2 protocol for accessing the KNX network.

The port identifier is used to choose the serial port for communication. These identifiers are usually device and platform specific.

Parameters:
portID - identifier of the serial communication port to use
settings - medium settings defining the specific KNX medium needed for decoding raw frames received from the KNX network
Throws:
KNXException
Method Detail

addMonitorListener

public void addMonitorListener(LinkListener l)
Description copied from interface: KNXNetworkMonitor
Adds the specified event listener l to receive events from this network monitor.

If l was already added as listener, no action is performed.

Specified by:
addMonitorListener in interface KNXNetworkMonitor
Parameters:
l - the listener to add

close

public void close()
Description copied from interface: KNXNetworkMonitor
Ends monitoring the KNX network and closes the network monitor.

All registered monitor listeners get notified.
If no communication access was established in the first place, no action is performed.

Specified by:
close in interface KNXNetworkMonitor

getKNXMedium

public KNXMediumSettings getKNXMedium()
Description copied from interface: KNXNetworkMonitor
Returns the KNX medium settings used by this monitor link.

The returned object is a reference to the one used by this link (not a copy).

Specified by:
getKNXMedium in interface KNXNetworkMonitor
Returns:
medium settings for KNX network

getName

public java.lang.String getName()
Returns the name of the monitor, a short textual representation to identify a network monitor.

The name is unique for monitors with different remote endpoints.
The returned name is used by the monitor for the name of its log service. Supply KNXNetworkMonitor.getName() for LogManager.getLogService(String) for example to get the associated log service.

By default, "monitor " + address/ID of the remote endpoint is returned.
After closing the monitor, the returned name might differ, e.g. get reset to some arbitrary default name.
The returned name is "monitor " + port identifier.

Specified by:
getName in interface KNXNetworkMonitor
Returns:
monitor name as string

isOpen

public boolean isOpen()
Description copied from interface: KNXNetworkMonitor
Checks for open monitor link.

After a call to KNXNetworkMonitor.close() or after the underlying protocol initiated the end of the communication, this method always returns false.

Specified by:
isOpen in interface KNXNetworkMonitor
Returns:
true if this network monitor is open, false on closed

removeMonitorListener

public void removeMonitorListener(LinkListener l)
Description copied from interface: KNXNetworkMonitor
Removes the specified event listener l, so it does no longer receive events from this network monitor.

If l was not added in the first place, no action is performed.

Specified by:
removeMonitorListener in interface KNXNetworkMonitor
Parameters:
l - the listener to remove

setDecodeRawFrames

public void setDecodeRawFrames(boolean decode)
Description copied from interface: KNXNetworkMonitor
Sets whether the monitor should decode the raw frame on medium contained in received KNX bus monitor messages.

A decoded raw frame is of type RawFrame and can be retrieved using MonitorFrameEvent.getRawFrame() within a link listener registered for this monitor.

Specified by:
setDecodeRawFrames in interface KNXNetworkMonitor
Parameters:
decode - true to enable decoding, false to skip decoding

setKNXMedium

public void setKNXMedium(KNXMediumSettings settings)
Description copied from interface: KNXNetworkMonitor
Supplies medium information necessary for KNX communication.

These informations are differing between KNX media and depend on the KNX network this link is communicating with.
The settings medium type has to match the medium type supplied to the link in the first place.
The settings object is not copied internally to allow subsequent changes to medium settings by the user which should take effect immediately.

Specified by:
setKNXMedium in interface KNXNetworkMonitor
Parameters:
settings - medium settings to use, the expected subtype is according to the KNX network medium

toString

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