Class SimDeviceSim


  • public class SimDeviceSim
    extends Object
    Class to control the simulation side of a SimDevice.
    • Constructor Detail

      • SimDeviceSim

        public SimDeviceSim​(String name)
        Constructs a SimDeviceSim.
        Parameters:
        name - name of the SimDevice
      • SimDeviceSim

        public SimDeviceSim​(String name,
                            int index)
        Constructs a SimDeviceSim.
        Parameters:
        name - name of the SimDevice
        index - device index number to append to name
      • SimDeviceSim

        public SimDeviceSim​(String name,
                            int index,
                            int channel)
        Constructs a SimDeviceSim.
        Parameters:
        name - name of the SimDevice
        index - device index number to append to name
        channel - device channel number to append to name
    • Method Detail

      • getValue

        public SimValue getValue​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getInt

        public SimInt getInt​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getLong

        public SimLong getLong​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getDouble

        public SimDouble getDouble​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getEnum

        public SimEnum getEnum​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getBoolean

        public SimBoolean getBoolean​(String name)
        Get the property object with the given name.
        Parameters:
        name - the property name
        Returns:
        the property object
      • getEnumOptions

        public static String[] getEnumOptions​(SimEnum val)
        Get all options for the given enum.
        Parameters:
        val - the enum
        Returns:
        names of the different values for that enum
      • getNativeHandle

        public int getNativeHandle()
        Get the native handle of this object.
        Returns:
        the handle used to refer to this object through JNI
      • registerValueCreatedCallback

        public CallbackStore registerValueCreatedCallback​(SimValueCallback callback,
                                                          boolean initialNotify)
        Register a callback to be run every time a new value is added to this device.
        Parameters:
        callback - the callback
        initialNotify - should the callback be run with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • registerValueChangedCallback

        public CallbackStore registerValueChangedCallback​(SimValue value,
                                                          SimValueCallback callback,
                                                          boolean initialNotify)
        Register a callback to be run every time a value is changed on this device.
        Parameters:
        value - simulated value
        callback - the callback
        initialNotify - should the callback be run with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • registerValueResetCallback

        public CallbackStore registerValueResetCallback​(SimValue value,
                                                        SimValueCallback callback,
                                                        boolean initialNotify)
        Register a callback for SimDouble.reset() and similar functions. The callback is called with the old value.
        Parameters:
        value - simulated value
        callback - callback
        initialNotify - ignored (present for consistency)
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • registerDeviceCreatedCallback

        public static CallbackStore registerDeviceCreatedCallback​(String prefix,
                                                                  SimDeviceCallback callback,
                                                                  boolean initialNotify)
        Register a callback to be run every time a new SimDevice is created.
        Parameters:
        prefix - the prefix to filter sim devices
        callback - the callback
        initialNotify - should the callback be run with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • registerDeviceFreedCallback

        public static CallbackStore registerDeviceFreedCallback​(String prefix,
                                                                SimDeviceCallback callback,
                                                                boolean initialNotify)
        Register a callback to be run every time a SimDevice is freed/destroyed.
        Parameters:
        prefix - the prefix to filter sim devices
        callback - the callback
        initialNotify - should the callback be run with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • resetData

        public static void resetData()
        Reset all SimDevice data.