Class NetworkMonitor
- All Implemented Interfaces:
Runnable
NetworkMonitor is a Runnable tool implementation allowing a user to track KNX network
messages in a KNX network. It provides monitoring access using a KNXnet/IP, KNX IP, USB, FT1.2,
or TP-UART connection. NetworkMonitor shows the necessary interaction with the core library API
for this particular task.
Note that by default the network monitor will run with default settings, if not specified
otherwise using command line options. Since these settings might be system dependent (for example
the local host) and not always predictable, a user may want to specify particular settings using
the available tool options.
The main part of this tool implementation interacts with the type KNXNetworkMonitor,
which offers monitoring access to a KNX network. All monitoring output, as well as occurring
problems are written to either System.out
(console mode), or the log writer supplied by the user.
To use the network monitor, invoke main(String[]), or create a new
instance with NetworkMonitor(String[]), and invoke
start() or run() on that instance. When running
this tool from the console, the main method of this class is executed, otherwise use
it in the context appropriate to a Runnable.
To quit a monitor running on a console, use a user interrupt for termination, e.g.,
^C.
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkMonitor(String[] args) Creates a new NetworkMonitor instance using the supplied options. -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringdecodeBibat(tuwien.auto.calimero.link.medium.RFLData frame) protected static StringdecodeLteFrame(int extFormat, tuwien.auto.calimero.KNXAddress dst, byte[] asdu) protected static StringdecodeLteFrame(tuwien.auto.calimero.link.medium.RFLData frame) static voidEntry point for running the NetworkMonitor.protected voidonCompletion(Exception thrown, boolean canceled) Called by this tool on completion.protected voidonIndication(tuwien.auto.calimero.FrameEvent e) Called by this tool on receiving a monitor indication frame.voidquit()Quits a running network monitor, otherwise returns immediately.voidrun()voidstart()Starts the network monitor.
-
Constructor Details
-
NetworkMonitor
Creates a new NetworkMonitor instance using the supplied options.See
main(String[])for a list of options.- Parameters:
args- list with options- Throws:
tuwien.auto.calimero.KNXIllegalArgumentException- on unknown/invalid options
-
-
Method Details
-
main
Entry point for running the NetworkMonitor.An IP host or port identifier has to be supplied, specifying the endpoint for the KNX network access.
To show the usage message of this tool on the console, supply the command line option --help (or -h).
Command line options are treated case sensitive. Available options for network monitoring:--help -hshow help message--versionshow tool/library version and exit--compact -cshow incoming busmonitor indications in compact format--localhostid local IP/host name--localportnumber local UDP port (default system assigned)--port -pnumber UDP port on host (default 3671)--nat -nenable Network Address Translation--ft12 -fuse FT1.2 serial communication--usb -uuse KNX USB communication--tpuartuse TP-UART communication--medium -mid KNX medium [tp1|p110|knxip|rf] (defaults to tp1)--domainaddress domain address on open KNX medium (PL or RF)
- Parameters:
args- command line options for network monitoring
-
run
public void run() -
start
Starts the network monitor.This method returns after the network monitor was started.
- Throws:
tuwien.auto.calimero.KNXException- on problems creating or connecting the monitorInterruptedException- on interrupted thread
-
quit
public void quit()Quits a running network monitor, otherwise returns immediately. -
onIndication
protected void onIndication(tuwien.auto.calimero.FrameEvent e) Called by this tool on receiving a monitor indication frame.- Parameters:
e- the frame event
-
onCompletion
Called by this tool on completion.- Parameters:
thrown- the thrown exception if operation completed due to an raised exception,nullotherwisecanceled- whether the operation got canceled before its planned end
-
decodeLteFrame
protected static String decodeLteFrame(tuwien.auto.calimero.link.medium.RFLData frame) throws tuwien.auto.calimero.KNXFormatException - Throws:
tuwien.auto.calimero.KNXFormatException
-
decodeLteFrame
protected static String decodeLteFrame(int extFormat, tuwien.auto.calimero.KNXAddress dst, byte[] asdu) throws tuwien.auto.calimero.KNXFormatException - Throws:
tuwien.auto.calimero.KNXFormatException
-
decodeBibat
protected static String decodeBibat(tuwien.auto.calimero.link.medium.RFLData frame) throws tuwien.auto.calimero.KNXFormatException - Throws:
tuwien.auto.calimero.KNXFormatException
-