Package edu.wpi.first.hal
Class NotifierJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.NotifierJNI
public class NotifierJNI extends JNIWrapper
The NotifierJNI class directly wraps the C++ HAL Notifier.
This class is not meant for direct use by teams. Instead, the edu.wpi.first.wpilibj.Notifier class, which corresponds to the C++ Notifier class, should be used.
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description NotifierJNI() -
Method Summary
Modifier and Type Method Description static voidcancelNotifierAlarm(int notifierHandle)Cancels any pending wakeups set by updateNotifierAlarm().static voidcleanNotifier(int notifierHandle)Deletes the notifier object when we are done with it.static intinitializeNotifier()Initializes the notifier.static booleansetHALThreadPriority(boolean realTime, int priority)Sets the HAL notifier thread priority.static voidsetNotifierName(int notifierHandle, String name)Sets the name of the notifier.static voidstopNotifier(int notifierHandle)Wakes up the waiter with time=0.static voidupdateNotifierAlarm(int notifierHandle, long triggerTime)Sets the notifier to wakeup the waiter in another triggerTime microseconds.static longwaitForNotifierAlarm(int notifierHandle)Block until woken up by an alarm (or stop).
-
Constructor Details
-
NotifierJNI
public NotifierJNI()
-
-
Method Details
-
initializeNotifier
Initializes the notifier.- Returns:
- True on success.
-
setHALThreadPriority
Sets the HAL notifier thread priority.- 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.
-
setNotifierName
Sets the name of the notifier.- Parameters:
notifierHandle- Notifier handle.name- Notifier name.
-
stopNotifier
Wakes up the waiter with time=0. Note: after this function is called, all calls to waitForNotifierAlarm() will immediately start returning 0.- Parameters:
notifierHandle- Notifier handle.
-
cleanNotifier
Deletes the notifier object when we are done with it.- Parameters:
notifierHandle- Notifier handle.
-
updateNotifierAlarm
Sets the notifier to wakeup the waiter in another triggerTime microseconds.- Parameters:
notifierHandle- Notifier handle.triggerTime- Trigger time in microseconds.
-
cancelNotifierAlarm
Cancels any pending wakeups set by updateNotifierAlarm(). Does NOT wake up any waiters.- Parameters:
notifierHandle- Notifier handle.
-
waitForNotifierAlarm
Block until woken up by an alarm (or stop).- Parameters:
notifierHandle- Notifier handle.- Returns:
- Time when woken up.
-