mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Add AlertSim function to get only active alerts (#8732)
This commit is contained in:
@@ -71,7 +71,7 @@ public final class AlertSim {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets detailed information about each alert.
|
||||
* Gets detailed information about each alert (including inactive ones).
|
||||
*
|
||||
* @return Alerts
|
||||
*/
|
||||
@@ -84,6 +84,18 @@ public final class AlertSim {
|
||||
return infos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets detailed information about all active alerts.
|
||||
*
|
||||
* @return Alerts
|
||||
*/
|
||||
public static AlertInfo[] getActive() {
|
||||
AlertInfo[] alertInfos = getAll();
|
||||
return java.util.Arrays.stream(alertInfos)
|
||||
.filter(info -> info.activeStartTime != 0)
|
||||
.toArray(AlertInfo[]::new);
|
||||
}
|
||||
|
||||
/** Resets all alert simulation data. */
|
||||
public static void resetData() {
|
||||
AlertDataJNI.resetData();
|
||||
|
||||
Reference in New Issue
Block a user