Class AlertJNI

java.lang.Object
org.wpilib.hardware.hal.JNIWrapper
org.wpilib.hardware.hal.AlertJNI

public class AlertJNI extends JNIWrapper
The AlertJNI class directly wraps the C++ HAL Alert.

This class is not meant for direct use by teams. Instead, the org.wpilib.driverstation.Alert class, which corresponds to the C++ Alert class, should be used.

See Also:
  • "wpi/hal/Alert.h"
  • Field Details

    • LEVEL_HIGH

      public static final int LEVEL_HIGH
      High priority alert - displayed first with a red "X" symbol. Use this type for problems which will seriously affect the robot's functionality and thus require immediate attention.
      See Also:
    • LEVEL_MEDIUM

      public static final int LEVEL_MEDIUM
      Medium priority alert - displayed second with a yellow "!" symbol. Use this type for problems which could affect the robot's functionality but do not necessarily require immediate attention.
      See Also:
    • LEVEL_LOW

      public static final int LEVEL_LOW
      Low priority alert - displayed last with a green "i" symbol. Use this type for problems which are unlikely to affect the robot's functionality, or any other alerts which do not fall under the other categories.
      See Also:
  • Method Details

    • createAlert

      public static int createAlert(String group, String text, int level)
      Creates an alert.
      Parameters:
      group - Group identifier
      text - Text to be displayed when the alert is active
      level - Alert urgency level (LEVEL_HIGH, LEVEL_MEDIUM, LEVEL_LOW)
      Returns:
      the created alert handle
      See Also:
      • "HAL_CreateAlert"
    • destroyAlert

      public static void destroyAlert(int alertHandle)
      Destroys an alert.
      Parameters:
      alertHandle - the alert handle
      See Also:
      • "HAL_DestroyAlert"
    • setAlertActive

      public static void setAlertActive(int alertHandle, boolean active)
      Sets whether the alert should be displayed. This method can be safely be called periodically.
      Parameters:
      alertHandle - the alert handle
      active - true to display the alert, false to hide it
      See Also:
      • "HAL_SetAlertActive"
    • isAlertActive

      public static boolean isAlertActive(int alertHandle)
      Checks if an alert is active.
      Parameters:
      alertHandle - the alert handle
      Returns:
      true if the alert is active
      See Also:
      • "HAL_IsAlertActive"
    • setAlertText

      public static void setAlertText(int alertHandle, String text)
      Sets the text of the alert. Use this method to dynamically change the displayed alert, such as including more details about the detected problem.
      Parameters:
      alertHandle - Alert handle.
      text - new text to be displayed when the alert is active
      See Also:
      • "HAL_SetAlertText"
    • getAlertText

      public static String getAlertText(int alertHandle)
      Gets the text of the alert.
      Parameters:
      alertHandle - Alert handle.
      Returns:
      the text displayed when the alert is active
      See Also:
      • "HAL_GetAlertText"