Class NetworkMonitor

java.lang.Object
tuwien.auto.calimero.tools.NetworkMonitor
All Implemented Interfaces:
Runnable

public class NetworkMonitor extends Object implements Runnable
A tool for Calimero allowing monitoring of KNX network messages.

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

    Constructors
    Constructor
    Description
    Creates a new NetworkMonitor instance using the supplied options.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static String
    decodeBibat(tuwien.auto.calimero.link.medium.RFLData frame)
     
    protected static String
    decodeLteFrame(int extFormat, tuwien.auto.calimero.KNXAddress dst, byte[] asdu)
     
    protected static String
    decodeLteFrame(tuwien.auto.calimero.link.medium.RFLData frame)
     
    static void
    main(String... args)
    Entry point for running the NetworkMonitor.
    protected void
    onCompletion(Exception thrown, boolean canceled)
    Called by this tool on completion.
    protected void
    onIndication(tuwien.auto.calimero.FrameEvent e)
    Called by this tool on receiving a monitor indication frame.
    void
    Quits a running network monitor, otherwise returns immediately.
    void
    run()
     
    void
    Starts the network monitor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NetworkMonitor

      public NetworkMonitor(String[] args)
      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

      public static void main(String... args)
      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 -h show help message
      • --version show tool/library version and exit
      • --compact -c show incoming busmonitor indications in compact format
      • --localhost id  local IP/host name
      • --localport number  local UDP port (default system assigned)
      • --port -p number  UDP port on host (default 3671)
      • --nat -n enable Network Address Translation
      • --ft12 -f use FT1.2 serial communication
      • --usb -u use KNX USB communication
      • --tpuart use TP-UART communication
      • --medium -m id  KNX medium [tp1|p110|knxip|rf] (defaults to tp1)
      • --domain address  domain address on open KNX medium (PL or RF)
      Parameters:
      args - command line options for network monitoring
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • start

      public void start() throws tuwien.auto.calimero.KNXException, InterruptedException
      Starts the network monitor.

      This method returns after the network monitor was started.

      Throws:
      tuwien.auto.calimero.KNXException - on problems creating or connecting the monitor
      InterruptedException - 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

      protected void onCompletion(Exception thrown, boolean canceled)
      Called by this tool on completion.
      Parameters:
      thrown - the thrown exception if operation completed due to an raised exception, null otherwise
      canceled - 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