[sim] Add joystick simulation support (#2595)

This adds joystick functions to DriverStationSim, and new GenericHIDSim,
JoystickSim, and XboxControllerSim classes.
This commit is contained in:
Peter Johnson
2020-07-15 00:33:57 -07:00
committed by GitHub
parent b06ddcdd86
commit b9feb81226
19 changed files with 1979 additions and 19 deletions

View File

@@ -40,16 +40,48 @@ public class DriverStationDataJNI extends JNIWrapper {
public static native boolean getDsAttached();
public static native void setDsAttached(boolean dsAttached);
public static native int registerAllianceStationIdCallback(NotifyCallback callback, boolean initialNotify);
public static native void cancelAllianceStationIdCallback(int uid);
public static native int getAllianceStationId();
public static native void setAllianceStationId(int allianceStationId);
public static native int registerMatchTimeCallback(NotifyCallback callback, boolean initialNotify);
public static native void cancelMatchTimeCallback(int uid);
public static native double getMatchTime();
public static native void setMatchTime(double matchTime);
public static native void setJoystickAxes(byte joystickNum, float[] axesArray);
public static native void setJoystickPOVs(byte joystickNum, short[] povsArray);
public static native void setJoystickButtons(byte joystickNum, int buttons, int count);
public static native long getJoystickOutputs(int stick);
public static native int getJoystickRumble(int stick, int rumbleNum);
public static native void setMatchInfo(String eventName, String gameSpecificMessage, int matchNumber, int replayNumber, int matchType);
public static native void registerAllCallbacks(NotifyCallback callback, boolean initialNotify);
public static native void notifyNewData();
public static native void setSendError(boolean shouldSend);
public static native void setSendConsoleLine(boolean shouldSend);
public static native void setJoystickButton(int stick, int button, boolean state);
public static native void setJoystickAxis(int stick, int axis, double value);
public static native void setJoystickPOV(int stick, int pov, int value);
public static native void setJoystickButtonsValue(int stick, int buttons);
public static native void setJoystickAxisCount(int stick, int count);
public static native void setJoystickPOVCount(int stick, int count);
public static native void setJoystickButtonCount(int stick, int count);
public static native void setJoystickIsXbox(int stick, boolean isXbox);
public static native void setJoystickType(int stick, int type);
public static native void setJoystickName(int stick, String name);
public static native void setJoystickAxisType(int stick, int axis, int type);
public static native void setGameSpecificMessage(String message);
public static native void setEventName(String name);
public static native void setMatchType(int type);
public static native void setMatchNumber(int matchNumber);
public static native void setReplayNumber(int replayNumber);
public static native void resetData();
}