Class SimDevice

    • Constructor Detail

      • SimDevice

        public SimDevice​(int handle)
        Wraps a simulated device handle as returned by SimDeviceJNI.createSimDevice().
        Parameters:
        handle - simulated device handle
    • Method Detail

      • create

        public static SimDevice create​(String name)
        Creates a simulated device.

        The device name must be unique. Returns null if the device name already exists. If multiple instances of the same device are desired, recommend appending the instance/unique identifer in brackets to the base name, e.g. "device[1]".

        null is returned if not in simulation.

        Parameters:
        name - device name
        Returns:
        simulated device object
      • create

        public static SimDevice create​(String name,
                                       int index)
        Creates a simulated device.

        The device name must be unique. Returns null if the device name already exists. This is a convenience method that appends index in brackets to the device name, e.g. passing index=1 results in "device[1]" for the device name.

        null is returned if not in simulation.

        Parameters:
        name - device name
        index - device index number to append to name
        Returns:
        simulated device object
      • create

        public static SimDevice create​(String name,
                                       int index,
                                       int channel)
        Creates a simulated device.

        The device name must be unique. Returns null if the device name already exists. This is a convenience method that appends index and channel in brackets to the device name, e.g. passing index=1 and channel=2 results in "device[1,2]" for the device name.

        null is returned if not in simulation.

        Parameters:
        name - device name
        index - device index number to append to name
        channel - device channel number to append to name
        Returns:
        simulated device object
      • getNativeHandle

        public int getNativeHandle()
        Get the internal device handle.
        Returns:
        internal handle
      • createValue

        public SimValue createValue​(String name,
                                    boolean readonly,
                                    HALValue initialValue)
        Creates a value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        readonly - if the value should not be written from simulation side
        initialValue - initial value
        Returns:
        simulated value object
      • createDouble

        public SimDouble createDouble​(String name,
                                      boolean readonly,
                                      double initialValue)
        Creates a double value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        readonly - if the value should not be written from simulation side
        initialValue - initial value
        Returns:
        simulated double value object
      • createEnum

        public SimEnum createEnum​(String name,
                                  boolean readonly,
                                  String[] options,
                                  int initialValue)
        Creates an enumerated value on the simulated device.

        Enumerated values are always in the range 0 to numOptions-1.

        Returns null if not in simulation.

        Parameters:
        name - value name
        readonly - if the value should not be written from simulation side
        options - array of option descriptions
        initialValue - initial value (selection)
        Returns:
        simulated enum value object
      • createBoolean

        public SimBoolean createBoolean​(String name,
                                        boolean readonly,
                                        boolean initialValue)
        Creates a boolean value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        readonly - if the value should not be written from simulation side
        initialValue - initial value
        Returns:
        simulated boolean value object