Class NotifierJNI
This class is not meant for direct use by teams. Instead, the org.wpilib.system.Notifier class, which corresponds to the C++ Notifier class, should be used.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JNIWrapper
JNIWrapper.Helper -
Method Summary
Modifier and TypeMethodDescriptionstatic voidacknowledgeNotifierAlarm(int notifierHandle) Indicates the notifier alarm has been serviced.static voidcancelNotifierAlarm(int notifierHandle, boolean ack) Cancels all future notifier alarms for a notifier.static intCreates a notifier.static voiddestroyNotifier(int notifierHandle) Destroys a notifier.static intgetNotifierOverrun(int notifierHandle) Gets the overrun count for a notifier.static booleansetHALThreadPriority(boolean realTime, int priority) Sets the HAL notifier thread priority.static voidsetNotifierAlarm(int notifierHandle, long alarmTime, long intervalTime, boolean absolute, boolean ack) Updates the initial and interval alarm times for a notifier.static voidsetNotifierName(int notifierHandle, String name) Sets the name of the notifier.Methods inherited from class JNIWrapper
forceLoad, suppressUnused
-
Method Details
-
createNotifier
Creates a notifier.A notifier is an timer that alarms at an initial and (optionally) repeated intervals. This can be used to make precise control loops.
- Returns:
- the created notifier
- See Also:
-
setHALThreadPriority
Sets the HAL notifier thread priority.The HAL notifier thread is responsible for managing the system's notifier interrupt and waking up user's Notifiers when it's their time to run. Giving the HAL notifier thread real-time priority helps ensure the user's real-time Notifiers, if any, are notified to run in a timely manner.
- Parameters:
realTime- Set to true to set a real-time priority, false for standard priority.priority- Priority to set the thread to. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is forced to 0. See "man 7 sched" for more details.- Returns:
- True on success.
- See Also:
-
setNotifierName
Sets the name of the notifier.- Parameters:
notifierHandle- Notifier handle.name- Notifier name.- See Also:
-
destroyNotifier
Destroys a notifier.Destruction wakes up any waiters.
- Parameters:
notifierHandle- the notifier handle- See Also:
-
setNotifierAlarm
public static void setNotifierAlarm(int notifierHandle, long alarmTime, long intervalTime, boolean absolute, boolean ack) Updates the initial and interval alarm times for a notifier.The alarmTime is an absolute time (using the WPI now() time base) if absolute is true, or relative to the current time if absolute is false.
If intervalTime is non-zero, the notifier will alarm periodically following alarmTime at the given interval.
If an absolute alarmTime is in the past, the notifier will alarm immediately.
- Parameters:
notifierHandle- the notifier handlealarmTime- the first alarm time (in microseconds)intervalTime- the periodic interval time (in microseconds)absolute- true if the alarm time is absoluteack- true to acknowledge any prior alarm- See Also:
-
cancelNotifierAlarm
Cancels all future notifier alarms for a notifier.- Parameters:
notifierHandle- the notifier handleack- true to acknowledge any prior alarm- See Also:
-
acknowledgeNotifierAlarm
Indicates the notifier alarm has been serviced. Makes no change to future alarms.One of setNotifierAlarm (with ack=true), cancelNotifierAlarm (with ack=true), or this function must be called before waiting for the next alarm.
- Parameters:
notifierHandle- the notifier handle- See Also:
-
getNotifierOverrun
Gets the overrun count for a notifier.An overrun occurs when a notifier's alarm is not serviced before the next scheduled alarm time.
- Parameters:
notifierHandle- the notifier handle- Returns:
- overrun count
-