RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
Alert.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.util;
6
34public class Alert implements AutoCloseable {
36 public enum Level {
42
49
56
57 private final int m_value;
58
59 Level(int value) {
60 m_value = value;
61 }
62
68 public int getValue() {
69 return m_value;
70 }
71 }
72
73 private final Level m_level;
74 private int m_handle;
75
83 public Alert(String id, String text, Level level) {
84 this("Alerts", id, text, level);
85 }
86
95 public Alert(String group, String id, String text, Level level) {
96 m_level = level;
97 m_handle = WPIUtilJNI.createAlert(group, id, text, level.m_value);
98 }
99
106 public void set(boolean active) {
107 WPIUtilJNI.setAlertActive(m_handle, active);
108 }
109
115 public boolean get() {
116 return WPIUtilJNI.isAlertActive(m_handle);
117 }
118
125 public void setText(String text) {
126 WPIUtilJNI.setAlertText(m_handle, text);
127 }
128
134 public String getText() {
135 return WPIUtilJNI.getAlertText(m_handle);
136 }
137
143 public Level getLevel() {
144 return m_level;
145 }
146
147 @Override
148 public void close() {
149 if (m_handle != 0) {
150 WPIUtilJNI.destroyAlert(m_handle);
151 m_handle = 0;
152 }
153 }
154}
Alert(String id, String text, Level level)
Definition Alert.java:83
void setText(String text)
Definition Alert.java:125
Alert(String group, String id, String text, Level level)
Definition Alert.java:95