[build] Apply spotless for java formatting (#1768)

Update checkstyle config to be compatible with spotless.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
Peter Johnson
2020-12-29 22:45:16 -08:00
committed by GitHub
parent e563a0b7db
commit a751fa22d2
883 changed files with 16526 additions and 17751 deletions

View File

@@ -4,24 +4,16 @@
package edu.wpi.first.hal;
/**
* Structure for holding the values stored in an accumulator.
*/
/** Structure for holding the values stored in an accumulator. */
public class AccumulatorResult {
/**
* The total value accumulated.
*/
/** The total value accumulated. */
@SuppressWarnings("MemberName")
public long value;
/**
* The number of sample value was accumulated over.
*/
/** The number of sample value was accumulated over. */
@SuppressWarnings("MemberName")
public long count;
/**
* Set the value and count.
*/
/** Set the value and count. */
public void set(long value, long count) {
this.value = value;
this.count = count;

View File

@@ -7,14 +7,19 @@ package edu.wpi.first.hal;
@SuppressWarnings("AbbreviationAsWordInName")
public class AddressableLEDJNI extends JNIWrapper {
public static native int initialize(int pwmHandle);
public static native void free(int handle);
public static native void setLength(int handle, int length);
public static native void setData(int handle, byte[] data);
public static native void setBitTiming(int handle, int lowTime0, int highTime0, int lowTime1, int highTime1);
public static native void setBitTiming(
int handle, int lowTime0, int highTime0, int lowTime1, int highTime1);
public static native void setSyncTime(int handle, int syncTime);
public static native void start(int handle);
public static native void stop(int handle);
}

View File

@@ -5,5 +5,10 @@
package edu.wpi.first.hal;
public enum AllianceStationID {
Red1, Red2, Red3, Blue1, Blue2, Blue3
Red1,
Red2,
Red3,
Blue1,
Blue2,
Blue3
}

View File

@@ -11,12 +11,11 @@ public class AnalogGyroJNI extends JNIWrapper {
public static native void freeAnalogGyro(int handle);
public static native void setAnalogGyroParameters(int handle,
double voltsPerDegreePerSecond,
double offset, int center);
public static native void setAnalogGyroParameters(
int handle, double voltsPerDegreePerSecond, double offset, int center);
public static native void setAnalogGyroVoltsPerDegreePerSecond(int handle,
double voltsPerDegreePerSecond);
public static native void setAnalogGyroVoltsPerDegreePerSecond(
int handle, double voltsPerDegreePerSecond);
public static native void resetAnalogGyro(int handle);

View File

@@ -6,24 +6,17 @@ package edu.wpi.first.hal;
public class AnalogJNI extends JNIWrapper {
/**
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:58</i><br> enum values
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:58</i><br>
* enum values
*/
public interface AnalogTriggerType {
/**
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:54</i>
*/
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:54</i> */
int kInWindow = 0;
/**
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:55</i>
*/
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:55</i> */
int kState = 1;
/**
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:56</i>
*/
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:56</i> */
int kRisingPulse = 2;
/**
* <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:57</i>
*/
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:57</i> */
int kFallingPulse = 3;
}
@@ -95,20 +88,20 @@ public class AnalogJNI extends JNIWrapper {
public static native void cleanAnalogTrigger(int analogTriggerHandle);
public static native void setAnalogTriggerLimitsRaw(int analogTriggerHandle, int lower,
int upper);
public static native void setAnalogTriggerLimitsRaw(
int analogTriggerHandle, int lower, int upper);
public static native void setAnalogTriggerLimitsDutyCycle(int analogTriggerHandle, double lower,
double higher);
public static native void setAnalogTriggerLimitsDutyCycle(
int analogTriggerHandle, double lower, double higher);
public static native void setAnalogTriggerLimitsVoltage(int analogTriggerHandle,
double lower, double upper);
public static native void setAnalogTriggerLimitsVoltage(
int analogTriggerHandle, double lower, double upper);
public static native void setAnalogTriggerAveraged(int analogTriggerHandle,
boolean useAveragedValue);
public static native void setAnalogTriggerAveraged(
int analogTriggerHandle, boolean useAveragedValue);
public static native void setAnalogTriggerFiltered(int analogTriggerHandle,
boolean useFilteredValue);
public static native void setAnalogTriggerFiltered(
int analogTriggerHandle, boolean useFilteredValue);
public static native boolean getAnalogTriggerInWindow(int analogTriggerHandle);

View File

@@ -12,15 +12,15 @@ public class CANAPIJNI extends JNIWrapper {
public static native void writeCANPacket(int handle, byte[] data, int apiId);
public static native void writeCANPacketRepeating(int handle, byte[] data, int apiId,
int repeatMs);
public static native void writeCANPacketRepeating(
int handle, byte[] data, int apiId, int repeatMs);
public static native void writeCANRTRFrame(int handle, int length, int apiId);
public static native int writeCANPacketNoThrow(int handle, byte[] data, int apiId);
public static native int writeCANPacketRepeatingNoThrow(int handle, byte[] data, int apiId,
int repeatMs);
public static native int writeCANPacketRepeatingNoThrow(
int handle, byte[] data, int apiId, int repeatMs);
public static native int writeCANRTRFrameNoThrow(int handle, int length, int apiId);
@@ -30,6 +30,6 @@ public class CANAPIJNI extends JNIWrapper {
public static native boolean readCANPacketLatest(int handle, int apiId, CANData data);
public static native boolean readCANPacketTimeout(int handle, int apiId, int timeoutMs,
CANData data);
public static native boolean readCANPacketTimeout(
int handle, int apiId, int timeoutMs, CANData data);
}

View File

@@ -7,14 +7,14 @@ package edu.wpi.first.hal;
public class CANData {
@SuppressWarnings("MemberName")
public final byte[] data = new byte[8];
@SuppressWarnings("MemberName")
public int length;
@SuppressWarnings("MemberName")
public long timestamp;
/**
* API used from JNI to set the data.
*/
/** API used from JNI to set the data. */
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public byte[] setData(int length, long timestamp) {
this.length = length;

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper for the HALControlWord bitfield.
*/
/** A wrapper for the HALControlWord bitfield. */
public class ControlWord {
private boolean m_enabled;
private boolean m_autonomous;
@@ -15,8 +13,13 @@ public class ControlWord {
private boolean m_fmsAttached;
private boolean m_dsAttached;
void update(boolean enabled, boolean autonomous, boolean test, boolean emergencyStop,
boolean fmsAttached, boolean dsAttached) {
void update(
boolean enabled,
boolean autonomous,
boolean test,
boolean emergencyStop,
boolean fmsAttached,
boolean dsAttached) {
m_enabled = enabled;
m_autonomous = autonomous;
m_test = test;

View File

@@ -13,19 +13,19 @@ public class CounterJNI extends JNIWrapper {
public static native void setCounterAverageSize(int counterHandle, int size);
public static native void setCounterUpSource(int counterHandle, int digitalSourceHandle,
int analogTriggerType);
public static native void setCounterUpSource(
int counterHandle, int digitalSourceHandle, int analogTriggerType);
public static native void setCounterUpSourceEdge(int counterHandle, boolean risingEdge,
boolean fallingEdge);
public static native void setCounterUpSourceEdge(
int counterHandle, boolean risingEdge, boolean fallingEdge);
public static native void clearCounterUpSource(int counterHandle);
public static native void setCounterDownSource(int counterHandle, int digitalSourceHandle,
int analogTriggerType);
public static native void setCounterDownSource(
int counterHandle, int digitalSourceHandle, int analogTriggerType);
public static native void setCounterDownSourceEdge(int counterHandle, boolean risingEdge,
boolean fallingEdge);
public static native void setCounterDownSourceEdge(
int counterHandle, boolean risingEdge, boolean fallingEdge);
public static native void clearCounterDownSource(int counterHandle);
@@ -33,15 +33,13 @@ public class CounterJNI extends JNIWrapper {
public static native void setCounterExternalDirectionMode(int counterHandle);
public static native void setCounterSemiPeriodMode(int counterHandle,
boolean highSemiPeriod);
public static native void setCounterSemiPeriodMode(int counterHandle, boolean highSemiPeriod);
public static native void setCounterPulseLengthMode(int counterHandle, double threshold);
public static native int getCounterSamplesToAverage(int counterHandle);
public static native void setCounterSamplesToAverage(int counterHandle,
int samplesToAverage);
public static native void setCounterSamplesToAverage(int counterHandle, int samplesToAverage);
public static native void resetCounter(int counterHandle);
@@ -57,6 +55,5 @@ public class CounterJNI extends JNIWrapper {
public static native boolean getCounterDirection(int counterHandle);
public static native void setCounterReverseDirection(int counterHandle,
boolean reverseDirection);
public static native void setCounterReverseDirection(int counterHandle, boolean reverseDirection);
}

View File

@@ -6,11 +6,15 @@ package edu.wpi.first.hal;
public class DutyCycleJNI extends JNIWrapper {
public static native int initialize(int digitalSourceHandle, int analogTriggerType);
public static native void free(int handle);
public static native int getFrequency(int handle);
public static native double getOutput(int handle);
public static native int getOutputRaw(int handle);
public static native int getOutputScaleFactor(int handle);
@SuppressWarnings("AbbreviationAsWordInName")

View File

@@ -5,9 +5,13 @@
package edu.wpi.first.hal;
public class EncoderJNI extends JNIWrapper {
public static native int initializeEncoder(int digitalSourceHandleA, int analogTriggerTypeA,
int digitalSourceHandleB, int analogTriggerTypeB,
boolean reverseDirection, int encodingType);
public static native int initializeEncoder(
int digitalSourceHandleA,
int analogTriggerTypeA,
int digitalSourceHandleB,
int analogTriggerTypeB,
boolean reverseDirection,
int encodingType);
public static native void freeEncoder(int encoderHandle);
@@ -37,16 +41,14 @@ public class EncoderJNI extends JNIWrapper {
public static native void setEncoderDistancePerPulse(int encoderHandle, double distancePerPulse);
public static native void setEncoderReverseDirection(int encoderHandle,
boolean reverseDirection);
public static native void setEncoderReverseDirection(int encoderHandle, boolean reverseDirection);
public static native void setEncoderSamplesToAverage(int encoderHandle,
int samplesToAverage);
public static native void setEncoderSamplesToAverage(int encoderHandle, int samplesToAverage);
public static native int getEncoderSamplesToAverage(int encoderHandle);
public static native void setEncoderIndexSource(int encoderHandle, int digitalSourceHandle,
int analogTriggerType, int indexingType);
public static native void setEncoderIndexSource(
int encoderHandle, int digitalSourceHandle, int analogTriggerType, int indexingType);
@SuppressWarnings("AbbreviationAsWordInName")
public static native int getEncoderFPGAIndex(int encoderHandle);

View File

@@ -9,7 +9,8 @@ import java.util.ArrayList;
import java.util.List;
/**
* JNI Wrapper for HAL<br>.
* JNI Wrapper for HAL<br>
* .
*/
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName"})
public final class HAL extends JNIWrapper {
@@ -30,8 +31,8 @@ public final class HAL extends JNIWrapper {
public static final List<Runnable> s_simPeriodicBefore = new ArrayList<>();
/**
* Runs SimPeriodicBefore callbacks. IterativeRobotBase calls this prior
* to the user's simulationPeriodic code.
* Runs SimPeriodicBefore callbacks. IterativeRobotBase calls this prior to the user's
* simulationPeriodic code.
*/
public static void simPeriodicBefore() {
simPeriodicBeforeNative();
@@ -47,8 +48,8 @@ public final class HAL extends JNIWrapper {
public static final List<Runnable> s_simPeriodicAfter = new ArrayList<>();
/**
* Runs SimPeriodicAfter callbacks. IterativeRobotBase calls this after
* the user's simulationPeriodic code.
* Runs SimPeriodicAfter callbacks. IterativeRobotBase calls this after the user's
* simulationPeriodic code.
*/
public static void simPeriodicAfter() {
simPeriodicAfterNative();
@@ -83,13 +84,12 @@ public final class HAL extends JNIWrapper {
* <p>Original signature: <code>uint32_t report(tResourceType, uint8_t, uint8_t, const
* char*)</code>
*
* @param resource one of the values in the tResourceType above (max value 51). <br>
* @param resource one of the values in the tResourceType above (max value 51). <br>
* @param instanceNumber an index that identifies the resource instance. <br>
* @param context an optional additional context number for some cases (such as module
* number). Set to 0 to omit. <br>
* @param feature a string to be included describing features in use on a specific
* resource. Setting the same resource more than once allows you to change
* the feature string.
* @param context an optional additional context number for some cases (such as module number).
* Set to 0 to omit. <br>
* @param feature a string to be included describing features in use on a specific resource.
* Setting the same resource more than once allows you to change the feature string.
*/
public static native int report(int resource, int instanceNumber, int context, String feature);
@@ -98,8 +98,13 @@ public final class HAL extends JNIWrapper {
@SuppressWarnings("MissingJavadocMethod")
public static void getControlWord(ControlWord controlWord) {
int word = nativeGetControlWord();
controlWord.update((word & 1) != 0, ((word >> 1) & 1) != 0, ((word >> 2) & 1) != 0,
((word >> 3) & 1) != 0, ((word >> 4) & 1) != 0, ((word >> 5) & 1) != 0);
controlWord.update(
(word & 1) != 0,
((word >> 1) & 1) != 0,
((word >> 2) & 1) != 0,
((word >> 3) & 1) != 0,
((word >> 4) & 1) != 0,
((word >> 5) & 1) != 0);
}
private static native int nativeGetAllianceStation();
@@ -142,8 +147,8 @@ public final class HAL extends JNIWrapper {
public static native int getJoystickButtons(byte joystickNum, ByteBuffer count);
public static native int setJoystickOutputs(byte joystickNum, int outputs, short leftRumble,
short rightRumble);
public static native int setJoystickOutputs(
byte joystickNum, int outputs, short leftRumble, short rightRumble);
public static native int getJoystickIsXbox(byte joystickNum);
@@ -161,9 +166,14 @@ public final class HAL extends JNIWrapper {
public static native int getMatchInfo(MatchInfoData info);
public static native int sendError(boolean isError, int errorCode, boolean isLVCode,
String details, String location, String callStack,
boolean printMsg);
public static native int sendError(
boolean isError,
int errorCode,
boolean isLVCode,
String details,
String location,
String callStack,
boolean printMsg);
public static native int sendConsoleLine(String line);
@@ -171,7 +181,5 @@ public final class HAL extends JNIWrapper {
public static native int getPort(byte channel);
private HAL() {
}
private HAL() {}
}

View File

@@ -35,7 +35,5 @@ public final class HALUtil extends JNIWrapper {
return getHALstrerror(getHALErrno());
}
private HALUtil() {
}
private HALUtil() {}
}

View File

@@ -27,9 +27,7 @@ public final class HALValue {
m_long = value;
}
private HALValue() {
}
private HALValue() {}
/**
* Get the type of the value.
@@ -41,7 +39,7 @@ public final class HALValue {
}
/**
* Get the value as a boolean. Does not perform type checking.
* Get the value as a boolean. Does not perform type checking.
*
* @return value contents
*/
@@ -50,7 +48,7 @@ public final class HALValue {
}
/**
* Get the value as a long. Does not perform type checking.
* Get the value as a long. Does not perform type checking.
*
* @return value contents
*/
@@ -59,7 +57,7 @@ public final class HALValue {
}
/**
* Get the value as a double. Does not perform type checking.
* Get the value as a double. Does not perform type checking.
*
* @return value contents
*/
@@ -68,7 +66,7 @@ public final class HALValue {
}
/**
* Get the native long value. Does not perform type checking.
* Get the native long value. Does not perform type checking.
*
* @return value contents
*/
@@ -77,7 +75,7 @@ public final class HALValue {
}
/**
* Get the native double value. Does not perform type checking.
* Get the native double value. Does not perform type checking.
*
* @return value contents
*/

View File

@@ -10,21 +10,30 @@ import java.nio.ByteBuffer;
public class I2CJNI extends JNIWrapper {
public static native void i2CInitialize(int port);
public static native int i2CTransaction(int port, byte address, ByteBuffer dataToSend,
byte sendSize, ByteBuffer dataReceived, byte receiveSize);
public static native int i2CTransaction(
int port,
byte address,
ByteBuffer dataToSend,
byte sendSize,
ByteBuffer dataReceived,
byte receiveSize);
public static native int i2CTransactionB(int port, byte address, byte[] dataToSend,
byte sendSize, byte[] dataReceived, byte receiveSize);
public static native int i2CTransactionB(
int port,
byte address,
byte[] dataToSend,
byte sendSize,
byte[] dataReceived,
byte receiveSize);
public static native int i2CWrite(int port, byte address, ByteBuffer dataToSend, byte sendSize);
public static native int i2CWriteB(int port, byte address, byte[] dataToSend, byte sendSize);
public static native int i2CRead(int port, byte address, ByteBuffer dataReceived,
byte receiveSize);
public static native int i2CRead(
int port, byte address, ByteBuffer dataReceived, byte receiveSize);
public static native int i2CReadB(int port, byte address, byte[] dataReceived,
byte receiveSize);
public static native int i2CReadB(int port, byte address, byte[] dataReceived, byte receiveSize);
public static native void i2CClose(int port);
}

View File

@@ -15,8 +15,8 @@ public class InterruptJNI extends JNIWrapper {
public static native void cleanInterrupts(int interruptHandle);
public static native int waitForInterrupt(int interruptHandle, double timeout,
boolean ignorePrevious);
public static native int waitForInterrupt(
int interruptHandle, double timeout, boolean ignorePrevious);
public static native void enableInterrupts(int interruptHandle);
@@ -26,15 +26,14 @@ public class InterruptJNI extends JNIWrapper {
public static native long readInterruptFallingTimestamp(int interruptHandle);
public static native void requestInterrupts(int interruptHandle, int digitalSourceHandle,
int analogTriggerType);
public static native void requestInterrupts(
int interruptHandle, int digitalSourceHandle, int analogTriggerType);
public static native void attachInterruptHandler(int interruptHandle,
InterruptJNIHandlerFunction handler,
Object param);
public static native void attachInterruptHandler(
int interruptHandle, InterruptJNIHandlerFunction handler, Object param);
public static native void setInterruptUpSourceEdge(int interruptHandle, boolean risingEdge,
boolean fallingEdge);
public static native void setInterruptUpSourceEdge(
int interruptHandle, boolean risingEdge, boolean fallingEdge);
public static native void releaseWaitingInterrupt(int interruptHandle);
}

View File

@@ -4,14 +4,11 @@
package edu.wpi.first.hal;
import edu.wpi.first.wpiutil.RuntimeLoader;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import edu.wpi.first.wpiutil.RuntimeLoader;
/**
* Base class for all JNI wrappers.
*/
/** Base class for all JNI wrappers. */
public class JNIWrapper {
static boolean libraryLoaded = false;
static RuntimeLoader<JNIWrapper> loader = null;
@@ -31,7 +28,9 @@ public class JNIWrapper {
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader = new RuntimeLoader<>("wpiHaljni", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader =
new RuntimeLoader<>(
"wpiHaljni", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();
@@ -41,14 +40,14 @@ public class JNIWrapper {
}
}
/**
* Force load the library.
*/
/** Force load the library. */
public static synchronized void forceLoad() throws IOException {
if (libraryLoaded) {
return;
}
loader = new RuntimeLoader<>("wpiHaljni", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader =
new RuntimeLoader<>(
"wpiHaljni", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader.loadLibrary();
libraryLoaded = true;
}

View File

@@ -4,46 +4,36 @@
package edu.wpi.first.hal;
/**
* Structure for holding the match info data request.
*/
/** Structure for holding the match info data request. */
public class MatchInfoData {
/**
* Stores the event name.
*/
/** Stores the event name. */
@SuppressWarnings("MemberName")
public String eventName = "";
/**
* Stores the game specific message.
*/
/** Stores the game specific message. */
@SuppressWarnings("MemberName")
public String gameSpecificMessage = "";
/**
* Stores the match number.
*/
/** Stores the match number. */
@SuppressWarnings("MemberName")
public int matchNumber;
/**
* Stores the replay number.
*/
/** Stores the replay number. */
@SuppressWarnings("MemberName")
public int replayNumber;
/**
* Stores the match type.
*/
/** Stores the match type. */
@SuppressWarnings("MemberName")
public int matchType;
/**
* Called from JNI to set the structure data.
*/
/** Called from JNI to set the structure data. */
@SuppressWarnings("MissingJavadocMethod")
public void setData(String eventName, String gameSpecificMessage,
int matchNumber, int replayNumber, int matchType) {
public void setData(
String eventName,
String gameSpecificMessage,
int matchNumber,
int replayNumber,
int matchType) {
this.eventName = eventName;
this.gameSpecificMessage = gameSpecificMessage;
this.matchNumber = matchNumber;

View File

@@ -11,40 +11,30 @@ package edu.wpi.first.hal;
* class, which corresponds to the C++ Notifier class, should be used.
*/
public class NotifierJNI extends JNIWrapper {
/**
* Initializes the notifier.
*/
/** Initializes the notifier. */
public static native int initializeNotifier();
/**
* Sets the name of the notifier.
*/
/** Sets the name of the notifier. */
public static native void setNotifierName(int notifierHandle, String name);
/**
* Wakes up the waiter with time=0. Note: after this function is called, all
* calls to waitForNotifierAlarm() will immediately start returning 0.
* Wakes up the waiter with time=0. Note: after this function is called, all calls to
* waitForNotifierAlarm() will immediately start returning 0.
*/
public static native void stopNotifier(int notifierHandle);
/**
* Deletes the notifier object when we are done with it.
*/
/** Deletes the notifier object when we are done with it. */
public static native void cleanNotifier(int notifierHandle);
/**
* Sets the notifier to wakeup the waiter in another triggerTime microseconds.
*/
/** Sets the notifier to wakeup the waiter in another triggerTime microseconds. */
public static native void updateNotifierAlarm(int notifierHandle, long triggerTime);
/**
* Cancels any pending wakeups set by updateNotifierAlarm(). Does NOT wake
* up any waiters.
*/
/** Cancels any pending wakeups set by updateNotifierAlarm(). Does NOT wake up any waiters. */
public static native void cancelNotifierAlarm(int notifierHandle);
/**
* Block until woken up by an alarm (or stop).
*
* @return Time when woken up.
*/
public static native long waitForNotifierAlarm(int notifierHandle);

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* Structure for holding the config data result for PWM.
*/
/** Structure for holding the config data result for PWM. */
public class PWMConfigDataResult {
PWMConfigDataResult(int max, int deadbandMax, int center, int deadbandMin, int min) {
this.max = max;
@@ -16,33 +14,23 @@ public class PWMConfigDataResult {
this.min = min;
}
/**
* The maximum PWM value.
*/
/** The maximum PWM value. */
@SuppressWarnings("MemberName")
public int max;
/**
* The deadband maximum PWM value.
*/
/** The deadband maximum PWM value. */
@SuppressWarnings("MemberName")
public int deadbandMax;
/**
* The center PWM value.
*/
/** The center PWM value. */
@SuppressWarnings("MemberName")
public int center;
/**
* The deadband minimum PWM value.
*/
/** The deadband minimum PWM value. */
@SuppressWarnings("MemberName")
public int deadbandMin;
/**
* The minimum PWM value.
*/
/** The minimum PWM value. */
@SuppressWarnings("MemberName")
public int min;
}

View File

@@ -12,13 +12,21 @@ public class PWMJNI extends DIOJNI {
public static native void freePWMPort(int pwmPortHandle);
public static native void setPWMConfigRaw(int pwmPortHandle, int maxPwm,
int deadbandMaxPwm, int centerPwm,
int deadbandMinPwm, int minPwm);
public static native void setPWMConfigRaw(
int pwmPortHandle,
int maxPwm,
int deadbandMaxPwm,
int centerPwm,
int deadbandMinPwm,
int minPwm);
public static native void setPWMConfig(int pwmPortHandle, double maxPwm,
double deadbandMaxPwm, double centerPwm,
double deadbandMinPwm, double minPwm);
public static native void setPWMConfig(
int pwmPortHandle,
double maxPwm,
double deadbandMaxPwm,
double centerPwm,
double deadbandMinPwm,
double minPwm);
public static native PWMConfigDataResult getPWMConfigRaw(int pwmPortHandle);
@@ -38,7 +46,7 @@ public class PWMJNI extends DIOJNI {
public static native double getPWMPosition(int pwmPortHandle);
public static native void setPWMDisabled(int pwmPortHandle);
public static native void setPWMDisabled(int pwmPortHandle);
public static native void latchPWMZero(int pwmPortHandle);

View File

@@ -10,11 +10,11 @@ import java.nio.ByteBuffer;
public class SPIJNI extends JNIWrapper {
public static native void spiInitialize(int port);
public static native int spiTransaction(int port, ByteBuffer dataToSend,
ByteBuffer dataReceived, byte size);
public static native int spiTransaction(
int port, ByteBuffer dataToSend, ByteBuffer dataReceived, byte size);
public static native int spiTransactionB(int port, byte[] dataToSend,
byte[] dataReceived, byte size);
public static native int spiTransactionB(
int port, byte[] dataToSend, byte[] dataReceived, byte size);
public static native int spiWrite(int port, ByteBuffer dataToSend, byte sendSize);
@@ -28,8 +28,8 @@ public class SPIJNI extends JNIWrapper {
public static native void spiSetSpeed(int port, int speed);
public static native void spiSetOpts(int port, int msbFirst, int sampleOnTrailing,
int clkIdleHigh);
public static native void spiSetOpts(
int port, int msbFirst, int sampleOnTrailing, int clkIdleHigh);
public static native void spiSetChipSelectActiveHigh(int port);
@@ -41,9 +41,12 @@ public class SPIJNI extends JNIWrapper {
public static native void spiStartAutoRate(int port, double period);
public static native void spiStartAutoTrigger(int port, int digitalSourceHandle,
int analogTriggerType, boolean triggerRising,
boolean triggerFalling);
public static native void spiStartAutoTrigger(
int port,
int digitalSourceHandle,
int analogTriggerType,
boolean triggerRising,
boolean triggerFalling);
public static native void spiStopAuto(int port);
@@ -51,13 +54,14 @@ public class SPIJNI extends JNIWrapper {
public static native void spiForceAutoRead(int port);
public static native int spiReadAutoReceivedData(int port, ByteBuffer buffer, int numToRead,
double timeout);
public static native int spiReadAutoReceivedData(
int port, ByteBuffer buffer, int numToRead, double timeout);
public static native int spiReadAutoReceivedData(int port, int[] buffer, int numToRead,
double timeout);
public static native int spiReadAutoReceivedData(
int port, int[] buffer, int numToRead, double timeout);
public static native int spiGetAutoDroppedCount(int port);
public static native void spiConfigureAutoStall(int port, int csToSclkTicks, int stallTicks, int pow2BytesPerRead);
public static native void spiConfigureAutoStall(
int port, int csToSclkTicks, int stallTicks, int pow2BytesPerRead);
}

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper around a simulator boolean value handle.
*/
/** A wrapper around a simulator boolean value handle. */
public class SimBoolean extends SimValue {
/**
* Wraps a simulated value handle as returned by SimDeviceJNI.createSimValueBoolean().

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper around a simulator device handle.
*/
/** A wrapper around a simulator device handle. */
public class SimDevice implements AutoCloseable {
public enum Direction {
kInput(SimDeviceJNI.kInput),
@@ -23,10 +21,9 @@ public class SimDevice implements AutoCloseable {
/**
* Creates a simulated device.
*
* <p>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]".
* <p>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]".
*
* <p>null is returned if not in simulation.
*
@@ -44,10 +41,9 @@ public class SimDevice implements AutoCloseable {
/**
* Creates a simulated device.
*
* <p>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.
* <p>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.
*
* <p>null is returned if not in simulation.
*
@@ -62,10 +58,9 @@ public class SimDevice implements AutoCloseable {
/**
* Creates a simulated device.
*
* <p>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.
* <p>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.
*
* <p>null is returned if not in simulation.
*
@@ -110,7 +105,6 @@ public class SimDevice implements AutoCloseable {
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated value object
*
* @deprecated Use direction function instead
*/
@Deprecated
@@ -145,7 +139,6 @@ public class SimDevice implements AutoCloseable {
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated double value object
*
* @deprecated Use direction function instead
*/
@Deprecated
@@ -183,7 +176,6 @@ public class SimDevice implements AutoCloseable {
* @param options array of option descriptions
* @param initialValue initial value (selection)
* @return simulated enum value object
*
* @deprecated Use direction function instead
*/
@Deprecated
@@ -205,8 +197,8 @@ public class SimDevice implements AutoCloseable {
* @return simulated enum value object
*/
public SimEnum createEnum(String name, Direction direction, String[] options, int initialValue) {
int handle = SimDeviceJNI.createSimValueEnum(m_handle, name, direction.m_value, options,
initialValue);
int handle =
SimDeviceJNI.createSimValueEnum(m_handle, name, direction.m_value, options, initialValue);
if (handle <= 0) {
return null;
}
@@ -227,10 +219,11 @@ public class SimDevice implements AutoCloseable {
* @param initialValue initial value (selection)
* @return simulated enum value object
*/
public SimEnum createEnumDouble(String name, Direction direction, String[] options,
double[] optionValues, int initialValue) {
int handle = SimDeviceJNI.createSimValueEnumDouble(m_handle, name, direction.m_value, options,
optionValues, initialValue);
public SimEnum createEnumDouble(
String name, Direction direction, String[] options, double[] optionValues, int initialValue) {
int handle =
SimDeviceJNI.createSimValueEnumDouble(
m_handle, name, direction.m_value, options, optionValues, initialValue);
if (handle <= 0) {
return null;
}
@@ -246,7 +239,6 @@ public class SimDevice implements AutoCloseable {
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated boolean value object
*
* @deprecated Use direction function instead
*/
@Deprecated
@@ -265,8 +257,8 @@ public class SimDevice implements AutoCloseable {
* @return simulated boolean value object
*/
public SimBoolean createBoolean(String name, Direction direction, boolean initialValue) {
int handle = SimDeviceJNI.createSimValueBoolean(m_handle, name, direction.m_value,
initialValue);
int handle =
SimDeviceJNI.createSimValueBoolean(m_handle, name, direction.m_value, initialValue);
if (handle <= 0) {
return null;
}

View File

@@ -12,10 +12,9 @@ public class SimDeviceJNI extends JNIWrapper {
/**
* Creates a simulated device.
*
* <p>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]".
* <p>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]".
*
* <p>0 is returned if not in simulation.
*
@@ -27,42 +26,44 @@ public class SimDeviceJNI extends JNIWrapper {
/**
* Frees a simulated device.
*
* <p>This also allows the same device name to be used again.
* This also frees all the simulated values created on the device.
* <p>This also allows the same device name to be used again. This also frees all the simulated
* values created on the device.
*
* @param handle simulated device handle
*/
public static native void freeSimDevice(int handle);
private static native int createSimValueNative(int device, String name, int direction,
int type, long value1, double value2);
private static native int createSimValueNative(
int device, String name, int direction, int type, long value1, double value2);
/**
* Creates a value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated value handle
*
* @deprecated Use direction-taking function instead
*/
@Deprecated
public static int createSimValue(int device, String name, boolean readonly,
HALValue initialValue) {
return createSimValueNative(device, name, readonly ? kOutput : kInput, initialValue.getType(),
initialValue.getNativeLong(), initialValue.getNativeDouble());
public static int createSimValue(
int device, String name, boolean readonly, HALValue initialValue) {
return createSimValueNative(
device,
name,
readonly ? kOutput : kInput,
initialValue.getType(),
initialValue.getNativeLong(),
initialValue.getNativeDouble());
}
/**
* Creates a value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -70,37 +71,39 @@ public class SimDeviceJNI extends JNIWrapper {
* @param initialValue initial value
* @return simulated value handle
*/
public static int createSimValue(int device, String name, int direction,
HALValue initialValue) {
return createSimValueNative(device, name, direction, initialValue.getType(),
initialValue.getNativeLong(), initialValue.getNativeDouble());
public static int createSimValue(int device, String name, int direction, HALValue initialValue) {
return createSimValueNative(
device,
name,
direction,
initialValue.getType(),
initialValue.getNativeLong(),
initialValue.getNativeDouble());
}
/**
* Creates a double value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated value handle
*
* @deprecated Use direction-taking function instead
*/
@Deprecated
public static int createSimValueDouble(int device, String name, boolean readonly,
double initialValue) {
return createSimValueNative(device, name, readonly ? kOutput : kInput, HALValue.kDouble, 0, initialValue);
public static int createSimValueDouble(
int device, String name, boolean readonly, double initialValue) {
return createSimValueNative(
device, name, readonly ? kOutput : kInput, HALValue.kDouble, 0, initialValue);
}
/**
* Creates a double value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -108,8 +111,8 @@ public class SimDeviceJNI extends JNIWrapper {
* @param initialValue initial value
* @return simulated value handle
*/
public static int createSimValueDouble(int device, String name, int direction,
double initialValue) {
public static int createSimValueDouble(
int device, String name, int direction, double initialValue) {
return createSimValueNative(device, name, direction, HALValue.kDouble, 0, initialValue);
}
@@ -118,8 +121,7 @@ public class SimDeviceJNI extends JNIWrapper {
*
* <p>Enumerated values are always in the range 0 to numOptions-1.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -127,12 +129,11 @@ public class SimDeviceJNI extends JNIWrapper {
* @param options array of option descriptions
* @param initialValue initial value (selection)
* @return simulated value handle
*
* @deprecated Use direction-taking function instead
*/
@Deprecated
public static int createSimValueEnum(int device, String name, boolean readonly,
String[] options, int initialValue) {
public static int createSimValueEnum(
int device, String name, boolean readonly, String[] options, int initialValue) {
return createSimValueEnum(device, name, readonly ? kOutput : kInput, options, initialValue);
}
@@ -141,8 +142,7 @@ public class SimDeviceJNI extends JNIWrapper {
*
* <p>Enumerated values are always in the range 0 to numOptions-1.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -151,16 +151,15 @@ public class SimDeviceJNI extends JNIWrapper {
* @param initialValue initial value (selection)
* @return simulated value handle
*/
public static native int createSimValueEnum(int device, String name, int direction,
String[] options, int initialValue);
public static native int createSimValueEnum(
int device, String name, int direction, String[] options, int initialValue);
/**
* Creates an enumerated value on a simulated device with double values.
*
* <p>Enumerated values are always in the range 0 to numOptions-1.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -170,35 +169,37 @@ public class SimDeviceJNI extends JNIWrapper {
* @param initialValue initial value (selection)
* @return simulated value handle
*/
public static native int createSimValueEnumDouble(int device, String name, int direction,
String[] options, double[] optionValues, int initialValue);
public static native int createSimValueEnumDouble(
int device,
String name,
int direction,
String[] options,
double[] optionValues,
int initialValue);
/**
* Creates a boolean value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
* @param readonly if the value should not be written from simulation side
* @param initialValue initial value
* @return simulated value handle
*
* @deprecated Use direction-taking function instead
*/
@Deprecated
public static int createSimValueBoolean(int device, String name, boolean readonly,
boolean initialValue) {
return createSimValueNative(device, name, readonly ? kOutput : kInput, HALValue.kBoolean,
initialValue ? 1 : 0, 0.0);
public static int createSimValueBoolean(
int device, String name, boolean readonly, boolean initialValue) {
return createSimValueNative(
device, name, readonly ? kOutput : kInput, HALValue.kBoolean, initialValue ? 1 : 0, 0.0);
}
/**
* Creates a boolean value on a simulated device.
*
* <p>Returns 0 if not in simulation; this can be used to avoid calls
* to Set/Get functions.
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
*
* @param device simulated device handle
* @param name value name
@@ -206,10 +207,10 @@ public class SimDeviceJNI extends JNIWrapper {
* @param initialValue initial value
* @return simulated value handle
*/
public static int createSimValueBoolean(int device, String name, int direction,
boolean initialValue) {
return createSimValueNative(device, name, direction, HALValue.kBoolean,
initialValue ? 1 : 0, 0.0);
public static int createSimValueBoolean(
int device, String name, int direction, boolean initialValue) {
return createSimValueNative(
device, name, direction, HALValue.kBoolean, initialValue ? 1 : 0, 0.0);
}
/**

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper around a simulator double value handle.
*/
/** A wrapper around a simulator double value handle. */
public class SimDouble extends SimValue {
/**
* Wraps a simulated value handle as returned by SimDeviceJNI.createSimValueDouble().

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper around a simulator enum value handle.
*/
/** A wrapper around a simulator enum value handle. */
public class SimEnum extends SimValue {
/**
* Wraps a simulated value handle as returned by SimDeviceJNI.createSimValueEnum().

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal;
/**
* A wrapper around a simulator value handle.
*/
/** A wrapper around a simulator value handle. */
public class SimValue {
/**
* Wraps a simulated value handle as returned by SimDeviceJNI.createSimValue().

View File

@@ -15,8 +15,9 @@ public final class CANExceptionFactory {
static final int ERR_CANSessionMux_NotInitialized = -44089;
@SuppressWarnings({"MissingJavadocMethod", "PMD.CyclomaticComplexity"})
public static void checkStatus(int status, int messageID) throws CANInvalidBufferException,
CANMessageNotAllowedException, CANNotInitializedException, UncleanStatusException {
public static void checkStatus(int status, int messageID)
throws CANInvalidBufferException, CANMessageNotAllowedException, CANNotInitializedException,
UncleanStatusException {
switch (status) {
case NIRioStatus.kRioStatusSuccess:
// Everything is ok... don't throw.
@@ -38,7 +39,5 @@ public final class CANExceptionFactory {
}
}
private CANExceptionFactory() {
}
private CANExceptionFactory() {}
}

View File

@@ -4,11 +4,10 @@
package edu.wpi.first.hal.can;
import edu.wpi.first.hal.JNIWrapper;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import edu.wpi.first.hal.JNIWrapper;
@SuppressWarnings("AbbreviationAsWordInName")
public class CANJNI extends JNIWrapper {
public static final int CAN_SEND_PERIOD_NO_REPEAT = 0;
@@ -19,15 +18,13 @@ public class CANJNI extends JNIWrapper {
public static final int CAN_IS_FRAME_11BIT = 0x40000000;
@SuppressWarnings("MethodName")
public static native void FRCNetCommCANSessionMuxSendMessage(int messageID,
byte[] data,
int periodMs);
public static native void FRCNetCommCANSessionMuxSendMessage(
int messageID, byte[] data, int periodMs);
@SuppressWarnings("MethodName")
public static native byte[] FRCNetCommCANSessionMuxReceiveMessage(
IntBuffer messageID, int messageIDMask, ByteBuffer timeStamp);
@SuppressWarnings("MethodName")
public static native void GetCANStatus(CANStatus status);
}

View File

@@ -4,43 +4,35 @@
package edu.wpi.first.hal.can;
/**
* Structure for holding the result of a CAN Status request.
*/
/** Structure for holding the result of a CAN Status request. */
public class CANStatus {
/**
* The utilization of the CAN Bus.
*/
/** The utilization of the CAN Bus. */
@SuppressWarnings("MemberName")
public double percentBusUtilization;
/**
* The CAN Bus off count.
*/
/** The CAN Bus off count. */
@SuppressWarnings("MemberName")
public int busOffCount;
/**
* The CAN Bus TX full count.
*/
/** The CAN Bus TX full count. */
@SuppressWarnings("MemberName")
public int txFullCount;
/**
* The CAN Bus receive error count.
*/
/** The CAN Bus receive error count. */
@SuppressWarnings("MemberName")
public int receiveErrorCount;
/**
* The CAN Bus transmit error count.
*/
/** The CAN Bus transmit error count. */
@SuppressWarnings("MemberName")
public int transmitErrorCount;
@SuppressWarnings("MissingJavadocMethod")
public void setStatus(double percentBusUtilization, int busOffCount, int txFullCount,
int receiveErrorCount, int transmitErrorCount) {
public void setStatus(
double percentBusUtilization,
int busOffCount,
int txFullCount,
int receiveErrorCount,
int transmitErrorCount) {
this.percentBusUtilization = percentBusUtilization;
this.busOffCount = busOffCount;
this.txFullCount = txFullCount;

View File

@@ -7,29 +7,49 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AccelerometerDataJNI extends JNIWrapper {
public static native int registerActiveCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerActiveCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelActiveCallback(int index, int uid);
public static native boolean getActive(int index);
public static native void setActive(int index, boolean active);
public static native int registerRangeCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerRangeCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelRangeCallback(int index, int uid);
public static native int getRange(int index);
public static native void setRange(int index, int range);
public static native int registerXCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerXCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelXCallback(int index, int uid);
public static native double getX(int index);
public static native void setX(int index, double x);
public static native int registerYCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerYCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelYCallback(int index, int uid);
public static native double getY(int index);
public static native void setY(int index, double y);
public static native int registerZCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerZCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelZCallback(int index, int uid);
public static native double getZ(int index);
public static native void setZ(int index, double z);
public static native void resetData(int index);

View File

@@ -7,29 +7,48 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AddressableLEDDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerOutputPortCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerOutputPortCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelOutputPortCallback(int index, int uid);
public static native int getOutputPort(int index);
public static native void setOutputPort(int index, int outputPort);
public static native int registerLengthCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerLengthCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelLengthCallback(int index, int uid);
public static native int getLength(int index);
public static native void setLength(int index, int length);
public static native int registerRunningCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerRunningCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelRunningCallback(int index, int uid);
public static native boolean getRunning(int index);
public static native void setRunning(int index, boolean running);
public static native int registerDataCallback(int index, ConstBufferCallback callback);
public static native void cancelDataCallback(int index, int uid);
public static native byte[] getData(int index);
public static native void setData(int index, byte[] data);
public static native void resetData(int index);

View File

@@ -7,19 +7,31 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AnalogGyroDataJNI extends JNIWrapper {
public static native int registerAngleCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAngleCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAngleCallback(int index, int uid);
public static native double getAngle(int index);
public static native void setAngle(int index, double angle);
public static native int registerRateCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerRateCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelRateCallback(int index, int uid);
public static native double getRate(int index);
public static native void setRate(int index, double rate);
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native void resetData(int index);

View File

@@ -7,49 +7,85 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AnalogInDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerAverageBitsCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAverageBitsCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAverageBitsCallback(int index, int uid);
public static native int getAverageBits(int index);
public static native void setAverageBits(int index, int averageBits);
public static native int registerOversampleBitsCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerOversampleBitsCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelOversampleBitsCallback(int index, int uid);
public static native int getOversampleBits(int index);
public static native void setOversampleBits(int index, int oversampleBits);
public static native int registerVoltageCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerVoltageCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelVoltageCallback(int index, int uid);
public static native double getVoltage(int index);
public static native void setVoltage(int index, double voltage);
public static native int registerAccumulatorInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAccumulatorInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAccumulatorInitializedCallback(int index, int uid);
public static native boolean getAccumulatorInitialized(int index);
public static native void setAccumulatorInitialized(int index, boolean accumulatorInitialized);
public static native int registerAccumulatorValueCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAccumulatorValueCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAccumulatorValueCallback(int index, int uid);
public static native long getAccumulatorValue(int index);
public static native void setAccumulatorValue(int index, long accumulatorValue);
public static native int registerAccumulatorCountCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAccumulatorCountCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAccumulatorCountCallback(int index, int uid);
public static native long getAccumulatorCount(int index);
public static native void setAccumulatorCount(int index, long accumulatorCount);
public static native int registerAccumulatorCenterCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAccumulatorCenterCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAccumulatorCenterCallback(int index, int uid);
public static native int getAccumulatorCenter(int index);
public static native void setAccumulatorCenter(int index, int AccumulatorCenter);
public static native int registerAccumulatorDeadbandCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerAccumulatorDeadbandCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelAccumulatorDeadbandCallback(int index, int uid);
public static native int getAccumulatorDeadband(int index);
public static native void setAccumulatorDeadband(int index, int AccumulatorDeadband);
public static native void resetData(int index);

View File

@@ -7,14 +7,22 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AnalogOutDataJNI extends JNIWrapper {
public static native int registerVoltageCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerVoltageCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelVoltageCallback(int index, int uid);
public static native double getVoltage(int index);
public static native void setVoltage(int index, double voltage);
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native void resetData(int index);

View File

@@ -7,19 +7,31 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class AnalogTriggerDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerTriggerLowerBoundCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerTriggerLowerBoundCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelTriggerLowerBoundCallback(int index, int uid);
public static native double getTriggerLowerBound(int index);
public static native void setTriggerLowerBound(int index, double triggerLowerBound);
public static native int registerTriggerUpperBoundCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerTriggerUpperBoundCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelTriggerUpperBoundCallback(int index, int uid);
public static native double getTriggerUpperBound(int index);
public static native void setTriggerUpperBound(int index, double triggerUpperBound);
public static native void resetData(int index);

View File

@@ -7,29 +7,49 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class DIODataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerValueCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerValueCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelValueCallback(int index, int uid);
public static native boolean getValue(int index);
public static native void setValue(int index, boolean value);
public static native int registerPulseLengthCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPulseLengthCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPulseLengthCallback(int index, int uid);
public static native double getPulseLength(int index);
public static native void setPulseLength(int index, double pulseLength);
public static native int registerIsInputCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerIsInputCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelIsInputCallback(int index, int uid);
public static native boolean getIsInput(int index);
public static native void setIsInput(int index, boolean isInput);
public static native int registerFilterIndexCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerFilterIndexCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelFilterIndexCallback(int index, int uid);
public static native int getFilterIndex(int index);
public static native void setFilterIndex(int index, int filterIndex);
public static native void resetData(int index);

View File

@@ -7,19 +7,31 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class DigitalPWMDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerDutyCycleCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerDutyCycleCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelDutyCycleCallback(int index, int uid);
public static native double getDutyCycle(int index);
public static native void setDutyCycle(int index, double dutyCycle);
public static native int registerPinCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPinCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPinCallback(int index, int uid);
public static native int getPin(int index);
public static native void setPin(int index, int pin);
public static native void resetData(int index);

View File

@@ -8,76 +8,129 @@ import edu.wpi.first.hal.JNIWrapper;
public class DriverStationDataJNI extends JNIWrapper {
public static native int registerEnabledCallback(NotifyCallback callback, boolean initialNotify);
public static native void cancelEnabledCallback(int uid);
public static native boolean getEnabled();
public static native void setEnabled(boolean enabled);
public static native int registerAutonomousCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerAutonomousCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelAutonomousCallback(int uid);
public static native boolean getAutonomous();
public static native void setAutonomous(boolean autonomous);
public static native int registerTestCallback(NotifyCallback callback, boolean initialNotify);
public static native void cancelTestCallback(int uid);
public static native boolean getTest();
public static native void setTest(boolean test);
public static native int registerEStopCallback(NotifyCallback callback, boolean initialNotify);
public static native void cancelEStopCallback(int uid);
public static native boolean getEStop();
public static native void setEStop(boolean eStop);
public static native int registerFmsAttachedCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerFmsAttachedCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelFmsAttachedCallback(int uid);
public static native boolean getFmsAttached();
public static native void setFmsAttached(boolean fmsAttached);
public static native int registerDsAttachedCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerDsAttachedCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelDsAttachedCallback(int uid);
public static native boolean getDsAttached();
public static native void setDsAttached(boolean dsAttached);
public static native int registerAllianceStationIdCallback(NotifyCallback callback, boolean initialNotify);
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 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 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();

View File

@@ -7,19 +7,31 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class DutyCycleDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerFrequencyCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerFrequencyCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelFrequencyCallback(int index, int uid);
public static native int getFrequency(int index);
public static native void setFrequency(int index, int frequency);
public static native int registerOutputCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerOutputCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelOutputCallback(int index, int uid);
public static native double getOutput(int index);
public static native void setOutput(int index, double output);
public static native void resetData(int index);

View File

@@ -7,49 +7,84 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class EncoderDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerCountCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerCountCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelCountCallback(int index, int uid);
public static native int getCount(int index);
public static native void setCount(int index, int count);
public static native int registerPeriodCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPeriodCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPeriodCallback(int index, int uid);
public static native double getPeriod(int index);
public static native void setPeriod(int index, double period);
public static native int registerResetCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerResetCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelResetCallback(int index, int uid);
public static native boolean getReset(int index);
public static native void setReset(int index, boolean reset);
public static native int registerMaxPeriodCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerMaxPeriodCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelMaxPeriodCallback(int index, int uid);
public static native double getMaxPeriod(int index);
public static native void setMaxPeriod(int index, double maxPeriod);
public static native int registerDirectionCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerDirectionCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelDirectionCallback(int index, int uid);
public static native boolean getDirection(int index);
public static native void setDirection(int index, boolean direction);
public static native int registerReverseDirectionCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerReverseDirectionCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelReverseDirectionCallback(int index, int uid);
public static native boolean getReverseDirection(int index);
public static native void setReverseDirection(int index, boolean reverseDirection);
public static native int registerSamplesToAverageCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerSamplesToAverageCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelSamplesToAverageCallback(int index, int uid);
public static native int getSamplesToAverage(int index);
public static native void setSamplesToAverage(int index, int samplesToAverage);
public static native void setDistance(int index, double distance);
public static native double getDistance(int index);
public static native void setRate(int index, double rate);
public static native double getRate(int index);
public static native void resetData(int index);

View File

@@ -7,15 +7,21 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class I2CDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerReadCallback(int index, BufferCallback callback);
public static native void cancelReadCallback(int index, int uid);
public static native int registerWriteCallback(int index, ConstBufferCallback callback);
public static native void cancelWriteCallback(int index, int uid);
public static native void resetData(int index);

View File

@@ -8,5 +8,6 @@ import edu.wpi.first.hal.JNIWrapper;
public class NotifierDataJNI extends JNIWrapper {
public static native long getNextTimeout();
public static native int getNumNotifiers();
}

View File

@@ -7,43 +7,75 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class PCMDataJNI extends JNIWrapper {
public static native int registerSolenoidInitializedCallback(int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void cancelSolenoidInitializedCallback(int index, int channel, int uid);
public static native boolean getSolenoidInitialized(int index, int channel);
public static native void setSolenoidInitialized(int index, int channel, boolean solenoidInitialized);
public static native int registerSolenoidInitializedCallback(
int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void cancelSolenoidInitializedCallback(int index, int channel, int uid);
public static native boolean getSolenoidInitialized(int index, int channel);
public static native void setSolenoidInitialized(
int index, int channel, boolean solenoidInitialized);
public static native int registerSolenoidOutputCallback(
int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native int registerSolenoidOutputCallback(int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void cancelSolenoidOutputCallback(int index, int channel, int uid);
public static native boolean getSolenoidOutput(int index, int channel);
public static native void setSolenoidOutput(int index, int channel, boolean solenoidOutput);
public static native int registerCompressorInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerCompressorInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelCompressorInitializedCallback(int index, int uid);
public static native boolean getCompressorInitialized(int index);
public static native void setCompressorInitialized(int index, boolean compressorInitialized);
public static native int registerCompressorOnCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerCompressorOnCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelCompressorOnCallback(int index, int uid);
public static native boolean getCompressorOn(int index);
public static native void setCompressorOn(int index, boolean compressorOn);
public static native int registerClosedLoopEnabledCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerClosedLoopEnabledCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelClosedLoopEnabledCallback(int index, int uid);
public static native boolean getClosedLoopEnabled(int index);
public static native void setClosedLoopEnabled(int index, boolean closeLoopEnabled);
public static native int registerPressureSwitchCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPressureSwitchCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPressureSwitchCallback(int index, int uid);
public static native boolean getPressureSwitch(int index);
public static native void setPressureSwitch(int index, boolean pressureSwitch);
public static native int registerCompressorCurrentCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerCompressorCurrentCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelCompressorCurrentCallback(int index, int uid);
public static native double getCompressorCurrent(int index);
public static native void setCompressorCurrent(int index, double compressorCurrent);
public static native void registerAllNonSolenoidCallbacks(int index, NotifyCallback callback, boolean initialNotify);
public static native void registerAllSolenoidCallbacks(int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void registerAllNonSolenoidCallbacks(
int index, NotifyCallback callback, boolean initialNotify);
public static native void registerAllSolenoidCallbacks(
int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void resetData(int index);
}

View File

@@ -7,25 +7,40 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class PDPDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerTemperatureCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerTemperatureCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelTemperatureCallback(int index, int uid);
public static native double getTemperature(int index);
public static native void setTemperature(int index, double temperature);
public static native int registerVoltageCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerVoltageCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelVoltageCallback(int index, int uid);
public static native double getVoltage(int index);
public static native void setVoltage(int index, double voltage);
public static native int registerCurrentCallback(
int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native int registerCurrentCallback(int index, int channel, NotifyCallback callback, boolean initialNotify);
public static native void cancelCurrentCallback(int index, int channel, int uid);
public static native double getCurrent(int index, int channel);
public static native void setCurrent(int index, int channel, double current);
public static native void resetData(int index);

View File

@@ -7,34 +7,58 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class PWMDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerRawValueCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerRawValueCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelRawValueCallback(int index, int uid);
public static native int getRawValue(int index);
public static native void setRawValue(int index, int rawValue);
public static native int registerSpeedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerSpeedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelSpeedCallback(int index, int uid);
public static native double getSpeed(int index);
public static native void setSpeed(int index, double speed);
public static native int registerPositionCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPositionCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPositionCallback(int index, int uid);
public static native double getPosition(int index);
public static native void setPosition(int index, double position);
public static native int registerPeriodScaleCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerPeriodScaleCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelPeriodScaleCallback(int index, int uid);
public static native int getPeriodScale(int index);
public static native void setPeriodScale(int index, int periodScale);
public static native int registerZeroLatchCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerZeroLatchCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelZeroLatchCallback(int index, int uid);
public static native boolean getZeroLatch(int index);
public static native void setZeroLatch(int index, boolean zeroLatch);
public static native void resetData(int index);

View File

@@ -7,24 +7,40 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class RelayDataJNI extends JNIWrapper {
public static native int registerInitializedForwardCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedForwardCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedForwardCallback(int index, int uid);
public static native boolean getInitializedForward(int index);
public static native void setInitializedForward(int index, boolean initializedForward);
public static native int registerInitializedReverseCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedReverseCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedReverseCallback(int index, int uid);
public static native boolean getInitializedReverse(int index);
public static native void setInitializedReverse(int index, boolean initializedReverse);
public static native int registerForwardCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerForwardCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelForwardCallback(int index, int uid);
public static native boolean getForward(int index);
public static native void setForward(int index, boolean forward);
public static native int registerReverseCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerReverseCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelReverseCallback(int index, int uid);
public static native boolean getReverse(int index);
public static native void setReverse(int index, boolean reverse);
public static native void resetData(int index);

View File

@@ -7,79 +7,139 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class RoboRioDataJNI extends JNIWrapper {
public static native int registerFPGAButtonCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerFPGAButtonCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelFPGAButtonCallback(int uid);
public static native boolean getFPGAButton();
public static native void setFPGAButton(boolean fPGAButton);
public static native int registerVInVoltageCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerVInVoltageCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelVInVoltageCallback(int uid);
public static native double getVInVoltage();
public static native void setVInVoltage(double vInVoltage);
public static native int registerVInCurrentCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerVInCurrentCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelVInCurrentCallback(int uid);
public static native double getVInCurrent();
public static native void setVInCurrent(double vInCurrent);
public static native int registerUserVoltage6VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserVoltage6VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserVoltage6VCallback(int uid);
public static native double getUserVoltage6V();
public static native void setUserVoltage6V(double userVoltage6V);
public static native int registerUserCurrent6VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserCurrent6VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserCurrent6VCallback(int uid);
public static native double getUserCurrent6V();
public static native void setUserCurrent6V(double userCurrent6V);
public static native int registerUserActive6VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserActive6VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserActive6VCallback(int uid);
public static native boolean getUserActive6V();
public static native void setUserActive6V(boolean userActive6V);
public static native int registerUserVoltage5VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserVoltage5VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserVoltage5VCallback(int uid);
public static native double getUserVoltage5V();
public static native void setUserVoltage5V(double userVoltage5V);
public static native int registerUserCurrent5VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserCurrent5VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserCurrent5VCallback(int uid);
public static native double getUserCurrent5V();
public static native void setUserCurrent5V(double userCurrent5V);
public static native int registerUserActive5VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserActive5VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserActive5VCallback(int uid);
public static native boolean getUserActive5V();
public static native void setUserActive5V(boolean userActive5V);
public static native int registerUserVoltage3V3Callback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserVoltage3V3Callback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserVoltage3V3Callback(int uid);
public static native double getUserVoltage3V3();
public static native void setUserVoltage3V3(double userVoltage3V3);
public static native int registerUserCurrent3V3Callback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserCurrent3V3Callback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserCurrent3V3Callback(int uid);
public static native double getUserCurrent3V3();
public static native void setUserCurrent3V3(double userCurrent3V3);
public static native int registerUserActive3V3Callback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserActive3V3Callback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserActive3V3Callback(int uid);
public static native boolean getUserActive3V3();
public static native void setUserActive3V3(boolean userActive3V3);
public static native int registerUserFaults6VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserFaults6VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserFaults6VCallback(int uid);
public static native int getUserFaults6V();
public static native void setUserFaults6V(int userFaults6V);
public static native int registerUserFaults5VCallback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserFaults5VCallback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserFaults5VCallback(int uid);
public static native int getUserFaults5V();
public static native void setUserFaults5V(int userFaults5V);
public static native int registerUserFaults3V3Callback(NotifyCallback callback, boolean initialNotify);
public static native int registerUserFaults3V3Callback(
NotifyCallback callback, boolean initialNotify);
public static native void cancelUserFaults3V3Callback(int uid);
public static native int getUserFaults3V3();
public static native void setUserFaults3V3(int userFaults3V3);
public static native void resetData();

View File

@@ -7,29 +7,49 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class SPIAccelerometerDataJNI extends JNIWrapper {
public static native int registerActiveCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerActiveCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelActiveCallback(int index, int uid);
public static native boolean getActive(int index);
public static native void setActive(int index, boolean active);
public static native int registerRangeCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerRangeCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelRangeCallback(int index, int uid);
public static native int getRange(int index);
public static native void setRange(int index, int range);
public static native int registerXCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerXCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelXCallback(int index, int uid);
public static native double getX(int index);
public static native void setX(int index, double x);
public static native int registerYCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerYCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelYCallback(int index, int uid);
public static native double getY(int index);
public static native void setY(int index, double y);
public static native int registerZCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerZCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelZCallback(int index, int uid);
public static native double getZ(int index);
public static native void setZ(int index, double z);
public static native void resetData(int index);

View File

@@ -7,18 +7,26 @@ package edu.wpi.first.hal.simulation;
import edu.wpi.first.hal.JNIWrapper;
public class SPIDataJNI extends JNIWrapper {
public static native int registerInitializedCallback(int index, NotifyCallback callback, boolean initialNotify);
public static native int registerInitializedCallback(
int index, NotifyCallback callback, boolean initialNotify);
public static native void cancelInitializedCallback(int index, int uid);
public static native boolean getInitialized(int index);
public static native void setInitialized(int index, boolean initialized);
public static native int registerReadCallback(int index, BufferCallback callback);
public static native void cancelReadCallback(int index, int uid);
public static native int registerWriteCallback(int index, ConstBufferCallback callback);
public static native void cancelWriteCallback(int index, int uid);
public static native int registerReadAutoReceiveBufferCallback(int index, SpiReadAutoReceiveBufferCallback callback);
public static native int registerReadAutoReceiveBufferCallback(
int index, SpiReadAutoReceiveBufferCallback callback);
public static native void cancelReadAutoReceiveBufferCallback(int index, int uid);
public static native void resetData(int index);

View File

@@ -9,12 +9,17 @@ import edu.wpi.first.hal.JNIWrapper;
public class SimDeviceDataJNI extends JNIWrapper {
public static native void setSimDeviceEnabled(String prefix, boolean enabled);
public static native boolean isSimDeviceEnabled(String name);
public static native int registerSimDeviceCreatedCallback(String prefix, SimDeviceCallback callback, boolean initialNotify);
public static native int registerSimDeviceCreatedCallback(
String prefix, SimDeviceCallback callback, boolean initialNotify);
public static native void cancelSimDeviceCreatedCallback(int uid);
public static native int registerSimDeviceFreedCallback(String prefix, SimDeviceCallback callback, boolean initialNotify);
public static native int registerSimDeviceFreedCallback(
String prefix, SimDeviceCallback callback, boolean initialNotify);
public static native void cancelSimDeviceFreedCallback(int uid);
public static native int getSimDeviceHandle(String name);
@@ -35,20 +40,30 @@ public class SimDeviceDataJNI extends JNIWrapper {
@SuppressWarnings("MemberName")
public int handle;
}
public static native SimDeviceInfo[] enumerateSimDevices(String prefix);
public static native int registerSimValueCreatedCallback(int device, SimValueCallback callback, boolean initialNotify);
public static native int registerSimValueCreatedCallback2(int device, SimValueCallback2 callback, boolean initialNotify);
public static native int registerSimValueCreatedCallback(
int device, SimValueCallback callback, boolean initialNotify);
public static native int registerSimValueCreatedCallback2(
int device, SimValueCallback2 callback, boolean initialNotify);
public static native void cancelSimValueCreatedCallback(int uid);
public static native int registerSimValueChangedCallback(int handle, SimValueCallback callback, boolean initialNotify);
public static native int registerSimValueChangedCallback2(int handle, SimValueCallback2 callback, boolean initialNotify);
public static native int registerSimValueChangedCallback(
int handle, SimValueCallback callback, boolean initialNotify);
public static native int registerSimValueChangedCallback2(
int handle, SimValueCallback2 callback, boolean initialNotify);
public static native void cancelSimValueChangedCallback(int uid);
public static native int getSimValueHandle(int device, String name);
public static class SimValueInfo {
public SimValueInfo(String name, int handle, int direction, int type, long value1, double value2) {
public SimValueInfo(
String name, int handle, int direction, int type, long value1, double value2) {
this.name = name;
this.handle = handle;
this.readonly = direction == 1;
@@ -72,6 +87,7 @@ public class SimDeviceDataJNI extends JNIWrapper {
@SuppressWarnings("MemberName")
public HALValue value;
}
public static native SimValueInfo[] enumerateSimValues(int device);
public static native String[] getSimValueEnumOptions(int handle);

View File

@@ -10,7 +10,8 @@ import edu.wpi.first.hal.HALValue;
public interface SimValueCallback {
void callback(String name, int handle, boolean readonly, HALValue value);
default void callbackNative(String name, int handle, boolean readonly, int type, long value1, double value2) {
default void callbackNative(
String name, int handle, boolean readonly, int type, long value1, double value2) {
callback(name, handle, readonly, HALValue.fromNative(type, value1, value2));
}
}

View File

@@ -10,7 +10,8 @@ import edu.wpi.first.hal.HALValue;
public interface SimValueCallback2 {
void callback(String name, int handle, int direction, HALValue value);
default void callbackNative(String name, int handle, int direction, int type, long value1, double value2) {
default void callbackNative(
String name, int handle, int direction, int type, long value1, double value2) {
callback(name, handle, direction, HALValue.fromNative(type, value1, value2));
}
}

View File

@@ -9,15 +9,25 @@ import edu.wpi.first.hal.JNIWrapper;
public class SimulatorJNI extends JNIWrapper {
public static native void setRuntimeType(int type);
public static native void waitForProgramStart();
public static native void setProgramStarted();
public static native boolean getProgramStarted();
public static native void restartTiming();
public static native void pauseTiming();
public static native void resumeTiming();
public static native boolean isTimingPaused();
public static native void stepTiming(long delta);
public static native void stepTimingAsync(long delta);
public static native void resetHandles();
public static class SimPeriodicBeforeCallback implements AutoCloseable {

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal.util;
/**
* Exception indicating that the resource is already allocated.
*/
/** Exception indicating that the resource is already allocated. */
@SuppressWarnings("serial")
public class AllocationException extends RuntimeException {
/**

View File

@@ -28,8 +28,8 @@ public class BoundaryException extends RuntimeException {
*/
public static void assertWithinBounds(double value, double lower, double upper) {
if (value < lower || value > upper) {
throw new BoundaryException("Value must be between " + lower + " and " + upper + ", " + value
+ " given");
throw new BoundaryException(
"Value must be between " + lower + " and " + upper + ", " + value + " given");
}
}

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal.util;
/**
* Exception indicating that an error has occurred with a HAL Handle.
*/
/** Exception indicating that an error has occurred with a HAL Handle. */
@SuppressWarnings("serial")
public class HalHandleException extends RuntimeException {
/**

View File

@@ -4,9 +4,7 @@
package edu.wpi.first.hal.util;
/**
* Exception for bad status codes from the chip object.
*/
/** Exception for bad status codes from the chip object. */
@SuppressWarnings("serial")
public final class UncleanStatusException extends IllegalStateException {
private final int m_statusCode;
@@ -14,7 +12,7 @@ public final class UncleanStatusException extends IllegalStateException {
/**
* Create a new UncleanStatusException.
*
* @param status the status code that caused the exception
* @param status the status code that caused the exception
* @param message A message describing the exception
*/
public UncleanStatusException(int status, String message) {
@@ -40,9 +38,7 @@ public final class UncleanStatusException extends IllegalStateException {
this(-1, message);
}
/**
* Create a new UncleanStatusException.
*/
/** Create a new UncleanStatusException. */
public UncleanStatusException() {
this(-1, "Status code was non-zero");
}