Add JNI binding to suppress driver station error/warning messages (#2200)

This is to allow suppressing an ugly stack trace/error message in a unit test in #2197. It doesn't support the full HALSIM_SetSendError callback stuff (i.e. you can only suppress, not intercept, stack traces with this).
This commit is contained in:
Declan Freeman-Gleason
2019-12-27 19:11:26 -08:00
committed by Peter Johnson
parent f9a11cce5e
commit c4bd54ef44
3 changed files with 33 additions and 2 deletions

View File

@@ -79,6 +79,15 @@ public class DriverStationSim {
DriverStationDataJNI.notifyNewData();
}
/**
* Toggles suppression of DriverStation.reportError and reportWarning messages.
*
* @param shouldSend If false then messages will will be suppressed.
*/
public void setSendError(boolean shouldSend) {
DriverStationDataJNI.setSendError(shouldSend);
}
public void resetData() {
DriverStationDataJNI.resetData();
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -49,5 +49,7 @@ public class DriverStationDataJNI extends JNIWrapper {
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 resetData();
}