java.lang.Object
test.de.iip_ecosphere.platform.connectors.modbustcpipv1.TestServer

public class TestServer extends Object
Implements a MODBUS TCP/IP test server. So far only modbus holding registers are implemented.
Author:
Christian Nikolajew
  • Field Details

    • mListener

      private net.wimpi.modbus.net.ModbusTCPListener mListener
    • mHost

      private InetAddress mHost
    • mPort

      private int mPort
    • serverStructure

      private String serverStructure
    • map

      private de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusMap map
  • Constructor Details

    • TestServer

      public TestServer(boolean defaultPort)
      Creates a TestServer instance.
      Parameters:
      defaultPort - : true -> Modbus default port 502 is used false -> Free port from NetUtils.getEphemeralPort() is used.
  • Method Details

    • start

      public void start()
      Starts the server.
    • stop

      public void stop()
      Shuts down the server.
    • getHost

      public String getHost()
      Returns the host.
      Returns:
      the host
    • getPort

      public int getPort()
      Returns the port.
      Returns:
      the port
    • getMap

      public de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusMap getMap()
      Returns the map.
      Returns:
      the map
    • getRegisterCount

      public int getRegisterCount()
      Calculates the count of Registers needed to store the ModbusServerMap and returs it.
      Returns:
      the count of Registers needed to store the ModbusServerMap
    • createServerStructure

      private String createServerStructure()
      Returs the ServerSettings for the TestServer.
      Returns:
      the ServerSettings
    • getServerStructure

      public String getServerStructure()
      Returns the ServerSettings.
      Returns:
      the ServerSettings