[wpilib] Document simulation APIs (#3079)

- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
This commit is contained in:
Peter Johnson
2021-01-11 21:55:45 -08:00
committed by GitHub
parent 26584ff145
commit 9c3b51ca0f
64 changed files with 4516 additions and 199 deletions

View File

@@ -4,7 +4,17 @@
package edu.wpi.first.hal;
/** A wrapper around a simulator device handle. */
/**
* A wrapper around a simulator device handle.
*
* <p>Teams: if you are using this class, you are likely confusing it for {@link
* edu.wpi.first.wpilibj.simulation.SimDeviceSim}.
*
* <p>Vendors: This class should be used from inside the device class to define the
* properties/fields of the device. Use {@link #create} to get a SimDevice object, then use {@link
* #createDouble(String, Direction, double)} or similar to define the device's fields. See {@link
* edu.wpi.first.wpilibj.ADXRS450_Gyro} for an example implementation.
*/
public class SimDevice implements AutoCloseable {
public enum Direction {
kInput(SimDeviceJNI.kInput),

View File

@@ -7,13 +7,17 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class RoboRioDataJNI extends JNIWrapper {
@SuppressWarnings("AbbreviationAsWordInName")
public static native int registerFPGAButtonCallback(
NotifyCallback callback, boolean initialNotify);
@SuppressWarnings("AbbreviationAsWordInName")
public static native void cancelFPGAButtonCallback(int uid);
@SuppressWarnings("AbbreviationAsWordInName")
public static native boolean getFPGAButton();
@SuppressWarnings("AbbreviationAsWordInName")
public static native void setFPGAButton(boolean fPGAButton);
public static native int registerVInVoltageCallback(

View File

@@ -29,6 +29,7 @@ public class SimDeviceDataJNI extends JNIWrapper {
public static native int getSimValueDeviceHandle(int handle);
public static class SimDeviceInfo {
@SuppressWarnings("JavadocMethod")
public SimDeviceInfo(String name, int handle) {
this.name = name;
this.handle = handle;
@@ -62,6 +63,7 @@ public class SimDeviceDataJNI extends JNIWrapper {
public static native int getSimValueHandle(int device, String name);
public static class SimValueInfo {
@SuppressWarnings("JavadocMethod")
public SimValueInfo(
String name, int handle, int direction, int type, long value1, double value2) {
this.name = name;