Class Controller

java.lang.Object
javaforce.controls.Controller

public class Controller extends Object
  • Field Details

    • rate

      public static double rate
    • lastException

      public Exception lastException
    • debug

      public static boolean debug
  • Constructor Details

    • Controller

      public Controller()
  • Method Details

    • setRate

      public void setRate(float rate)
    • setTimeout

      public void setTimeout(int ms)
      Specify timeout (ms) for socket connect and read operations.
      Parameters:
      ms - = timeout (default = 3000)
    • connect

      public boolean connect(String url)
      Connects to a PLC. url = "S7:host" url = "MODBUS:host" url = "AB:host" url = "NI:device/options" url = "MIC:name" (int16 data type , %lt;default%gt; will use default mic)
    • setSOCKS

      public void setSOCKS(String host)
      Connect to PLC via a SOCKS4 server. Must call this before calling connect(String url)
      Parameters:
      host - = IP4 address of SOCKS4 server.
    • disconnect

      public boolean disconnect()
      Disconnects from PLC.
    • write

      public boolean write(String addr, byte[] data)
      Writes data to PLC.
    • write

      public boolean write(String addr, byte[] data, Controller.datatype type)
      Writes data to PLC. datatype is required for AB controllers.
    • read

      public byte[] read(String addr)
      Reads data from PLC.
    • read

      public byte[][] read(String[] addr)
      Reads multiple data tags from PLC. (only S7 is currently supported)
    • isConnected

      public boolean isConnected()
    • isBE

      public boolean isBE()
      Returns true is controller is Big Endian byte order.
    • isLE

      public boolean isLE()