Class AlertableCollection
java.lang.Object
com.ctre.phoenix6.alerts.AlertableCollection
Collection of objects that can report alerts.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classInformation about an alert.static final classInformation about a multi-level alert. -
Constructor Summary
ConstructorsConstructorDescriptionAlertableCollection(String group) Constructs a new collection of alertable objects. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidreport()Reports all alerts in this collection.final AlertableCollectionwithAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter) Adds aPhoenixAlertto this collection.final AlertableCollectionwithAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter, String text) Adds aPhoenixAlertto this collection.final AlertableCollectionwithAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter, String text, double debounceSeconds) Adds aPhoenixAlertto this collection.final AlertableCollectionwithAlertable(PhoenixAlertable alertable) Adds aPhoenixAlertableto this collection.final AlertableCollectionwithBeforeAlerts(Runnable func) Adds a function to run before updating any alerts.final AlertableCollectionwithMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter) Adds aPhoenixMultiAlertto this collection.final AlertableCollectionwithMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter, String text) Adds aPhoenixMultiAlertto this collection.final AlertableCollectionwithMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter, String text, double debounceSeconds) Adds aPhoenixMultiAlertto this collection.
-
Constructor Details
-
AlertableCollection
Constructs a new collection of alertable objects.- Parameters:
group- Alert group identifier
-
-
Method Details
-
report
public final void report()Reports all alerts in this collection. -
withAlertable
Adds aPhoenixAlertableto this collection.- Parameters:
alertable-PhoenixAlertableto register- Returns:
- This collection
-
withAlert
public final AlertableCollection withAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter) Adds aPhoenixAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevel- Alert urgency levelinfoGetter- Function returning theAlertableCollection.AlertInfoto report- Returns:
- This collection
-
withAlert
public final AlertableCollection withAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter, String text) Adds aPhoenixAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevel- Alert urgency levelinfoGetter- Function returning theAlertableCollection.AlertInfoto reporttext- Default alert text to display when the alert is active- Returns:
- This collection
-
withAlert
public final AlertableCollection withAlert(String id, PhoenixAlert.Level level, Supplier<AlertableCollection.AlertInfo> infoGetter, String text, double debounceSeconds) Adds aPhoenixAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevel- Alert urgency levelinfoGetter- Function returning theAlertableCollection.AlertInfoto reporttext- Default alert text to display when the alert is activedebounceSeconds- Debounce time of the alert in seconds, or negative to use the default debounce time (1 second)- Returns:
- This collection
-
withMultiAlert
public final AlertableCollection withMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter) Adds aPhoenixMultiAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevelFlags- Alert urgency levels to includeinfoGetter- Function returning theAlertableCollection.MultiAlertInfoto report- Returns:
- This collection
-
withMultiAlert
public final AlertableCollection withMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter, String text) Adds aPhoenixMultiAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevelFlags- Alert urgency levels to includeinfoGetter- Function returning theAlertableCollection.MultiAlertInfoto reporttext- Default alert text to display when the alert is active- Returns:
- This collection
-
withMultiAlert
public final AlertableCollection withMultiAlert(String id, long levelFlags, Supplier<AlertableCollection.MultiAlertInfo> infoGetter, String text, double debounceSeconds) Adds aPhoenixMultiAlertto this collection.- Parameters:
id- Alert identifier, unique within the grouplevelFlags- Alert urgency levels to includeinfoGetter- Function returning theAlertableCollection.MultiAlertInfoto reporttext- Default alert text to display when the alert is activedebounceSeconds- Debounce time of the alert in seconds, or negative to use the default debounce time (1 second)- Returns:
- This collection
-
withBeforeAlerts
Adds a function to run before updating any alerts. This can be used to perform actions such as a bulk signal refresh so individual alerts do not have to perform refreshes.- Parameters:
func-Runnableto run before any alerts- Returns:
- This collection
-