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

        @Deprecated
        public SimValue createValue​(String name,
                                    boolean readonly,
                                    HALValue initialValue)
        Deprecated.
        Use direction function instead
        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
      • createValue

        public SimValue createValue​(String name,
                                    SimDevice.Direction direction,
                                    HALValue initialValue)
        Creates a value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        initialValue - initial value
        Returns:
        simulated value object
      • createInt

        public SimInt createInt​(String name,
                                SimDevice.Direction direction,
                                int initialValue)
        Creates an int value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        initialValue - initial value
        Returns:
        simulated double value object
      • createLong

        public SimLong createLong​(String name,
                                  SimDevice.Direction direction,
                                  long initialValue)
        Creates a long value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        initialValue - initial value
        Returns:
        simulated double value object
      • createDouble

        @Deprecated
        public SimDouble createDouble​(String name,
                                      boolean readonly,
                                      double initialValue)
        Deprecated.
        Use direction function instead
        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
      • createDouble

        public SimDouble createDouble​(String name,
                                      SimDevice.Direction direction,
                                      double initialValue)
        Creates a double value on the simulated device.

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        initialValue - initial value
        Returns:
        simulated double value object
      • createEnum

        @Deprecated
        public SimEnum createEnum​(String name,
                                  boolean readonly,
                                  String[] options,
                                  int initialValue)
        Deprecated.
        Use direction function instead
        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
      • createEnum

        public SimEnum createEnum​(String name,
                                  SimDevice.Direction direction,
                                  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
        direction - input/output/bidir (from perspective of user code)
        options - array of option descriptions
        initialValue - initial value (selection)
        Returns:
        simulated enum value object
      • createEnumDouble

        public SimEnum createEnumDouble​(String name,
                                        SimDevice.Direction direction,
                                        String[] options,
                                        double[] optionValues,
                                        int initialValue)
        Creates an enumerated value on the simulated device with double values.

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

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        options - array of option descriptions
        optionValues - array of option values (must be the same size as options)
        initialValue - initial value (selection)
        Returns:
        simulated enum value object
      • createBoolean

        @Deprecated
        public SimBoolean createBoolean​(String name,
                                        boolean readonly,
                                        boolean initialValue)
        Deprecated.
        Use direction function instead
        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
      • createBoolean

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

        Returns null if not in simulation.

        Parameters:
        name - value name
        direction - input/output/bidir (from perspective of user code)
        initialValue - initial value
        Returns:
        simulated boolean value object