001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package org.wpilib.hardware.hal.simulation;
006
007import org.wpilib.hardware.hal.JNIWrapper;
008
009/** JNI for alert data. */
010public class AlertDataJNI extends JNIWrapper {
011  /** Information about an alert. */
012  public static class AlertInfo {
013    public AlertInfo(int handle, String group, String text, long activeStartTime, int level) {
014      this.handle = handle;
015      this.group = group;
016      this.text = text;
017      this.activeStartTime = activeStartTime;
018      this.level = level;
019    }
020
021    public final int handle;
022
023    public final String group;
024
025    public final String text;
026
027    public final long activeStartTime; // 0 if not active
028
029    public final int level; // ALERT_LEVEL_HIGH, ALERT_LEVEL_MEDIUM, ALERT_LEVEL_LOW
030  }
031
032  /**
033   * Gets the number of alerts. Note: this is not guaranteed to be consistent with the number of
034   * alerts returned by getAlerts, so the latter's return value should be used to determine how many
035   * alerts were actually filled in.
036   *
037   * @return the number of alerts
038   */
039  public static native int getNumAlerts();
040
041  /**
042   * Gets detailed information about each alert.
043   *
044   * @return Array of information about each alert
045   */
046  public static native AlertInfo[] getAlerts();
047
048  /** Resets all alert simulation data. */
049  public static native void resetData();
050
051  /** Utility class. */
052  private AlertDataJNI() {}
053}