Class SimDeviceJNI
- java.lang.Object
-
- edu.wpi.first.hal.JNIWrapper
-
- edu.wpi.first.hal.SimDeviceJNI
-
public class SimDeviceJNI extends JNIWrapper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.wpi.first.hal.JNIWrapper
JNIWrapper.Helper
-
-
Constructor Summary
Constructors Constructor Description SimDeviceJNI()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcreateSimDevice(String name)Creates a simulated device.static intcreateSimValue(int device, String name, boolean readonly, HALValue initialValue)Creates a value on a simulated device.static intcreateSimValueBoolean(int device, String name, boolean readonly, boolean initialValue)Creates a boolean value on a simulated device.static intcreateSimValueDouble(int device, String name, boolean readonly, double initialValue)Creates a double value on a simulated device.static intcreateSimValueEnum(int device, String name, boolean readonly, String[] options, int initialValue)Creates an enumerated value on a simulated device.static voidfreeSimDevice(int handle)Frees a simulated device.static HALValuegetSimValue(int handle)Gets a simulated value.static booleangetSimValueBoolean(int handle)Gets a simulated value (boolean).static doublegetSimValueDouble(int handle)Gets a simulated value (double).static intgetSimValueEnum(int handle)Gets a simulated value (enum).static voidsetSimValue(int handle, HALValue value)Sets a simulated value.static voidsetSimValueBoolean(int handle, boolean value)Sets a simulated value (boolean).static voidsetSimValueDouble(int handle, double value)Sets a simulated value (double).static voidsetSimValueEnum(int handle, int value)Sets a simulated value (enum).-
Methods inherited from class edu.wpi.first.hal.JNIWrapper
forceLoad
-
-
-
-
Method Detail
-
createSimDevice
public static int createSimDevice(String name)
Creates a simulated device.The device name must be unique. 0 is returned 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]".
0 is returned if not in simulation.
- Parameters:
name- device name- Returns:
- simulated device handle
-
freeSimDevice
public static void freeSimDevice(int handle)
Frees a simulated device.This also allows the same device name to be used again. This also frees all the simulated values created on the device.
- Parameters:
handle- simulated device handle
-
createSimValue
public static int createSimValue(int device, String name, boolean readonly, HALValue initialValue)Creates a value on a simulated device.Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
- Parameters:
device- simulated device handlename- value namereadonly- if the value should not be written from simulation sideinitialValue- initial value- Returns:
- simulated value handle
-
createSimValueDouble
public static int createSimValueDouble(int device, String name, boolean readonly, double initialValue)Creates a double value on a simulated device.Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
- Parameters:
device- simulated device handlename- value namereadonly- if the value should not be written from simulation sideinitialValue- initial value- Returns:
- simulated value handle
-
createSimValueEnum
public static int createSimValueEnum(int device, String name, boolean readonly, String[] options, int initialValue)Creates an enumerated value on a simulated device.Enumerated values are always in the range 0 to numOptions-1.
Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
- Parameters:
device- simulated device handlename- value namereadonly- if the value should not be written from simulation sideoptions- array of option descriptionsinitialValue- initial value (selection)- Returns:
- simulated value handle
-
createSimValueBoolean
public static int createSimValueBoolean(int device, String name, boolean readonly, boolean initialValue)Creates a boolean value on a simulated device.Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
- Parameters:
device- simulated device handlename- value namereadonly- if the value should not be written from simulation sideinitialValue- initial value- Returns:
- simulated value handle
-
getSimValue
public static HALValue getSimValue(int handle)
Gets a simulated value.- Parameters:
handle- simulated value handle- Returns:
- The current value
-
getSimValueDouble
public static double getSimValueDouble(int handle)
Gets a simulated value (double).- Parameters:
handle- simulated value handle- Returns:
- The current value
-
getSimValueEnum
public static int getSimValueEnum(int handle)
Gets a simulated value (enum).- Parameters:
handle- simulated value handle- Returns:
- The current value
-
getSimValueBoolean
public static boolean getSimValueBoolean(int handle)
Gets a simulated value (boolean).- Parameters:
handle- simulated value handle- Returns:
- The current value
-
setSimValue
public static void setSimValue(int handle, HALValue value)Sets a simulated value.- Parameters:
handle- simulated value handlevalue- the value to set
-
setSimValueDouble
public static void setSimValueDouble(int handle, double value)Sets a simulated value (double).- Parameters:
handle- simulated value handlevalue- the value to set
-
setSimValueEnum
public static void setSimValueEnum(int handle, int value)Sets a simulated value (enum).- Parameters:
handle- simulated value handlevalue- the value to set
-
setSimValueBoolean
public static void setSimValueBoolean(int handle, boolean value)Sets a simulated value (boolean).- Parameters:
handle- simulated value handlevalue- the value to set
-
-