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.

  • Constructor Details

  • Method Details

    • initializeNotifier

      public static int initializeNotifier()
      Initializes the notifier.
      Returns:
      True on success.
    • setHALThreadPriority

      public static boolean setHALThreadPriority​(boolean realTime, int priority)
      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

      public static void setNotifierName​(int notifierHandle, String name)
      Sets the name of the notifier.
      Parameters:
      notifierHandle - Notifier handle.
      name - Notifier name.
    • stopNotifier

      public static void stopNotifier​(int notifierHandle)
      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

      public static void cleanNotifier​(int notifierHandle)
      Deletes the notifier object when we are done with it.
      Parameters:
      notifierHandle - Notifier handle.
    • updateNotifierAlarm

      public static void updateNotifierAlarm​(int notifierHandle, long triggerTime)
      Sets the notifier to wakeup the waiter in another triggerTime microseconds.
      Parameters:
      notifierHandle - Notifier handle.
      triggerTime - Trigger time in microseconds.
    • cancelNotifierAlarm

      public static void cancelNotifierAlarm​(int notifierHandle)
      Cancels any pending wakeups set by updateNotifierAlarm(). Does NOT wake up any waiters.
      Parameters:
      notifierHandle - Notifier handle.
    • waitForNotifierAlarm

      public static long waitForNotifierAlarm​(int notifierHandle)
      Block until woken up by an alarm (or stop).
      Parameters:
      notifierHandle - Notifier handle.
      Returns:
      Time when woken up.