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 @SuppressWarnings("MemberName") 022 public final int handle; 023 024 @SuppressWarnings("MemberName") 025 public final String group; 026 027 @SuppressWarnings("MemberName") 028 public final String text; 029 030 @SuppressWarnings("MemberName") 031 public final long activeStartTime; // 0 if not active 032 033 @SuppressWarnings("MemberName") 034 public final int level; // ALERT_LEVEL_HIGH, ALERT_LEVEL_MEDIUM, ALERT_LEVEL_LOW 035 } 036 037 /** 038 * Gets the number of alerts. Note: this is not guaranteed to be consistent with the number of 039 * alerts returned by getAlerts, so the latter's return value should be used to determine how many 040 * alerts were actually filled in. 041 * 042 * @return the number of alerts 043 */ 044 public static native int getNumAlerts(); 045 046 /** 047 * Gets detailed information about each alert. 048 * 049 * @return Array of information about each alert 050 */ 051 public static native AlertInfo[] getAlerts(); 052 053 /** Resets all alert simulation data. */ 054 public static native void resetData(); 055 056 /** Utility class. */ 057 private AlertDataJNI() {} 058}