Class Memory

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

public class Memory extends Object implements Runnable
A tool for accessing KNX device memory. Memory is a Runnable tool implementation allowing a user to read or write memory in a KNX device.
This tool supports KNX network access using a KNXnet/IP, KNX IP, USB, FT1.2, or TP-UART connection. It uses the ManagementClient functionality of the library to read/write memory locations.

When running this tool from the console, the main- method of this class is invoked, otherwise use this class in the context appropriate to a Runnable.
In console mode, the read memory as well as errors and problems during execution are written to System.out.

  • Field Details

  • Constructor Details

    • Memory

      public Memory(String[] args)
      Creates a new Memory instance using the supplied options.

      Mandatory arguments are the connection options depending on the type of connection to the KNX network, the KNX device address ("area.line.device"), and the read or write command. See main(String[]) for the 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 Memory.

      Syntax: Memory [options] <host|port> <KNX device address> read|write <addr> [bytes|data]

      To show usage message of the tool on the console, supply the command line option --help (or -h). Command line options are treated case sensitive. Available options for connecting to the KNX device in question:

      • no arguments: only show short description and version info
      • --help -h show help message
      • --version show tool/library version and exit
      • --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)
      • --knx-address -k KNX address  KNX device address of local endpoint
      • --dec  data is interpreted in unsigned decimal format
      The --knx-address option is only necessary if an access protocol is selected that directly communicates with the KNX network, i.e., KNX IP or TP-UART. The selected KNX individual address shall be unique in a network, and the subnetwork address (area and line) should be set to match the network configuration.

      Supported commands:

      • read (or r) addr [bytes]    read number of bytes (default 1) starting at memory address
      • write (or w) addr data    write data to memory starting at address
      Parameters:
      args - command line options for running the device info tool
    • run

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

      protected Memory.Command fetchCommand()
    • onMemoryRead

      protected void onMemoryRead(int address, byte[] data)
      Invoked on each successfully memory read.
      Parameters:
      data - memory data
    • onCompletion

      protected void onCompletion(Exception thrown, boolean canceled)
      Called by this tool on completion.
      Parameters:
      thrown - the thrown exception if operation completed due to a raised exception, null otherwise
      canceled - whether the operation got canceled before its planned end